diff --git a/Makefile b/Makefile index 186e357b..0fb5a0d4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ +all: DEBUG_BEHAVIOR= all: libax5043.a all: radioafsk all: radiocw +debug: DEBUG_BEHAVIOR = -DDEBUG_LOGGING +debug: libax5043.a +debug: radioafsk +debug: radiocw + rebuild: clean rebuild: all @@ -44,67 +50,72 @@ libax5043.a: ax5043/spi/ax5043spi.o radiochat: libax5043.a radiochat: chat/chat_main.o - gcc -o radiochat -pthread -L./ chat/chat_main.o -lwiringPi -lax5043 + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o radiochat -pthread -L./ chat/chat_main.o -lwiringPi -lax5043 radiocw: libax5043.a radiocw: cw/cw_main.o radiocw: afsk/ax25.o radiocw: afsk/ax5043.o radiocw: afsk/send_afsk.o - gcc -o radiocw -L./ afsk/ax25.o afsk/ax5043.o afsk/send_afsk.o cw/cw_main.o -lwiringPi -lax5043 -lcurl + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o radiocw -L./ afsk/ax25.o afsk/ax5043.o afsk/send_afsk.o cw/cw_main.o -lwiringPi -lax5043 -lcurl radiopiglatin: libax5043.a radiopiglatin: piglatin/piglatin_main.o - gcc -o radiopiglatin -pedantic -Wall -Wextra -L./ piglatin/piglatin_main.o -lwiringPi -lax5043 + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o radiopiglatin -pedantic -Wall -Wextra -L./ piglatin/piglatin_main.o -lwiringPi -lax5043 testax5043tx: libax5043.a testax5043tx: transmit/transmit_main.o - gcc -o testax5043tx -pedantic -Wall -Wextra -L./ transmit/transmit_main.o -lwiringPi -lax5043 + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o testax5043tx -pedantic -Wall -Wextra -L./ transmit/transmit_main.o -lwiringPi -lax5043 testax5043rx: libax5043.a testax5043rx: receive/receive_main.o - gcc -o testax5043rx -pedantic -Wall -Wextra -L./ receive/receive_main.o -lwiringPi -lax5043 -lcurl + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o testax5043rx -pedantic -Wall -Wextra -L./ receive/receive_main.o -lwiringPi -lax5043 -lcurl testax5043init: libax5043.a testax5043init: init/init_main.o - gcc -o testax5043init -pedantic -Wall -Wextra -L./ init/init_main.o -lwiringPi -lax5043 -lcurl + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o testax5043init -pedantic -Wall -Wextra -L./ init/init_main.o -lwiringPi -lax5043 -lcurl testax50432freq: libax5043.a testax50432freq: transmit2freq/transmit2freq_main.o - gcc -o testax50432freq -pedantic -Wall -Wextra -L./ transmit2freq/transmit2freq_main.o -lwiringPi -lax5043 -lcurl + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o testax50432freq -pedantic -Wall -Wextra -L./ transmit2freq/transmit2freq_main.o -lwiringPi -lax5043 -lcurl testafsktx: libax5043.a testafsktx: afsktx/ax25.o testafsktx: afsktx/ax5043.o testafsktx: afsktx/main.o - gcc -o testafsktx -pedantic -Wall -Wextra -L./ afsktx/ax25.o afsktx/ax5043.o afsktx/main.o -lwiringPi -lax5043 -lcurl + gcc -std=gnu99 $(DEBUG_BEHAVIOR) -o testafsktx -pedantic -Wall -Wextra -L./ afsktx/ax25.o afsktx/ax5043.o afsktx/main.o -lwiringPi -lax5043 -lcurl radioafsk: libax5043.a radioafsk: afsk/ax25.o radioafsk: afsk/ax5043.o radioafsk: afsk/main.o radioafsk: afsk/ina219.h - gcc -o radioafsk -pedantic -Wall -Wextra -L./ afsk/ax25.o afsk/ax5043.o afsk/main.o -lwiringPi -lax5043 -lcurl +radioafsk: Adafruit_INA219/Adafruit_INA219.o +radioafsk: Adafruit_INA219/Adafruit_INA219.h + gcc $(DEBUG_BEHAVIOR) -o radioafsk -pedantic -Wall -Wextra -L./ afsk/ax25.o afsk/ax5043.o afsk/main.o Adafruit_INA219/Adafruit_INA219.o -lwiringPi -lax5043 -lcurl +Adafruit_INA219/Adafruit_INA219.o: Adafruit_INA219/Adafruit_INA219.c +Adafruit_INA219/Adafruit_INA219.o: Adafruit_INA219/Adafruit_INA219.h + cd Adafruit_INA219; gcc $(DEBUG_BEHAVIOR) -I -pedantic -Wconversion -Wall -Wextra -c Adafruit_INA219.c; cd .. ax5043/generated/configcommon.o: ax5043/generated/configcommon.c ax5043/generated/configcommon.o: ax5043/generated/configrx.h ax5043/generated/configcommon.o: ax5043/generated/configtx.h ax5043/generated/configcommon.o: ax5043/axradio/axradioinit.h ax5043/generated/configcommon.o: ax5043/axradio/axradioinit_p.h - cd ax5043/generated; gcc -pedantic -Wall -Wextra -c configcommon.c + cd ax5043/generated; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c configcommon.c ax5043/generated/configrx.o: ax5043/generated/configrx.c ax5043/generated/configrx.o: ax5043/generated/configrx.h ax5043/generated/configrx.o: ax5043/axradio/axradioinit.h ax5043/generated/configrx.o: ax5043/axradio/axradioinit_p.h - cd ax5043/generated; gcc -pedantic -Wall -Wextra -c configrx.c + cd ax5043/generated; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c configrx.c ax5043/generated/configtx.o: ax5043/generated/configtx.c ax5043/generated/configtx.o: ax5043/generated/configtx.h ax5043/generated/configtx.o: ax5043/axradio/axradioinit.h ax5043/generated/configtx.o: ax5043/axradio/axradioinit_p.h - cd ax5043/generated; gcc -pedantic -Wall -Wextra -c configtx.c + cd ax5043/generated; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c configtx.c ax5043/generated/config.o: ax5043/generated/config.c ax5043/generated/config.o: ax5043/generated/config.h @@ -113,12 +124,12 @@ ax5043/generated/config.o: ax5043/axradio/axradioinit_p.h ax5043/generated/config.o: ax5043/spi/ax5043spi.h ax5043/generated/config.o: ax5043/spi/ax5043spi_p.h ax5043/generated/config.o: ax5043/crc/crc.h - cd ax5043/generated; gcc -pedantic -Wall -Wextra -c config.c + cd ax5043/generated; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c config.c ax5043/spi/ax5043spi.o: ax5043/spi/ax5043spi.c ax5043/spi/ax5043spi.o: ax5043/spi/ax5043spi.h ax5043/spi/ax5043spi.o: ax5043/spi/ax5043spi_p.h - cd ax5043/spi; gcc -pedantic -Wall -Wextra -c ax5043spi.c + cd ax5043/spi; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c ax5043spi.c ax5043/ax5043support/ax5043init.o: ax5043/ax5043support/ax5043init.c ax5043/ax5043support/ax5043init.o: ax5043/ax5043support/ax5043init.h @@ -126,7 +137,7 @@ ax5043/ax5043support/ax5043init.o: ax5043/axradio/axradioinit.h ax5043/ax5043support/ax5043init.o: ax5043/axradio/axradioinit_p.h ax5043/ax5043support/ax5043init.o: ax5043/spi/ax5043spi.h ax5043/ax5043support/ax5043init.o: ax5043/spi/ax5043spi_p.h - cd ax5043/ax5043support; gcc -pedantic -Wall -Wextra -c ax5043init.c + cd ax5043/ax5043support; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c ax5043init.c ax5043/ax5043support/ax5043rx.o: ax5043/ax5043support/ax5043rx.c ax5043/ax5043support/ax5043rx.o: ax5043/ax5043support/ax5043rx.h @@ -134,7 +145,7 @@ ax5043/ax5043support/ax5043rx.o: ax5043/axradio/axradioinit.h ax5043/ax5043support/ax5043rx.o: ax5043/axradio/axradioinit_p.h ax5043/ax5043support/ax5043rx.o: ax5043/spi/ax5043spi.h ax5043/ax5043support/ax5043rx.o: ax5043/spi/ax5043spi_p.h - cd ax5043/ax5043support; gcc -pedantic -Wall -Wextra -c ax5043rx.c + cd ax5043/ax5043support; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c ax5043rx.c ax5043/ax5043support/ax5043tx.o: ax5043/ax5043support/ax5043tx.c ax5043/ax5043support/ax5043tx.o: ax5043/ax5043support/ax5043tx.h @@ -142,7 +153,7 @@ ax5043/ax5043support/ax5043tx.o: ax5043/axradio/axradioinit.h ax5043/ax5043support/ax5043tx.o: ax5043/axradio/axradioinit_p.h ax5043/ax5043support/ax5043tx.o: ax5043/spi/ax5043spi.h ax5043/ax5043support/ax5043tx.o: ax5043/spi/ax5043spi_p.h - cd ax5043/ax5043support; gcc -pedantic -Wall -Wextra -c ax5043tx.c + cd ax5043/ax5043support; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c ax5043tx.c ax5043/axradio/axradioinit.o: ax5043/axradio/axradioinit.c ax5043/axradio/axradioinit.o: ax5043/axradio/axradioinit.h @@ -152,7 +163,7 @@ ax5043/axradio/axradioinit.o: ax5043/spi/ax5043spi.h ax5043/axradio/axradioinit.o: ax5043/spi/ax5043spi_p.h ax5043/axradio/axradioinit.o: ax5043/generated/config.h ax5043/axradio/axradioinit.o: ax5043/crc/crc.h - cd ax5043/axradio; gcc -pedantic -Wall -Wextra -c axradioinit.c + cd ax5043/axradio; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c axradioinit.c ax5043/axradio/axradiomode.o: ax5043/axradio/axradiomode.c ax5043/axradio/axradiomode.o: ax5043/axradio/axradiomode.h @@ -162,7 +173,7 @@ ax5043/axradio/axradiomode.o: ax5043/axradio/axradioinit_p.h ax5043/axradio/axradiomode.o: ax5043/spi/ax5043spi.h ax5043/axradio/axradiomode.o: ax5043/spi/ax5043spi_p.h ax5043/axradio/axradiomode.o: ax5043/generated/config.h - cd ax5043/axradio; gcc -pedantic -Wall -Wextra -c axradiomode.c + cd ax5043/axradio; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c axradiomode.c ax5043/axradio/axradiorx.o: ax5043/axradio/axradiorx.c ax5043/axradio/axradiorx.o: ax5043/axradio/axradiorx.h @@ -172,7 +183,7 @@ ax5043/axradio/axradiorx.o: ax5043/axradio/axradioinit.h ax5043/axradio/axradiorx.o: ax5043/axradio/axradioinit_p.h ax5043/axradio/axradiorx.o: ax5043/spi/ax5043spi.h ax5043/axradio/axradiorx.o: ax5043/spi/ax5043spi_p.h - cd ax5043/axradio; gcc -pedantic -Wall -Wextra -c axradiorx.c + cd ax5043/axradio; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c axradiorx.c ax5043/axradio/axradiotx.o: ax5043/axradio/axradiotx.c ax5043/axradio/axradiotx.o: ax5043/axradio/axradiotx.h @@ -186,11 +197,11 @@ ax5043/axradio/axradiotx.o: ax5043/generated/config.h ax5043/axradio/axradiotx.o: ax5043/axradio/axradiomode.h ax5043/axradio/axradiotx.o: ax5043/axradio/axradiomode_p.h ax5043/axradio/axradiotx.o: ax5043/crc/crc.h - cd ax5043/axradio; gcc -pedantic -Wall -Wextra -c axradiotx.c + cd ax5043/axradio; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c axradiotx.c ax5043/crc/crc.o: ax5043/crc/crc.c ax5043/crc/crc.o: ax5043/crc/crc.h - cd ax5043/crc; gcc -pedantic -Wall -Wextra -c crc.c + cd ax5043/crc; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -pedantic -Wall -Wextra -c crc.c chat/chat_main.o: chat/chat_main.c chat/chat_main.o: ax5043/spi/ax5043spi.h @@ -204,13 +215,13 @@ chat/chat_main.o: ax5043/axradio/axradiorx_p.h chat/chat_main.o: ax5043/axradio/axradiotx.h chat/chat_main.o: ax5043/axradio/axradiotx_p.h chat/chat_main.o: ax5043/generated/configtx.h - cd chat; gcc -I../ax5043 -pedantic -Wconversion -Wall -Wextra -c chat_main.c; cd .. + cd chat; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I../ax5043 -pedantic -Wconversion -Wall -Wextra -c chat_main.c; cd .. afsk/ax25.o: afsk/ax25.c afsk/ax25.o: afsk/ax25.h afsk/ax25.o: afsk/ax5043.h afsk/ax25.o: afsk/status.h - cd afsk; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c ax25.c; cd .. + cd afsk; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c ax25.c; cd .. afsk/ax5043.o: afsk/ax5043.c afsk/ax5043.o: afsk/ax25.h @@ -219,21 +230,21 @@ afsk/ax5043.o: afsk/status.h afsk/ax5043.o: afsk/utils.h afsk/ax5043.o: afsk/main.c afsk/ax5043.o: ax5043/spi/ax5043spi.h - cd afsk; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c ax5043.c; cd .. + cd afsk; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c ax5043.c; cd .. afsk/main.o: afsk/main.c afsk/main.o: afsk/status.h afsk/main.o: afsk/ax5043.h afsk/main.o: afsk/ax25.h afsk/main.o: ax5043/spi/ax5043spi.h - cd afsk; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c main.c; cd .. + cd afsk; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c main.c; cd .. afsk/send_afsk.o: afsk/send_afsk.c afsk/send_afsk.o: afsk/send_afsk.h afsk/send_afsk.o: afsk/status.h afsk/send_afsk.o: afsk/ax5043.h afsk/send_afsk.o: afsk/ax25.h - cd afsk; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c send_afsk.c; cd .. + cd afsk; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c send_afsk.c; cd .. cw/cw_main.o: cw/cw_main.c cw/cw_main.o: ax5043/spi/ax5043spi.h @@ -247,7 +258,7 @@ cw/cw_main.o: ax5043/axradio/axradiorx_p.h cw/cw_main.o: ax5043/axradio/axradiotx.h cw/cw_main.o: ax5043/axradio/axradiotx_p.h cw/cw_main.o: ax5043/generated/configtx.h - cd cw; gcc -I../ax5043 -pedantic -Wconversion -Wall -Wextra -c cw_main.c; cd .. + cd cw; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I../ax5043 -pedantic -Wconversion -Wall -Wextra -c cw_main.c; cd .. piglatin/piglatin_main.o: piglatin/piglatin_main.c piglatin/piglatin_main.o: ax5043/spi/ax5043spi.h @@ -261,7 +272,7 @@ piglatin/piglatin_main.o: ax5043/axradio/axradiorx_p.h piglatin/piglatin_main.o: ax5043/axradio/axradiotx.h piglatin/piglatin_main.o: ax5043/axradio/axradiotx_p.h piglatin/piglatin_main.o: ax5043/generated/configtx.h - cd piglatin; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c piglatin_main.c; cd .. + cd piglatin; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c piglatin_main.c; cd .. receive/receive_main.o: receive/receive_main.c receive/receive_main.o: ax5043/axradio/axradioinit.h @@ -273,7 +284,7 @@ receive/receive_main.o: ax5043/axradio/axradiomode_p.h receive/receive_main.o: ax5043/axradio/axradiorx.h receive/receive_main.o: ax5043/axradio/axradiorx_p.h receive/receive_main.o: ax5043/generated/configrx.h - cd receive; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c receive_main.c; cd .. + cd receive; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c receive_main.c; cd .. transmit/transmit_main.o: transmit/transmit_main.c transmit/transmit_main.o: ax5043/axradio/axradioinit.h @@ -285,7 +296,7 @@ transmit/transmit_main.o: ax5043/axradio/axradiomode_p.h transmit/transmit_main.o: ax5043/axradio/axradiotx.h transmit/transmit_main.o: ax5043/axradio/axradiotx_p.h transmit/transmit_main.o: ax5043/generated/configtx.h - cd transmit; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c transmit_main.c; cd .. + cd transmit; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c transmit_main.c; cd .. transmit2freq/transmit2freq_main.o: transmit2freq/transmit2freq_main.c transmit2freq/transmit2freq_main.o: ax5043/axradio/axradioinit.h @@ -297,20 +308,20 @@ transmit2freq/transmit2freq_main.o: ax5043/axradio/axradiomode_p.h transmit2freq/transmit2freq_main.o: ax5043/axradio/axradiotx.h transmit2freq/transmit2freq_main.o: ax5043/axradio/axradiotx_p.h transmit2freq/transmit2freq_main.o: ax5043/generated/configtx.h - cd transmit2freq; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c transmit2freq_main.c; cd .. + cd transmit2freq; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c transmit2freq_main.c; cd .. init/init_main.o: init/init_main.c init/init_main.o: ax5043/axradio/axradioinit.h init/init_main.o: ax5043/axradio/axradioinit_p.h init/init_main.o: ax5043/spi/ax5043spi.h init/init_main.o: ax5043/spi/ax5043spi_p.h - cd init; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c init_main.c; cd .. + cd init; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c init_main.c; cd .. afsktx/ax25.o: afsktx/ax25.c afsktx/ax25.o: afsktx/ax25.h afsktx/ax25.o: afsktx/ax5043.h afsktx/ax25.o: afsktx/status.h - cd afsktx; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c ax25.c; cd .. + cd afsktx; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c ax25.c; cd .. afsktx/ax5043.o: afsktx/ax5043.c afsktx/ax5043.o: afsktx/ax25.h @@ -318,11 +329,11 @@ afsktx/ax5043.o: afsktx/ax5043.h afsktx/ax5043.o: afsktx/status.h afsktx/ax5043.o: afsktx/utils.h afsktx/ax5043.o: ax5043/spi/ax5043spi.h - cd afsktx; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c ax5043.c; cd .. + cd afsktx; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c ax5043.c; cd .. afsktx/main.o: afsktx/main.c afsktx/main.o: afsktx/status.h afsktx/main.o: afsktx/ax5043.h afsktx/main.o: afsktx/ax25.h afsktx/main.o: ax5043/spi/ax5043spi.h - cd afsktx; gcc -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c main.c; cd .. + cd afsktx; gcc -std=gnu99 $(DEBUG_BEHAVIOR) -I ../ax5043 -pedantic -Wconversion -Wall -Wextra -c main.c; cd .. diff --git a/README.md b/README.md index 4cb78bcb..d9367e2f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,15 @@ # CubeSatSim -See the Wiki for more details. To build and run the software on a Raspberry Pi 3B, 3B+, or Pi Zero W: +The CubeSat Simulator https://github.com/alanbjohnston/CubeSatSim/wiki is a low cost satellite emulator that run on solar panels and batteries, transmits UHF radio telemetry, has a 3D printed frame, and can be extended by additional sensors and modules. This project is sponsored by the not-for-profit [Radio Amateur Satellite Corporation, AMSAT®](https://amsat.org). + +See the Wiki Software Install page for more details: https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install. To build and run the software on a Raspberry Pi 3B, 3B+, or Pi Zero W: `git clone http://github.com/alanbjohnston/CubeSatSim.git` `cd CubeSatSim` +Edit the afsk/main.c file to set your amateur radio callsign, then + `make rebuild` To hear CW telemetry (Morse code), tune your radio or SDR to 435.297 MHz and enter: @@ -16,15 +20,18 @@ To stop, Ctrl-C. To hear AFSK telemetry (X.25 data), your radio or SDR to 440.3 `./radioafsk` -This code uses the Brandenburg Tech Digital Transceiver, based on DigitalTxRxRP - https://brandenburgtech.wordpress.com/- +This code uses the Brandenburg Tech Digital Transceiver, based on DigitalTxRxRP https://brandenburgtech.wordpress.com/ + +This repository contains: - - cw - Code that sends telemetry in CW (Morse code) using AO-7 format - - afsk - Code that sends telemetry in 1k2 AFSK X.25 format + - afsk - Code that sends telemetry in 1k2 AFSK X.25 format + - arduino - Sample Arduino sketches to show how payload sensors can be interfaced to CubeSat Simulator - ax5043 - Source for a library of functions to communicate with the AX5043 and configure the AX5043. + - cw - Code that sends telemetry in CW (Morse code) using AO-7 format - libs - External libraries - python - Python code for reading I2C sensors for current and temperature - - spreadsheet - Spreadsheets and macros for analyzing the Simulator telemetry + - spreadsheet - Spreadsheets for decoding and analyzing the Simulator telemetry (see https://github.com/alanbjohnston/CubeSatSim/wiki/Decoding-Telemetry for details) - wav - Wave audio files of CW or AFSK telemetry for listening or transmitting usng a CubeSat Simulator Lite + - demo.sh - a shell script to run the Simulator on boot using systemd (see https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install#autoboot-configuration for how to configure the Pi) -See the Wiki for more details +See the Wiki for more details https://github.com/alanbjohnston/CubeSatSim/wiki diff --git a/afsk/ax5043.c b/afsk/ax5043.c index f74b4ad9..f8c3b2e9 100644 --- a/afsk/ax5043.c +++ b/afsk/ax5043.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "ax25.h" #include "ax5043.h" #include "status.h" @@ -447,11 +448,10 @@ int ax5043_set_tx_freq(ax5043_conf_t *conf, uint32_t freq) { conf->tx_freq = freq; /* If the frequency difference is great enough perform autoranging */ -/* if (freq + 25000000 > prev_freq || freq - 25000000 < prev_freq) { ax5043_autoranging(conf); } -*/ + return PQWS_SUCCESS; } @@ -616,23 +616,33 @@ int ax5043_autoranging(ax5043_conf_t *conf) { val = BIT(4) | AX5043_VCOR_INIT; ret = ax5043_spi_write_8(conf, pllranging_reg, val); if (ret) { + printf("ERROR: AX5043 Autoranging Write Failure\n\n"); return ret; } usleep(10); - val = 0; + //val = 0; /* Wait until the autoranging is complete */ - while ((val & BIT(4)) == 0) { + int timeout = 0; + clock_t start = clock(); + while (((val & BIT(4)) != 0) && !timeout ) { // changed to !=, since https://www.onsemi.com/pub/Collateral/AND9347-D.PDF says BIT(4) RNG START clears when autoranging done ret = ax5043_spi_read_8(conf, &val, pllranging_reg); if (ret) { + printf("ERROR: AX5043 Autoranging Read Failure\n\n"); return ret; } + if ((clock() - start) > 1000000) { + timeout = 1; + } } if (val & BIT(5)) { + printf("ERROR: AX5043 Autoranging Error\n\n"); return -PQWS_AX5043_AUTORANGING_ERROR; + } else if (timeout) { + printf("ERROR: AX5043 Autoranging Timeout\n\n"); + return -1; } - return PQWS_SUCCESS; } @@ -1061,7 +1071,9 @@ int ax5043_wait_for_transmit() { /* tx is done */ __tx_frame_end(__ax5043_conf); transmittedPostamble = 0; - printf("INFO: TX done\n"); + #ifdef DEBUG_LOGGING + printf("INFO: TX done\n"); + #endif return PQWS_SUCCESS; } @@ -1120,7 +1132,9 @@ int ax5043_wait_for_transmit() { if (radiostate == 0) { /* tx is done */ __tx_active = 0; - printf("INFO: TX done\n"); + #ifdef DEBUG_LOGGING + printf("INFO: TX done\n"); + #endif } } } diff --git a/afsk/main.c b/afsk/main.c index f452efeb..9fc7e7e8 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1,5 +1,5 @@ /* - * Transmits CubeSat Telemetry at 440MHz in AO-7 format + * Transmits CubeSat Telemetry at 434.9MHz in AO-7 format * * Copyright Alan B. Johnston * @@ -19,10 +19,7 @@ * along with this program. If not, see . */ -//#include //Needed for I2C port -#include //Needed for I2C port -//#include //Needed for I2C port - +#include #include #include #include @@ -34,34 +31,25 @@ #include #include #include -#include "ina219.h" - -// Put your callsign here -#define CALLSIGN "KU2Y" -#define VBATT 15 -#define ADC5 17 -#define ADC6 18 -#define ADC7 19 -#define ADC8 20 -#define TIME 8 -#define UCTEMP 30 -#define UPTIME_SEC 8 +#include +#include "../Adafruit_INA219/Adafruit_INA219.h" // From Adafruit INA219 library for Arduino + #define A 1 #define B 2 #define C 3 #define D 4 -#define SENSOR_40 0 -#define SENSOR_41 3 -#define SENSOR_44 6 -#define SENSOR_45 9 -#define SENSOR_4A 12 -#define VOLTAGE 0 -#define CURRENT 1 -#define POWER 2 -#define VBATT 15 - -uint32_t tx_freq_hz = 440310000; +#define PLUS_X 0 +#define PLUS_Y 1 +#define PLUS_Z 2 +#define BAT 3 +#define MINUS_X 4 +#define MINUS_Y 5 +#define MINUS_Z 6 +#define BUS 7 +#define OFF -1 + +uint32_t tx_freq_hz = 434900000 + FREQUENCY_OFFSET; uint32_t tx_channel = 0; ax5043_conf_t hax5043; @@ -72,6 +60,7 @@ int get_tlm(int tlm[][5]); long int timestamp; void config_x25(); void trans_x25(); + //long int timestamp; int tempSensor; @@ -79,199 +68,241 @@ int upper_digit(int number); int lower_digit(int number); int charging = 0; -uint16_t config = (0x2000 | 0x1800 | 0x0180 | 0x0018 | 0x0007 ); +uint16_t x_config = (0x2000 | 0x1800 | 0x0180 | 0x0018 | 0x0007 ); -int x_fd; // I2C bus 0 address 0x40 -int x_powerMultiplier; -int x_currentDivider; -int x_calValue; -int y_fd; // I2C bus 0 address 0x41 -int z_fd; // I2C bos 0 address 0x44 +struct SensorConfig { + int fd; + uint16_t config; + int calValue; + int powerMultiplier; + int currentDivider; +}; +struct SensorData { + double current; + double voltage; + double power; +}; -int main(void) { - wiringPiSetup () ; - pinMode (0, OUTPUT) ; - int blink; - for (blink = 1; blink < 4 ;blink++) - { - digitalWrite (0, HIGH) ; delay (500) ; - digitalWrite (0, LOW) ; delay (500) ; - } - digitalWrite (0, HIGH) ; - - setSpiChannel(SPI_CHANNEL); - setSpiSpeed(SPI_SPEED); - initializeSpi(); - - int tlm[7][5]; - memset(tlm, 0, sizeof tlm); - - timestamp = time(NULL); +/** + * @brief Read the data from one of the i2c current sensors. + * + * Reads the current data from the requested i2c current sensor and + * stores it into a SensorData struct. An invalid file descriptor (i.e. less than zero) + * results in a SensorData struct being returned that has both its #current and #power members + * set to NAN. + * + * + * @param sensor A file descriptor that can be used to read from the sensor. + * @return struct SensorData A struct that contains the power and current reading from the requested sensor. + */ +struct SensorData read_sensor_data(struct SensorConfig sensor) { + struct SensorData data = { + .current = NAN, + .voltage = NAN, + .power = NAN }; + + if (sensor.fd < 0) { + return data; + } - int file_i2c; - //char *filenam1e = (char*)"/dev/i2c-3"; - if ((file_i2c = open("/dev/i2c-3", O_RDWR)) < 0) - { - fprintf(stderr,"ERROR: /dev/ic2-3 bus not present\n"); - tempSensor = -1; - } else - { - tempSensor = wiringPiI2CSetupInterface("/dev/i2c-3", 0x48); + wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CALIBRATION, sensor.calValue); + wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CONFIG, sensor.config); + wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CALIBRATION, sensor.calValue); + data.current = wiringPiI2CReadReg16(sensor.fd, INA219_REG_CURRENT) / sensor.currentDivider; + uint16_t value = (uint16_t)wireReadRegister(sensor.fd, INA219_REG_BUSVOLTAGE); + data.voltage = ((double)(value >> 3) * 4) / 1000; + data.power = wiringPiI2CReadReg16(sensor.fd, INA219_REG_POWER) * sensor.powerMultiplier; + + return data; +} +struct SensorConfig config_sensor(int sensor, int milliAmps) { + struct SensorConfig data; + + data.fd = sensor; + data.config = INA219_CONFIG_BVOLTAGERANGE_32V | + INA219_CONFIG_GAIN_1_40MV | + INA219_CONFIG_BADCRES_12BIT | + INA219_CONFIG_SADCRES_12BIT_1S_532US | + INA219_CONFIG_MODE_SANDBVOLT_CONTINUOUS; + + if (milliAmps == 400) { // INA219 16V 400mA configuration + data.calValue = 8192; + data.powerMultiplier = 1; + data.currentDivider = 20; // 40; in Adafruit config } + else { // INA219 16V 2A configuration + data.calValue = 40960; + data.powerMultiplier = 2; + data.currentDivider = 10; // 20; in Adafruit config + } + return data; +} -// fprintf(stderr,"tempSensor: %d \n",tempSensor); - - int arduinoI2C; - if ((arduinoI2C = open("/dev/i2c-0", O_RDWR)) < 0) - { - fprintf(stderr,"ERROR: /dev/i2c-0 bus not present\n"); - } else { - arduinoI2C = wiringPiI2CSetupInterface("/dev/i2c-0", 0x4B); -// fprintf(stderr,"arduinoI2C: %d\n", arduinoI2C); - if (arduinoI2C > 0) { - if(wiringPiI2CReadReg16(arduinoI2C,0) < 0) { - arduinoI2C = -1; // Disable reading of Arduino payload information - fprintf(stderr,"Arduino payload not present\n"); - } - } else { - fprintf(stderr,"Arduino payload not present\n"); - } - } +struct SensorConfig sensor[8]; // 7 current sensors in Solar Power PCB plus one in MoPower UPS V2 +struct SensorData reading[8]; // 7 current sensors in Solar Power PCB plus one in MoPower UPS V2 -// new INA219 current reading code - - x_calValue = 8192; - x_powerMultiplier = 1; - x_currentDivider = 20; - config = INA219_CONFIG_BVOLTAGERANGE_16V | - INA219_CONFIG_GAIN_40MV | - INA219_CONFIG_BADCRES_12BIT | - INA219_CONFIG_SADCRES_12BIT_4S_2130US | - //INA219_CONFIG_SADCRES_12BIT_1S_532US | - INA219_CONFIG_MODE_SANDBVOLT_CONTINUOUS; - - if ((file_i2c = open("/dev/i2c-0", O_RDWR)) < 0) - { - fprintf(stderr,"ERROR: /dev/ic2-0 bus not present\n"); - x_fd = -1; // Disable reading -X, -Y, and -Z telemetry - y_fd = -1; - z_fd = -1; - } else - { - x_fd = wiringPiI2CSetupInterface("/dev/i2c-0", 0x40); -// fprintf(stderr,"Opening of -X fd %d\n", x_fd); - y_fd = wiringPiI2CSetupInterface("/dev/i2c-0", 0x41); -// printf("Opening of -Y fd %d\n", y_fd); - z_fd = wiringPiI2CSetupInterface("/dev/i2c-0", 0x44); -// printf("Opening of -Z fd %d\n", z_fd); - } - - int ret; - uint8_t data[1024]; - - tx_freq_hz -= tx_channel * 50000; - - init_rf(); - -// ax25_init(&hax25, (uint8_t *) "CubeSatSim", '2', (uint8_t *) CALLSIGN, '2', - ax25_init(&hax25, (uint8_t *) "CQ", '1', (uint8_t *) CALLSIGN, '1', - AX25_PREAMBLE_LEN, - AX25_POSTAMBLE_LEN); - - - /* Infinite loop */ - for (;;) { - sleep(1); - - fprintf(stderr,"INFO: Getting TLM Data\n"); - - get_tlm(tlm); +char src_addr[5] = ""; +char dest_addr[5] = "CQ"; - fprintf(stderr,"INFO: Preparing X.25 packet\n"); - - char str[1000]; - char tlm_str[1000]; - - char header_str[] = "\x03\xf0hi hi "; - strcpy(str, header_str); +int main(int argc, char *argv[]) { - int channel; - for (channel = 1; channel < 7; channel++) { -// printf("%d %d %d %d \n", tlm[channel][1], tlm[channel][2], tlm[channel][3], tlm[channel][4]); - sprintf(tlm_str, "%d%d%d %d%d%d %d%d%d %d%d%d ", - channel, upper_digit(tlm[channel][1]), lower_digit(tlm[channel][1]), - channel, upper_digit(tlm[channel][2]), lower_digit(tlm[channel][2]), - channel, upper_digit(tlm[channel][3]), lower_digit(tlm[channel][3]), - channel, upper_digit(tlm[channel][4]), lower_digit(tlm[channel][4])); - printf("%s \n",tlm_str); - strcat(str, tlm_str); - } - - if (arduinoI2C > 0) { /* Read Arduino payload */ - for(int reg = 0; reg < 4; reg++) { - sprintf(tlm_str, " %04x",wiringPiI2CReadReg16(arduinoI2C,reg)); - printf("%s \n",tlm_str); - strcat(str,tlm_str); /* Append payload telemetry */ - usleep(100000); - } - } - - digitalWrite (0, LOW); - -/* - char cmdbuffer[1000]; - - if (charging) { - FILE* file1 = popen("/home/pi/mopower/mpcmd LED_STAT=1", "r"); - fgets(cmdbuffer, 999, file1); - pclose(file1); - -// printf("LED state: %s\n", cmdbuffer); - } -*/ - fprintf(stderr,"INFO: Transmitting X.25 packet\n"); - - memcpy(data, str, strnlen(str, 256)); - ret = ax25_tx_frame(&hax25, &hax5043, data, strnlen(str, 256)); - if (ret) { - fprintf(stderr, - "ERROR: Failed to transmit AX.25 frame with error code %d\n", - ret); - exit(EXIT_FAILURE); - } - ax5043_wait_for_transmit(); - digitalWrite (0, HIGH); + if (argc > 1) { + strcpy(src_addr, argv[1]); + } + + wiringPiSetup (); + pinMode (0, OUTPUT); + + setSpiChannel(SPI_CHANNEL); + setSpiSpeed(SPI_SPEED); + initializeSpi(); + + int tlm[7][5]; + memset(tlm, 0, sizeof tlm); + + timestamp = time(NULL); + + int file_i2c = access("/dev/i2c-3", W_OK | R_OK); + + if (file_i2c < 0) + { + fprintf(stderr,"ERROR: /dev/ic2-3 bus not present\n"); + tempSensor = OFF; + } else + { + tempSensor = wiringPiI2CSetupInterface("/dev/i2c-3", 0x48); + } + + #ifdef DEBUG_LOGGING + fprintf(stderr,"tempSensor: %d \n",tempSensor); + #endif -/* - FILE* file2 = popen("/home/pi/mopower/mpcmd LED_STAT=0", "r"); - fgets(cmdbuffer, 999, file2); - pclose(file2); - -// printf("LED state: %s\n", cmdbuffer); -*/ - if (ret) { - fprintf(stderr, - "ERROR: Failed to transmit entire AX.25 frame with error code %d\n", - ret); - exit(EXIT_FAILURE); - } + int test; + if (((test = open("/dev/i2c-1", O_RDWR))) > 0) // Test if I2C Bus 1 is present + { + close(test); + sensor[PLUS_X] = config_sensor(wiringPiI2CSetupInterface("/dev/i2c-1", 0x40), 400); + sensor[PLUS_Y] = config_sensor(wiringPiI2CSetupInterface("/dev/i2c-1", 0x41), 400); + sensor[PLUS_Z] = config_sensor(wiringPiI2CSetupInterface("/dev/i2c-1", 0x44), 400); + sensor[BAT] = config_sensor(wiringPiI2CSetupInterface("/dev/i2c-1", 0x45), 400); + sensor[BUS] = config_sensor(wiringPiI2CSetupInterface("/dev/i2c-1", 0x4a), 2400); + } else + { + printf("ERROR: /dev/i2c-1 not present \n"); + sensor[PLUS_X] = config_sensor(OFF, 0); + sensor[PLUS_Y] = config_sensor(OFF, 0); + sensor[PLUS_Z] = config_sensor(OFF, 0); + sensor[BAT] = config_sensor(OFF, 0); + sensor[BUS] = config_sensor(OFF, 0); + } + if (((test = open("/dev/i2c-0", O_RDWR))) > 0) // Test if I2C Bus 0 is present + { + close(test); + sensor[MINUS_X] = config_sensor(wiringPiI2CSetupInterface("/dev/i2c-0", 0x40), 400); + sensor[MINUS_Y] = config_sensor(wiringPiI2CSetupInterface("/dev/i2c-0", 0x41), 400); + sensor[MINUS_Z] = config_sensor(wiringPiI2CSetupInterface("/dev/i2c-0", 0x44), 400); + + } else + { + printf("ERROR: /dev/i2c-0 not present \n"); + sensor[MINUS_X] = config_sensor(OFF, 0); + sensor[MINUS_Y] = config_sensor(OFF, 0); + sensor[MINUS_Z] = config_sensor(OFF, 0); + } + #ifdef DEBUG_LOGGING + printf("Sensor[0] config %d %d %d %d %d\n", + sensor[0].fd, sensor[0].config, sensor[0].calValue, sensor[0].currentDivider, sensor[0].powerMultiplier); + printf("Sensor[BUS] config %d %d %d %d %d\n", + sensor[BUS].fd, sensor[BUS].config, sensor[BUS].calValue, sensor[BUS].currentDivider, sensor[BUS].powerMultiplier); + #endif + + int ret; + uint8_t data[1024]; + + tx_freq_hz -= tx_channel * 50000; + + init_rf(); + + ax25_init(&hax25, (uint8_t *) dest_addr, '1', (uint8_t *) src_addr, '1', + AX25_PREAMBLE_LEN, + AX25_POSTAMBLE_LEN); + + /* Infinite loop */ + for (;;) { + sleep(1); // Delay 1 second + + #ifdef DEBUG_LOGGING + fprintf(stderr,"INFO: Getting TLM Data\n"); + #endif + + get_tlm(tlm); + + #ifdef DEBUG_LOGGING + fprintf(stderr,"INFO: Preparing X.25 packet\n"); + #endif + + char str[1000]; + char tlm_str[1000]; + + char header_str[] = "\x03\xf0hi hi "; + strcpy(str, header_str); + // printf("%s-1>CQ-1:hi hi ", CALLSIGN); + printf("%s-1>%s-1:hi hi ", (uint8_t *)src_addr, (uint8_t *)dest_addr); + + + int channel; + for (channel = 1; channel < 7; channel++) { + sprintf(tlm_str, "%d%d%d %d%d%d %d%d%d %d%d%d ", + channel, upper_digit(tlm[channel][1]), lower_digit(tlm[channel][1]), + channel, upper_digit(tlm[channel][2]), lower_digit(tlm[channel][2]), + channel, upper_digit(tlm[channel][3]), lower_digit(tlm[channel][3]), + channel, upper_digit(tlm[channel][4]), lower_digit(tlm[channel][4])); + printf("%s",tlm_str); + strcat(str, tlm_str); + } + printf("\n"); + + digitalWrite (0, LOW); + + #ifdef DEBUG_LOGGING + fprintf(stderr,"INFO: Transmitting X.25 packet\n"); + #endif + memcpy(data, str, strnlen(str, 256)); + ret = ax25_tx_frame(&hax25, &hax5043, data, strnlen(str, 256)); + if (ret) { + fprintf(stderr, + "ERROR: Failed to transmit AX.25 frame with error code %d\n", + ret); + exit(EXIT_FAILURE); + } + + ax5043_wait_for_transmit(); + digitalWrite (0, HIGH); + + if (ret) { + fprintf(stderr, + "ERROR: Failed to transmit entire AX.25 frame with error code %d\n", + ret); + exit(EXIT_FAILURE); } + } - return 0; + return 0; } static void init_rf() { - int ret; + int ret; + #ifdef DEBUG_LOGGING fprintf(stderr,"Initializing AX5043\n"); - - ret = ax5043_init(&hax5043, XTAL_FREQ_HZ, VCO_INTERNAL); - if (ret != PQWS_SUCCESS) { - fprintf(stderr, - "ERROR: Failed to initialize AX5043 with error code %d\n", ret); - exit(EXIT_FAILURE); - } + #endif + ret = ax5043_init(&hax5043, XTAL_FREQ_HZ, VCO_INTERNAL); + if (ret != PQWS_SUCCESS) { + fprintf(stderr, + "ERROR: Failed to initialize AX5043 with error code %d\n", ret); + exit(EXIT_FAILURE); + } } // Returns lower digit of a number which must be less than 99 @@ -297,119 +328,72 @@ int upper_digit(int number) { fprintf(stderr,"ERROR: Not a digit in upper_digit!\n"); return digit; } -int get_tlm(int tlm[][5]) { - -// Reading I2C voltage and current sensors - - char cmdbuffer[1000]; - FILE* file = popen("sudo python /home/pi/CubeSatSim/python/readcurrent.py 2>&1", "r"); - fgets(cmdbuffer, 999, file); - pclose(file); - fprintf(stderr,"I2C Sensor data: %s\n", cmdbuffer); - - char ina219[16][20]; // voltage, currents, and power from the INA219 current sensors x4a, x40, x41, x44, and x45. - int i = 0; - char * data2 = strtok (cmdbuffer," "); - - while (data2 != NULL) { - strcpy(ina219[i], data2); - // printf ("ina219[%d]=%s\n",i,ina219[i]); - data2 = strtok (NULL, " "); - i++; - } - - // Reading MoPower telemetry info -/* - file = popen("/home/pi/mopower/mpcmd show data", "r"); - - fgets(cmdbuffer, 999, file); - - pclose(file); -// printf("MoPower data: %s\n", cmdbuffer); - - char mopower[64][14]; -// char str[] ="- This, a sample string."; - char * pch; -// printf ("Splitting string \"%s\" into tokens:\n",str); -// pch = strtok (str," "); - i = 0; - pch = strtok (cmdbuffer," ,.-"); - while (pch != NULL) - { - strcpy(mopower[i], pch); -// printf ("mopwer[%d]=%s\n",i,mopower[i]); // pch); - pch = strtok (NULL, " "); - i++; - } - printf("Battery voltage = %s\n", mopower[16]); - if (strtof(mopower[17],NULL) > -0.5) { - charging = 1; - printf("Charging on\n"); - } - else { - charging = 0; - printf("Charging off\n"); - } -*/ -// read i2c current sensors // - double current = 0, power = 0, y_current = 0, y_power = 0, z_current = 0, z_power = 0; - if (x_fd != -1) { - wiringPiI2CWriteReg16(x_fd, INA219_REG_CALIBRATION, x_calValue); - wiringPiI2CWriteReg16(x_fd, INA219_REG_CONFIG, config); - wiringPiI2CWriteReg16(x_fd, INA219_REG_CALIBRATION, x_calValue); - current = wiringPiI2CReadReg16(x_fd, INA219_REG_CURRENT) / x_currentDivider; - power = wiringPiI2CReadReg16(x_fd, INA219_REG_POWER) * x_powerMultiplier; - wiringPiI2CWriteReg16(y_fd, INA219_REG_CALIBRATION, x_calValue); - wiringPiI2CWriteReg16(y_fd, INA219_REG_CONFIG, config); - wiringPiI2CWriteReg16(y_fd, INA219_REG_CALIBRATION, x_calValue); - y_current = wiringPiI2CReadReg16(y_fd, INA219_REG_CURRENT) / x_currentDivider; - y_power = wiringPiI2CReadReg16(y_fd, INA219_REG_POWER) * x_powerMultiplier; - wiringPiI2CWriteReg16(z_fd, INA219_REG_CALIBRATION, x_calValue); - wiringPiI2CWriteReg16(z_fd, INA219_REG_CONFIG, config); - wiringPiI2CWriteReg16(z_fd, INA219_REG_CALIBRATION, x_calValue); - z_current = wiringPiI2CReadReg16(z_fd, INA219_REG_CURRENT) / x_currentDivider; - z_power = wiringPiI2CReadReg16(z_fd, INA219_REG_POWER) * x_powerMultiplier; - } - printf("-X 0x40 current %4.2f power %4.2f -Y 0x41 current %4.2f power %4.2f -Z 0x44 current %4.2f power %4.2f \n", - current, power, y_current, y_power, z_current, z_power); - -// printf("1B: ina219[%d]: %s val: %f \n", SENSOR_40 + CURRENT, ina219[SENSOR_40 + CURRENT], strtof(ina219[SENSOR_40 + CURRENT], NULL)); - - tlm[1][A] = (int)(strtof(ina219[SENSOR_4A + CURRENT], NULL) / 15 + 0.5) % 100; // Current of 5V supply to Pi - tlm[1][B] = (int) (99.5 - strtof(ina219[SENSOR_40 + CURRENT], NULL)/10) % 100; // +X current [4] - tlm[1][C] = (int) (99.5 - current/10) % 100; // X- current [10] - tlm[1][D] = (int) (99.5 - strtof(ina219[SENSOR_41 + CURRENT], NULL)/10) % 100; // +Y current [7] - - tlm[2][A] = (int) (99.5 - y_current/10) % 100; // -Y current [10] - tlm[2][B] = (int) (99.5 - strtof(ina219[SENSOR_44 + CURRENT], NULL)/10) % 100; // +Z current [10] // was 70/2m transponder power, AO-7 didn't have a Z panel - tlm[2][C] = (int) (99.5 - z_current/10) % 100; // -Z current (was timestamp) - -// tlm[2][C] = (int)((time(NULL) - timestamp) / 15) % 100; - tlm[2][D] = (int)(50.5 + strtof(ina219[SENSOR_45 + CURRENT], NULL)/10.0) % 100; // NiMH Battery current +int get_tlm(int tlm[][5]) { +// Reading I2C voltage and current sensors + int count; + for (count = 0; count < 8; count++) + { + reading[count] = read_sensor_data(sensor[count]); + #ifdef DEBUG_LOGGING + printf("Read sensor[%d] % 4.2fV % 6.1fmA % 6.1fmW \n", + count, reading[count].voltage, reading[count].current, reading[count].power); + #endif + } + + tlm[1][A] = (int)(reading[BUS].voltage /15.0 + 0.5) % 100; // Current of 5V supply to Pi + tlm[1][B] = (int) (99.5 - reading[PLUS_X].current/10.0) % 100; // +X current [4] + tlm[1][C] = (int) (99.5 - reading[MINUS_X].current/10.0) % 100; // X- current [10] + tlm[1][D] = (int) (99.5 - reading[PLUS_Y].current/10.0) % 100; // +Y current [7] + + tlm[2][A] = (int) (99.5 - reading[MINUS_Y].current/10.0) % 100; // -Y current [10] + tlm[2][B] = (int) (99.5 - reading[PLUS_Z].current/10.0) % 100; // +Z current [10] // was 70/2m transponder power, AO-7 didn't have a Z panel + tlm[2][C] = (int) (99.5 - reading[MINUS_Z].current/10.0) % 100; // -Z current (was timestamp) + tlm[2][D] = (int)(50.5 + reading[BAT].current/10.0) % 100; // NiMH Battery current - tlm[3][A] = abs((int)((strtof(ina219[SENSOR_45 + VOLTAGE], NULL) * 10) - 65.5) % 100); - tlm[3][B] = (int)(strtof(ina219[SENSOR_4A + VOLTAGE], NULL) * 10.0) % 100; // 5V supply to Pi + tlm[3][A] = abs((int)((reading[BAT].voltage * 10.0) - 65.5) % 100); + tlm[3][B] = (int)(reading[BUS].voltage * 10.0) % 100; // 5V supply to Pi - if (tempSensor != -1) { - int tempValue = wiringPiI2CReadReg16(tempSensor, 0); -// printf("Read: %x\n", tempValue); - uint8_t upper = (uint8_t) (tempValue >> 8); - uint8_t lower = (uint8_t) (tempValue & 0xff); - float temp = (float)lower + ((float)upper / 0x100); - - tlm[4][A] = (int)((95.8 - temp)/1.48 + 0.5) % 100; - } - tlm[6][B] = 0 ; - tlm[6][D] = 49 + rand() % 3; + if (tempSensor != OFF) { + int tempValue = wiringPiI2CReadReg16(tempSensor, 0); + uint8_t upper = (uint8_t) (tempValue >> 8); + uint8_t lower = (uint8_t) (tempValue & 0xff); + float temp = (float)lower + ((float)upper / 0x100); + + #ifdef DEBUG_LOGGING + printf("Temp Sensor Read: %6.1f\n", temp); + #endif + + tlm[4][A] = (int)((95.8 - temp)/1.48 + 0.5) % 100; + } + + FILE *cpuTempSensor = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); + if (cpuTempSensor) { + double cpuTemp; + fscanf (cpuTempSensor, "%lf", &cpuTemp); + cpuTemp /= 1000; + + #ifdef DEBUG_LOGGING + printf("CPU Temp Read: %6.1f\n", cpuTemp); + #endif + + tlm[4][B] = (int)((95.8 - cpuTemp)/1.48 + 0.5) % 100; + fclose (cpuTempSensor); + } + + tlm[6][B] = 0 ; + tlm[6][D] = 49 + rand() % 3; + #ifdef DEBUG_LOGGING // Display tlm int k, j; for (k = 1; k < 7; k++) { - for (j = 1; j < 5; j++) { - printf(" %2d ", tlm[k][j]); - } - printf("\n"); + for (j = 1; j < 5; j++) { + printf(" %2d ", tlm[k][j]); + } + printf("\n"); } - return 0; + #endif + + return 0; } diff --git a/groundstation/README.md b/groundstation/README.md new file mode 100644 index 00000000..941a15cf --- /dev/null +++ b/groundstation/README.md @@ -0,0 +1,17 @@ +These files relate to the optional Raspberry Pi Ground Station. + +The Ground Station can be installed on any Windows or Linux PC or laptop, but it does require drivers to be installed (RTL-SDR) +and virtual audio cable (for sound) to be installed. This requires administrator privileges on the computer. + +A simpler approach perhaps well suited to school environments is to use a dedicated Raspberry Pi Ground Station + +The Raspberry Pi Ground Station can be used as a stand-alone ground station for receiving, decoding, and analyzing telemetry +from the CubeSat Simulator if an HDMI monitor, USB keyboard, and USB mouse are plugged into the Pi. + +Alternatively, with another computer or laptop that has SSH access to the Pi, the telemetry can be received and decoded on the Pi +and analyzed on the other computer or laptop. + +Also, a web SDR known as OpenWebRX can be run on the Pi so that other PCs or laptops on the same WiFi can use the SDR to tune the +telemetry with only a web browser. + +See https://github.com/alanbjohnston/CubeSatSim/wiki/Raspberry-Pi-Ground-Station-Setup for the details. diff --git a/groundstation/aprs.sh b/groundstation/aprs.sh new file mode 100755 index 00000000..7d83c968 --- /dev/null +++ b/groundstation/aprs.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# script to auto decode APRS packets on 2m + +# kill openwebrx if it is running +ps -ef | grep rtl | grep -v grep | awk '{print $2}' | sudo xargs kill + +echo -e "Script to auto decode APRS packets on 144.390 MHz\n" + +sudo rtl_fm -f 144.39M -s 22050 -g 48 - | multimon-ng -a AFSK1200 -A -t raw - diff --git a/groundstation/config_webrx.py b/groundstation/config_webrx.py new file mode 100644 index 00000000..1a549578 --- /dev/null +++ b/groundstation/config_webrx.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- + +""" +config_webrx: configuration options for OpenWebRX + + This file is part of OpenWebRX, + an open-source SDR receiver software with a web UI. + Copyright (c) 2013-2015 by Andras Retzler + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + In addition, as a special exception, the copyright holders + state that config_rtl.py and config_webrx.py are not part of the + Corresponding Source defined in GNU AGPL version 3 section 1. + + (It means that you do not have to redistribute config_rtl.py and + config_webrx.py if you make any changes to these two configuration files, + and use them for running your web service with OpenWebRX.) +""" + +# NOTE: you can find additional information about configuring OpenWebRX in the Wiki: +# https://github.com/simonyiszk/openwebrx/wiki + +# ==== Server settings ==== +web_port=8073 +server_hostname="localhost" # If this contains an incorrect value, the web UI may freeze on load (it can't open websocket) +max_clients=20 + +# ==== Web GUI configuration ==== +receiver_name="AMSAT CubeSat Simulator Ground Station" +receiver_location="" +receiver_qra="" +receiver_asl=0 +receiver_ant="monopole" +receiver_device="RTL-SDR" +receiver_admin="ku2y@amsat.org" +receiver_gps=(39.0302,-77.0747) +photo_height=350 +photo_title="Panorama of Budapest from Schönherz Zoltán Dormitory" +photo_desc=""" +You can add your own background photo and receiver information.
+Receiver is operated by: %[RX_ADMIN]
+Device: %[RX_DEVICE]
+Antenna: %[RX_ANT]
+Website: http://localhost +""" + +# ==== sdr.hu listing ==== +# If you want your ham receiver to be listed publicly on sdr.hu, then take the following steps: +# 1. Register at: http://sdr.hu/register +# 2. You will get an unique key by email. Copy it and paste here: +sdrhu_key = "" +# 3. Set this setting to True to enable listing: +sdrhu_public_listing = False + +# ==== DSP/RX settings ==== +fft_fps=9 +fft_size=4096 #Should be power of 2 +fft_voverlap_factor=0.3 #If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the diagram. + +samp_rate = 250000 +# samp_rate = 2400000 +center_freq = 440450000 +rf_gain = 37 #in dB. For an RTL-SDR, rf_gain=0 will set the tuner to auto gain mode, else it will be in manual gain mode. +ppm = 0 + +audio_compression="adpcm" #valid values: "adpcm", "none" +fft_compression="adpcm" #valid values: "adpcm", "none" + +digimodes_enable=False # True #Decoding digimodes come with higher CPU usage. +digimodes_fft_size=1024 + +start_rtl_thread=True + +""" +Note: if you experience audio underruns while CPU usage is 100%, you can: +- decrease `samp_rate`, +- set `fft_voverlap_factor` to 0, +- decrease `fft_fps` and `fft_size`, +- limit the number of users by decreasing `max_clients`. +""" + +# ==== I/Q sources ==== +# (Uncomment the appropriate by removing # characters at the beginning of the corresponding lines.) + +################################################################################################# +# Is my SDR hardware supported? # +# Check here: https://github.com/simonyiszk/openwebrx/wiki#guides-for-receiver-hardware-support # +################################################################################################# + +# You can use other SDR hardware as well, by giving your own command that outputs the I/Q samples... Some examples of configuration are available here (default is RTL-SDR): + +# >> RTL-SDR via rtl_sdr +start_rtl_command="rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +format_conversion="csdr convert_u8_f" + +#lna_gain=8 +#rf_amp=1 +#start_rtl_command="hackrf_transfer -s {samp_rate} -f {center_freq} -g {rf_gain} -l{lna_gain} -a{rf_amp} -r-".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm, rf_amp=rf_amp, lna_gain=lna_gain) +#format_conversion="csdr convert_s8_f" +""" +To use a HackRF, compile the HackRF host tools from its "stdout" branch: + git clone https://github.com/mossmann/hackrf/ + cd hackrf + git fetch + git checkout origin/stdout + cd host + mkdir build + cd build + cmake .. -DINSTALL_UDEV_RULES=ON + make + sudo make install +""" + +# >> Sound card SDR (needs ALSA) +# I did not have the chance to properly test it. +#samp_rate = 96000 +#start_rtl_command="arecord -f S16_LE -r {samp_rate} -c2 -".format(samp_rate=samp_rate) +#format_conversion="csdr convert_s16_f | csdr gain_ff 30" + +# >> /dev/urandom test signal source +# samp_rate = 2400000 +# start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) +# format_conversion="csdr convert_u8_f" + +# >> Pre-recorded raw I/Q file as signal source +# You will have to correctly specify: samp_rate, center_freq, format_conversion in order to correctly play an I/Q file. +#start_rtl_command="(while true; do cat my_iq_file.raw; done) | csdr flowcontrol {sr} 20 ".format(sr=samp_rate*2*1.05) +#format_conversion="csdr convert_u8_f" + +#>> The rx_sdr command works with a variety of SDR harware: RTL-SDR, HackRF, SDRplay, UHD, Airspy, Red Pitaya, audio devices, etc. +# It will auto-detect your SDR hardware if the following tools are installed: +# * the vendor provided driver and library, +# * the vendor-specific SoapySDR wrapper library, +# * and SoapySDR itself. +# Check out this article on the OpenWebRX Wiki: https://github.com/simonyiszk/openwebrx/wiki/Using-rx_tools-with-OpenWebRX/ +#start_rtl_command="rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +#format_conversion="" + +# >> gr-osmosdr signal source using GNU Radio (follow this guide: https://github.com/simonyiszk/openwebrx/wiki/Using-GrOsmoSDR-as-signal-source) +#start_rtl_command="cat /tmp/osmocom_fifo" +#format_conversion="" + +# ==== Misc settings ==== + +shown_center_freq = center_freq #you can change this if you use an upconverter + +client_audio_buffer_size = 5 +#increasing client_audio_buffer_size will: +# - also increase the latency +# - decrease the chance of audio underruns + +start_freq = center_freq +start_mod = "nfm" #nfm, am, lsb, usb, cw + +iq_server_port = 4951 #TCP port for ncat to listen on. It will send I/Q data over its connections, for internal use in OpenWebRX. It is only accessible from the localhost by default. + +#access_log = "~/openwebrx_access.log" + +# ==== Color themes ==== + +#A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels + +### default theme by teejez: +waterfall_colors = "[0x000000ff,0x0000ffff,0x00ffffff,0x00ff00ff,0xffff00ff,0xff0000ff,0xff00ffff,0xffffffff]" +waterfall_min_level = -88 #in dB +waterfall_max_level = -20 +waterfall_auto_level_margin = (5, 40) +### old theme by HA7ILM: +#waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" +#waterfall_min_level = -115 #in dB +#waterfall_max_level = 0 +#waterfall_auto_level_margin = (20, 30) +##For the old colors, you might also want to set [fft_voverlap_factor] to 0. + +#Note: When the auto waterfall level button is clicked, the following happens: +# [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin[0]] +# [waterfall_max_level] = [current_max_power_level] + [waterfall_auto_level_margin[1]] +# +# ___|____________________________________|____________________________________|____________________________________|___> signal power +# \_waterfall_auto_level_margin[0]_/ |__ current_min_power_level | \_waterfall_auto_level_margin[1]_/ +# current_max_power_level __| + +# 3D view settings +mathbox_waterfall_frequency_resolution = 128 #bins +mathbox_waterfall_history_length = 10 #seconds +mathbox_waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" + +# === Experimental settings === +#Warning! The settings below are very experimental. +csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr. +csdr_print_bufsizes = False # This prints the buffer sizes used for csdr processes. +csdr_through = False # Setting this True will print out how much data is going into the DSP chains. + +nmux_memory = 50 #in megabytes. This sets the approximate size of the circular buffer used by nmux. + +#Look up external IP address automatically from icanhazip.com, and use it as [server_hostname] +""" +print "[openwebrx-config] Detecting external IP address..." +import urllib2 +server_hostname=urllib2.urlopen("http://icanhazip.com").read()[:-1] +print "[openwebrx-config] External IP address detected:", server_hostname +""" diff --git a/groundstation/config_webrx_107.py b/groundstation/config_webrx_107.py new file mode 100644 index 00000000..568e3a9b --- /dev/null +++ b/groundstation/config_webrx_107.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- + +""" +config_webrx: configuration options for OpenWebRX + + This file is part of OpenWebRX, + an open-source SDR receiver software with a web UI. + Copyright (c) 2013-2015 by Andras Retzler + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + In addition, as a special exception, the copyright holders + state that config_rtl.py and config_webrx.py are not part of the + Corresponding Source defined in GNU AGPL version 3 section 1. + + (It means that you do not have to redistribute config_rtl.py and + config_webrx.py if you make any changes to these two configuration files, + and use them for running your web service with OpenWebRX.) +""" + +# NOTE: you can find additional information about configuring OpenWebRX in the Wiki: +# https://github.com/simonyiszk/openwebrx/wiki + +# ==== Server settings ==== +web_port=8073 +server_hostname="localhost" # If this contains an incorrect value, the web UI may freeze on load (it can't open websocket) +max_clients=20 + +# ==== Web GUI configuration ==== +receiver_name="ARISS Ground Station" +receiver_location="" +receiver_qra="" +receiver_asl=0 +receiver_ant="monopole" +receiver_device="RTL-SDR" +receiver_admin="ku2y@amsat.org" +receiver_gps=(39.0302,-77.0747) +photo_height=350 +photo_title="ARISS - Amateur Radio on the International Space Station" +photo_desc=""" +You can add your own background photo and receiver information.
+Receiver is operated by: %[RX_ADMIN]
+Device: %[RX_DEVICE]
+Antenna: %[RX_ANT]
+Website: http://localhost +""" + +# ==== sdr.hu listing ==== +# If you want your ham receiver to be listed publicly on sdr.hu, then take the following steps: +# 1. Register at: http://sdr.hu/register +# 2. You will get an unique key by email. Copy it and paste here: +sdrhu_key = "" +# 3. Set this setting to True to enable listing: +sdrhu_public_listing = False + +# ==== DSP/RX settings ==== +fft_fps=9 +fft_size=4096 #Should be power of 2 +fft_voverlap_factor=0.3 #If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the diagram. + +#samp_rate = 250000 +samp_rate = 2400000 +center_freq = 107000000 +rf_gain = 37 #in dB. For an RTL-SDR, rf_gain=0 will set the tuner to auto gain mode, else it will be in manual gain mode. +ppm = 0 + +audio_compression="adpcm" #valid values: "adpcm", "none" +fft_compression="adpcm" #valid values: "adpcm", "none" + +digimodes_enable=False # True #Decoding digimodes come with higher CPU usage. +digimodes_fft_size=1024 + +start_rtl_thread=True + +""" +Note: if you experience audio underruns while CPU usage is 100%, you can: +- decrease `samp_rate`, +- set `fft_voverlap_factor` to 0, +- decrease `fft_fps` and `fft_size`, +- limit the number of users by decreasing `max_clients`. +""" + +# ==== I/Q sources ==== +# (Uncomment the appropriate by removing # characters at the beginning of the corresponding lines.) + +################################################################################################# +# Is my SDR hardware supported? # +# Check here: https://github.com/simonyiszk/openwebrx/wiki#guides-for-receiver-hardware-support # +################################################################################################# + +# You can use other SDR hardware as well, by giving your own command that outputs the I/Q samples... Some examples of configuration are available here (default is RTL-SDR): + +# >> RTL-SDR via rtl_sdr +start_rtl_command="rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +format_conversion="csdr convert_u8_f" + +#lna_gain=8 +#rf_amp=1 +#start_rtl_command="hackrf_transfer -s {samp_rate} -f {center_freq} -g {rf_gain} -l{lna_gain} -a{rf_amp} -r-".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm, rf_amp=rf_amp, lna_gain=lna_gain) +#format_conversion="csdr convert_s8_f" +""" +To use a HackRF, compile the HackRF host tools from its "stdout" branch: + git clone https://github.com/mossmann/hackrf/ + cd hackrf + git fetch + git checkout origin/stdout + cd host + mkdir build + cd build + cmake .. -DINSTALL_UDEV_RULES=ON + make + sudo make install +""" + +# >> Sound card SDR (needs ALSA) +# I did not have the chance to properly test it. +#samp_rate = 96000 +#start_rtl_command="arecord -f S16_LE -r {samp_rate} -c2 -".format(samp_rate=samp_rate) +#format_conversion="csdr convert_s16_f | csdr gain_ff 30" + +# >> /dev/urandom test signal source +# samp_rate = 2400000 +# start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) +# format_conversion="csdr convert_u8_f" + +# >> Pre-recorded raw I/Q file as signal source +# You will have to correctly specify: samp_rate, center_freq, format_conversion in order to correctly play an I/Q file. +#start_rtl_command="(while true; do cat my_iq_file.raw; done) | csdr flowcontrol {sr} 20 ".format(sr=samp_rate*2*1.05) +#format_conversion="csdr convert_u8_f" + +#>> The rx_sdr command works with a variety of SDR harware: RTL-SDR, HackRF, SDRplay, UHD, Airspy, Red Pitaya, audio devices, etc. +# It will auto-detect your SDR hardware if the following tools are installed: +# * the vendor provided driver and library, +# * the vendor-specific SoapySDR wrapper library, +# * and SoapySDR itself. +# Check out this article on the OpenWebRX Wiki: https://github.com/simonyiszk/openwebrx/wiki/Using-rx_tools-with-OpenWebRX/ +#start_rtl_command="rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +#format_conversion="" + +# >> gr-osmosdr signal source using GNU Radio (follow this guide: https://github.com/simonyiszk/openwebrx/wiki/Using-GrOsmoSDR-as-signal-source) +#start_rtl_command="cat /tmp/osmocom_fifo" +#format_conversion="" + +# ==== Misc settings ==== + +shown_center_freq = center_freq #you can change this if you use an upconverter + +client_audio_buffer_size = 5 +#increasing client_audio_buffer_size will: +# - also increase the latency +# - decrease the chance of audio underruns + +start_freq = center_freq +start_mod = "nfm" #nfm, am, lsb, usb, cw + +iq_server_port = 4951 #TCP port for ncat to listen on. It will send I/Q data over its connections, for internal use in OpenWebRX. It is only accessible from the localhost by default. + +#access_log = "~/openwebrx_access.log" + +# ==== Color themes ==== + +#A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels + +### default theme by teejez: +waterfall_colors = "[0x000000ff,0x0000ffff,0x00ffffff,0x00ff00ff,0xffff00ff,0xff0000ff,0xff00ffff,0xffffffff]" +waterfall_min_level = -88 #in dB +waterfall_max_level = -20 +waterfall_auto_level_margin = (5, 40) +### old theme by HA7ILM: +#waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" +#waterfall_min_level = -115 #in dB +#waterfall_max_level = 0 +#waterfall_auto_level_margin = (20, 30) +##For the old colors, you might also want to set [fft_voverlap_factor] to 0. + +#Note: When the auto waterfall level button is clicked, the following happens: +# [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin[0]] +# [waterfall_max_level] = [current_max_power_level] + [waterfall_auto_level_margin[1]] +# +# ___|____________________________________|____________________________________|____________________________________|___> signal power +# \_waterfall_auto_level_margin[0]_/ |__ current_min_power_level | \_waterfall_auto_level_margin[1]_/ +# current_max_power_level __| + +# 3D view settings +mathbox_waterfall_frequency_resolution = 128 #bins +mathbox_waterfall_history_length = 10 #seconds +mathbox_waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" + +# === Experimental settings === +#Warning! The settings below are very experimental. +csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr. +csdr_print_bufsizes = False # This prints the buffer sizes used for csdr processes. +csdr_through = False # Setting this True will print out how much data is going into the DSP chains. + +nmux_memory = 50 #in megabytes. This sets the approximate size of the circular buffer used by nmux. + +#Look up external IP address automatically from icanhazip.com, and use it as [server_hostname] +""" +print "[openwebrx-config] Detecting external IP address..." +import urllib2 +server_hostname=urllib2.urlopen("http://icanhazip.com").read()[:-1] +print "[openwebrx-config] External IP address detected:", server_hostname +""" diff --git a/groundstation/config_webrx_145.py b/groundstation/config_webrx_145.py new file mode 100644 index 00000000..549f93f7 --- /dev/null +++ b/groundstation/config_webrx_145.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- + +""" +config_webrx: configuration options for OpenWebRX + + This file is part of OpenWebRX, + an open-source SDR receiver software with a web UI. + Copyright (c) 2013-2015 by Andras Retzler + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + In addition, as a special exception, the copyright holders + state that config_rtl.py and config_webrx.py are not part of the + Corresponding Source defined in GNU AGPL version 3 section 1. + + (It means that you do not have to redistribute config_rtl.py and + config_webrx.py if you make any changes to these two configuration files, + and use them for running your web service with OpenWebRX.) +""" + +# NOTE: you can find additional information about configuring OpenWebRX in the Wiki: +# https://github.com/simonyiszk/openwebrx/wiki + +# ==== Server settings ==== +web_port=8073 +server_hostname="localhost" # If this contains an incorrect value, the web UI may freeze on load (it can't open websocket) +max_clients=20 + +# ==== Web GUI configuration ==== +receiver_name="ARISS Ground Station" +receiver_location="" +receiver_qra="" +receiver_asl=0 +receiver_ant="monopole" +receiver_device="RTL-SDR" +receiver_admin="ku2y@amsat.org" +receiver_gps=(39.0302,-77.0747) +photo_height=350 +photo_title="ARISS - Amateur Radio on the International Space Station" +photo_desc=""" +You can add your own background photo and receiver information.
+Receiver is operated by: %[RX_ADMIN]
+Device: %[RX_DEVICE]
+Antenna: %[RX_ANT]
+Website: http://localhost +""" + +# ==== sdr.hu listing ==== +# If you want your ham receiver to be listed publicly on sdr.hu, then take the following steps: +# 1. Register at: http://sdr.hu/register +# 2. You will get an unique key by email. Copy it and paste here: +sdrhu_key = "" +# 3. Set this setting to True to enable listing: +sdrhu_public_listing = False + +# ==== DSP/RX settings ==== +fft_fps=9 +fft_size=4096 #Should be power of 2 +fft_voverlap_factor=0.3 #If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the diagram. + +#samp_rate = 250000 +samp_rate = 2400000 +center_freq = 145800000 +rf_gain = 37 #in dB. For an RTL-SDR, rf_gain=0 will set the tuner to auto gain mode, else it will be in manual gain mode. +ppm = 0 + +audio_compression="adpcm" #valid values: "adpcm", "none" +fft_compression="adpcm" #valid values: "adpcm", "none" + +digimodes_enable=False # True #Decoding digimodes come with higher CPU usage. +digimodes_fft_size=1024 + +start_rtl_thread=True + +""" +Note: if you experience audio underruns while CPU usage is 100%, you can: +- decrease `samp_rate`, +- set `fft_voverlap_factor` to 0, +- decrease `fft_fps` and `fft_size`, +- limit the number of users by decreasing `max_clients`. +""" + +# ==== I/Q sources ==== +# (Uncomment the appropriate by removing # characters at the beginning of the corresponding lines.) + +################################################################################################# +# Is my SDR hardware supported? # +# Check here: https://github.com/simonyiszk/openwebrx/wiki#guides-for-receiver-hardware-support # +################################################################################################# + +# You can use other SDR hardware as well, by giving your own command that outputs the I/Q samples... Some examples of configuration are available here (default is RTL-SDR): + +# >> RTL-SDR via rtl_sdr +start_rtl_command="rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +format_conversion="csdr convert_u8_f" + +#lna_gain=8 +#rf_amp=1 +#start_rtl_command="hackrf_transfer -s {samp_rate} -f {center_freq} -g {rf_gain} -l{lna_gain} -a{rf_amp} -r-".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm, rf_amp=rf_amp, lna_gain=lna_gain) +#format_conversion="csdr convert_s8_f" +""" +To use a HackRF, compile the HackRF host tools from its "stdout" branch: + git clone https://github.com/mossmann/hackrf/ + cd hackrf + git fetch + git checkout origin/stdout + cd host + mkdir build + cd build + cmake .. -DINSTALL_UDEV_RULES=ON + make + sudo make install +""" + +# >> Sound card SDR (needs ALSA) +# I did not have the chance to properly test it. +#samp_rate = 96000 +#start_rtl_command="arecord -f S16_LE -r {samp_rate} -c2 -".format(samp_rate=samp_rate) +#format_conversion="csdr convert_s16_f | csdr gain_ff 30" + +# >> /dev/urandom test signal source +# samp_rate = 2400000 +# start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) +# format_conversion="csdr convert_u8_f" + +# >> Pre-recorded raw I/Q file as signal source +# You will have to correctly specify: samp_rate, center_freq, format_conversion in order to correctly play an I/Q file. +#start_rtl_command="(while true; do cat my_iq_file.raw; done) | csdr flowcontrol {sr} 20 ".format(sr=samp_rate*2*1.05) +#format_conversion="csdr convert_u8_f" + +#>> The rx_sdr command works with a variety of SDR harware: RTL-SDR, HackRF, SDRplay, UHD, Airspy, Red Pitaya, audio devices, etc. +# It will auto-detect your SDR hardware if the following tools are installed: +# * the vendor provided driver and library, +# * the vendor-specific SoapySDR wrapper library, +# * and SoapySDR itself. +# Check out this article on the OpenWebRX Wiki: https://github.com/simonyiszk/openwebrx/wiki/Using-rx_tools-with-OpenWebRX/ +#start_rtl_command="rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +#format_conversion="" + +# >> gr-osmosdr signal source using GNU Radio (follow this guide: https://github.com/simonyiszk/openwebrx/wiki/Using-GrOsmoSDR-as-signal-source) +#start_rtl_command="cat /tmp/osmocom_fifo" +#format_conversion="" + +# ==== Misc settings ==== + +shown_center_freq = center_freq #you can change this if you use an upconverter + +client_audio_buffer_size = 5 +#increasing client_audio_buffer_size will: +# - also increase the latency +# - decrease the chance of audio underruns + +start_freq = center_freq +start_mod = "nfm" #nfm, am, lsb, usb, cw + +iq_server_port = 4951 #TCP port for ncat to listen on. It will send I/Q data over its connections, for internal use in OpenWebRX. It is only accessible from the localhost by default. + +#access_log = "~/openwebrx_access.log" + +# ==== Color themes ==== + +#A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels + +### default theme by teejez: +waterfall_colors = "[0x000000ff,0x0000ffff,0x00ffffff,0x00ff00ff,0xffff00ff,0xff0000ff,0xff00ffff,0xffffffff]" +waterfall_min_level = -88 #in dB +waterfall_max_level = -20 +waterfall_auto_level_margin = (5, 40) +### old theme by HA7ILM: +#waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" +#waterfall_min_level = -115 #in dB +#waterfall_max_level = 0 +#waterfall_auto_level_margin = (20, 30) +##For the old colors, you might also want to set [fft_voverlap_factor] to 0. + +#Note: When the auto waterfall level button is clicked, the following happens: +# [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin[0]] +# [waterfall_max_level] = [current_max_power_level] + [waterfall_auto_level_margin[1]] +# +# ___|____________________________________|____________________________________|____________________________________|___> signal power +# \_waterfall_auto_level_margin[0]_/ |__ current_min_power_level | \_waterfall_auto_level_margin[1]_/ +# current_max_power_level __| + +# 3D view settings +mathbox_waterfall_frequency_resolution = 128 #bins +mathbox_waterfall_history_length = 10 #seconds +mathbox_waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" + +# === Experimental settings === +#Warning! The settings below are very experimental. +csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr. +csdr_print_bufsizes = False # This prints the buffer sizes used for csdr processes. +csdr_through = False # Setting this True will print out how much data is going into the DSP chains. + +nmux_memory = 50 #in megabytes. This sets the approximate size of the circular buffer used by nmux. + +#Look up external IP address automatically from icanhazip.com, and use it as [server_hostname] +""" +print "[openwebrx-config] Detecting external IP address..." +import urllib2 +server_hostname=urllib2.urlopen("http://icanhazip.com").read()[:-1] +print "[openwebrx-config] External IP address detected:", server_hostname +""" diff --git a/groundstation/config_webrx_440.py b/groundstation/config_webrx_440.py new file mode 100644 index 00000000..d0725a9b --- /dev/null +++ b/groundstation/config_webrx_440.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- + +""" +config_webrx: configuration options for OpenWebRX + + This file is part of OpenWebRX, + an open-source SDR receiver software with a web UI. + Copyright (c) 2013-2015 by Andras Retzler + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + In addition, as a special exception, the copyright holders + state that config_rtl.py and config_webrx.py are not part of the + Corresponding Source defined in GNU AGPL version 3 section 1. + + (It means that you do not have to redistribute config_rtl.py and + config_webrx.py if you make any changes to these two configuration files, + and use them for running your web service with OpenWebRX.) +""" + +# NOTE: you can find additional information about configuring OpenWebRX in the Wiki: +# https://github.com/simonyiszk/openwebrx/wiki + +# ==== Server settings ==== +web_port=8073 +server_hostname="localhost" # If this contains an incorrect value, the web UI may freeze on load (it can't open websocket) +max_clients=20 + +# ==== Web GUI configuration ==== +receiver_name="ARISS Ground Station" +receiver_location="" +receiver_qra="" +receiver_asl=0 +receiver_ant="monopole" +receiver_device="RTL-SDR" +receiver_admin="ku2y@amsat.org" +receiver_gps=(39.0302,-77.0747) +photo_height=350 +photo_title="ARISS - Amateur Radio on the International Space Station" +photo_desc=""" +You can add your own background photo and receiver information.
+Receiver is operated by: %[RX_ADMIN]
+Device: %[RX_DEVICE]
+Antenna: %[RX_ANT]
+Website: http://localhost +""" + +# ==== sdr.hu listing ==== +# If you want your ham receiver to be listed publicly on sdr.hu, then take the following steps: +# 1. Register at: http://sdr.hu/register +# 2. You will get an unique key by email. Copy it and paste here: +sdrhu_key = "" +# 3. Set this setting to True to enable listing: +sdrhu_public_listing = False + +# ==== DSP/RX settings ==== +fft_fps=9 +fft_size=4096 #Should be power of 2 +fft_voverlap_factor=0.3 #If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the diagram. + +samp_rate = 250000 +# samp_rate = 2400000 +center_freq = 440450000 +rf_gain = 37 #in dB. For an RTL-SDR, rf_gain=0 will set the tuner to auto gain mode, else it will be in manual gain mode. +ppm = 0 + +audio_compression="adpcm" #valid values: "adpcm", "none" +fft_compression="adpcm" #valid values: "adpcm", "none" + +digimodes_enable=False # True #Decoding digimodes come with higher CPU usage. +digimodes_fft_size=1024 + +start_rtl_thread=True + +""" +Note: if you experience audio underruns while CPU usage is 100%, you can: +- decrease `samp_rate`, +- set `fft_voverlap_factor` to 0, +- decrease `fft_fps` and `fft_size`, +- limit the number of users by decreasing `max_clients`. +""" + +# ==== I/Q sources ==== +# (Uncomment the appropriate by removing # characters at the beginning of the corresponding lines.) + +################################################################################################# +# Is my SDR hardware supported? # +# Check here: https://github.com/simonyiszk/openwebrx/wiki#guides-for-receiver-hardware-support # +################################################################################################# + +# You can use other SDR hardware as well, by giving your own command that outputs the I/Q samples... Some examples of configuration are available here (default is RTL-SDR): + +# >> RTL-SDR via rtl_sdr +start_rtl_command="rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +format_conversion="csdr convert_u8_f" + +#lna_gain=8 +#rf_amp=1 +#start_rtl_command="hackrf_transfer -s {samp_rate} -f {center_freq} -g {rf_gain} -l{lna_gain} -a{rf_amp} -r-".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm, rf_amp=rf_amp, lna_gain=lna_gain) +#format_conversion="csdr convert_s8_f" +""" +To use a HackRF, compile the HackRF host tools from its "stdout" branch: + git clone https://github.com/mossmann/hackrf/ + cd hackrf + git fetch + git checkout origin/stdout + cd host + mkdir build + cd build + cmake .. -DINSTALL_UDEV_RULES=ON + make + sudo make install +""" + +# >> Sound card SDR (needs ALSA) +# I did not have the chance to properly test it. +#samp_rate = 96000 +#start_rtl_command="arecord -f S16_LE -r {samp_rate} -c2 -".format(samp_rate=samp_rate) +#format_conversion="csdr convert_s16_f | csdr gain_ff 30" + +# >> /dev/urandom test signal source +# samp_rate = 2400000 +# start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) +# format_conversion="csdr convert_u8_f" + +# >> Pre-recorded raw I/Q file as signal source +# You will have to correctly specify: samp_rate, center_freq, format_conversion in order to correctly play an I/Q file. +#start_rtl_command="(while true; do cat my_iq_file.raw; done) | csdr flowcontrol {sr} 20 ".format(sr=samp_rate*2*1.05) +#format_conversion="csdr convert_u8_f" + +#>> The rx_sdr command works with a variety of SDR harware: RTL-SDR, HackRF, SDRplay, UHD, Airspy, Red Pitaya, audio devices, etc. +# It will auto-detect your SDR hardware if the following tools are installed: +# * the vendor provided driver and library, +# * the vendor-specific SoapySDR wrapper library, +# * and SoapySDR itself. +# Check out this article on the OpenWebRX Wiki: https://github.com/simonyiszk/openwebrx/wiki/Using-rx_tools-with-OpenWebRX/ +#start_rtl_command="rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +#format_conversion="" + +# >> gr-osmosdr signal source using GNU Radio (follow this guide: https://github.com/simonyiszk/openwebrx/wiki/Using-GrOsmoSDR-as-signal-source) +#start_rtl_command="cat /tmp/osmocom_fifo" +#format_conversion="" + +# ==== Misc settings ==== + +shown_center_freq = center_freq #you can change this if you use an upconverter + +client_audio_buffer_size = 5 +#increasing client_audio_buffer_size will: +# - also increase the latency +# - decrease the chance of audio underruns + +start_freq = center_freq +start_mod = "nfm" #nfm, am, lsb, usb, cw + +iq_server_port = 4951 #TCP port for ncat to listen on. It will send I/Q data over its connections, for internal use in OpenWebRX. It is only accessible from the localhost by default. + +#access_log = "~/openwebrx_access.log" + +# ==== Color themes ==== + +#A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels + +### default theme by teejez: +waterfall_colors = "[0x000000ff,0x0000ffff,0x00ffffff,0x00ff00ff,0xffff00ff,0xff0000ff,0xff00ffff,0xffffffff]" +waterfall_min_level = -88 #in dB +waterfall_max_level = -20 +waterfall_auto_level_margin = (5, 40) +### old theme by HA7ILM: +#waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" +#waterfall_min_level = -115 #in dB +#waterfall_max_level = 0 +#waterfall_auto_level_margin = (20, 30) +##For the old colors, you might also want to set [fft_voverlap_factor] to 0. + +#Note: When the auto waterfall level button is clicked, the following happens: +# [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin[0]] +# [waterfall_max_level] = [current_max_power_level] + [waterfall_auto_level_margin[1]] +# +# ___|____________________________________|____________________________________|____________________________________|___> signal power +# \_waterfall_auto_level_margin[0]_/ |__ current_min_power_level | \_waterfall_auto_level_margin[1]_/ +# current_max_power_level __| + +# 3D view settings +mathbox_waterfall_frequency_resolution = 128 #bins +mathbox_waterfall_history_length = 10 #seconds +mathbox_waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" + +# === Experimental settings === +#Warning! The settings below are very experimental. +csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr. +csdr_print_bufsizes = False # This prints the buffer sizes used for csdr processes. +csdr_through = False # Setting this True will print out how much data is going into the DSP chains. + +nmux_memory = 50 #in megabytes. This sets the approximate size of the circular buffer used by nmux. + +#Look up external IP address automatically from icanhazip.com, and use it as [server_hostname] +""" +print "[openwebrx-config] Detecting external IP address..." +import urllib2 +server_hostname=urllib2.urlopen("http://icanhazip.com").read()[:-1] +print "[openwebrx-config] External IP address detected:", server_hostname +""" diff --git a/groundstation/config_webrx_fm.py b/groundstation/config_webrx_fm.py new file mode 100644 index 00000000..fbe61561 --- /dev/null +++ b/groundstation/config_webrx_fm.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- + +""" +config_webrx: configuration options for OpenWebRX + + This file is part of OpenWebRX, + an open-source SDR receiver software with a web UI. + Copyright (c) 2013-2015 by Andras Retzler + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + In addition, as a special exception, the copyright holders + state that config_rtl.py and config_webrx.py are not part of the + Corresponding Source defined in GNU AGPL version 3 section 1. + + (It means that you do not have to redistribute config_rtl.py and + config_webrx.py if you make any changes to these two configuration files, + and use them for running your web service with OpenWebRX.) +""" + +# NOTE: you can find additional information about configuring OpenWebRX in the Wiki: +# https://github.com/simonyiszk/openwebrx/wiki + +# ==== Server settings ==== +web_port=8073 +server_hostname="localhost" # If this contains an incorrect value, the web UI may freeze on load (it can't open websocket) +max_clients=20 + +# ==== Web GUI configuration ==== +receiver_name="AMSATCubeSat Simulator Ground Station" +receiver_location="" +receiver_qra="" +receiver_asl=0 +receiver_ant="monopole" +receiver_device="RTL-SDR" +receiver_admin="ku2y@amsat.org" +receiver_gps=(39.0302,-77.0747) +photo_height=350 +photo_title="ARISS - Amateur Radio on the International Space Station" +photo_desc=""" +You can add your own background photo and receiver information.
+Receiver is operated by: %[RX_ADMIN]
+Device: %[RX_DEVICE]
+Antenna: %[RX_ANT]
+Website: http://localhost +""" + +# ==== sdr.hu listing ==== +# If you want your ham receiver to be listed publicly on sdr.hu, then take the following steps: +# 1. Register at: http://sdr.hu/register +# 2. You will get an unique key by email. Copy it and paste here: +sdrhu_key = "" +# 3. Set this setting to True to enable listing: +sdrhu_public_listing = False + +# ==== DSP/RX settings ==== +fft_fps=9 +fft_size=4096 #Should be power of 2 +fft_voverlap_factor=0.3 #If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the diagram. + +samp_rate = 250000 +# samp_rate = 2400000 +center_freq = 128000000 +rf_gain = 37 #in dB. For an RTL-SDR, rf_gain=0 will set the tuner to auto gain mode, else it will be in manual gain mode. +ppm = 0 + +audio_compression="adpcm" #valid values: "adpcm", "none" +fft_compression="adpcm" #valid values: "adpcm", "none" + +digimodes_enable=False # True #Decoding digimodes come with higher CPU usage. +digimodes_fft_size=1024 + +start_rtl_thread=True + +""" +Note: if you experience audio underruns while CPU usage is 100%, you can: +- decrease `samp_rate`, +- set `fft_voverlap_factor` to 0, +- decrease `fft_fps` and `fft_size`, +- limit the number of users by decreasing `max_clients`. +""" + +# ==== I/Q sources ==== +# (Uncomment the appropriate by removing # characters at the beginning of the corresponding lines.) + +################################################################################################# +# Is my SDR hardware supported? # +# Check here: https://github.com/simonyiszk/openwebrx/wiki#guides-for-receiver-hardware-support # +################################################################################################# + +# You can use other SDR hardware as well, by giving your own command that outputs the I/Q samples... Some examples of configuration are available here (default is RTL-SDR): + +# >> RTL-SDR via rtl_sdr +start_rtl_command="rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +format_conversion="csdr convert_u8_f" + +#lna_gain=8 +#rf_amp=1 +#start_rtl_command="hackrf_transfer -s {samp_rate} -f {center_freq} -g {rf_gain} -l{lna_gain} -a{rf_amp} -r-".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm, rf_amp=rf_amp, lna_gain=lna_gain) +#format_conversion="csdr convert_s8_f" +""" +To use a HackRF, compile the HackRF host tools from its "stdout" branch: + git clone https://github.com/mossmann/hackrf/ + cd hackrf + git fetch + git checkout origin/stdout + cd host + mkdir build + cd build + cmake .. -DINSTALL_UDEV_RULES=ON + make + sudo make install +""" + +# >> Sound card SDR (needs ALSA) +# I did not have the chance to properly test it. +#samp_rate = 96000 +#start_rtl_command="arecord -f S16_LE -r {samp_rate} -c2 -".format(samp_rate=samp_rate) +#format_conversion="csdr convert_s16_f | csdr gain_ff 30" + +# >> /dev/urandom test signal source +# samp_rate = 2400000 +# start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) +# format_conversion="csdr convert_u8_f" + +# >> Pre-recorded raw I/Q file as signal source +# You will have to correctly specify: samp_rate, center_freq, format_conversion in order to correctly play an I/Q file. +#start_rtl_command="(while true; do cat my_iq_file.raw; done) | csdr flowcontrol {sr} 20 ".format(sr=samp_rate*2*1.05) +#format_conversion="csdr convert_u8_f" + +#>> The rx_sdr command works with a variety of SDR harware: RTL-SDR, HackRF, SDRplay, UHD, Airspy, Red Pitaya, audio devices, etc. +# It will auto-detect your SDR hardware if the following tools are installed: +# * the vendor provided driver and library, +# * the vendor-specific SoapySDR wrapper library, +# * and SoapySDR itself. +# Check out this article on the OpenWebRX Wiki: https://github.com/simonyiszk/openwebrx/wiki/Using-rx_tools-with-OpenWebRX/ +#start_rtl_command="rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm) +#format_conversion="" + +# >> gr-osmosdr signal source using GNU Radio (follow this guide: https://github.com/simonyiszk/openwebrx/wiki/Using-GrOsmoSDR-as-signal-source) +#start_rtl_command="cat /tmp/osmocom_fifo" +#format_conversion="" + +# ==== Misc settings ==== + +shown_center_freq = center_freq #you can change this if you use an upconverter + +client_audio_buffer_size = 5 +#increasing client_audio_buffer_size will: +# - also increase the latency +# - decrease the chance of audio underruns + +start_freq = center_freq +start_mod = "nfm" #nfm, am, lsb, usb, cw + +iq_server_port = 4951 #TCP port for ncat to listen on. It will send I/Q data over its connections, for internal use in OpenWebRX. It is only accessible from the localhost by default. + +#access_log = "~/openwebrx_access.log" + +# ==== Color themes ==== + +#A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels + +### default theme by teejez: +waterfall_colors = "[0x000000ff,0x0000ffff,0x00ffffff,0x00ff00ff,0xffff00ff,0xff0000ff,0xff00ffff,0xffffffff]" +waterfall_min_level = -88 #in dB +waterfall_max_level = -20 +waterfall_auto_level_margin = (5, 40) +### old theme by HA7ILM: +#waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" +#waterfall_min_level = -115 #in dB +#waterfall_max_level = 0 +#waterfall_auto_level_margin = (20, 30) +##For the old colors, you might also want to set [fft_voverlap_factor] to 0. + +#Note: When the auto waterfall level button is clicked, the following happens: +# [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin[0]] +# [waterfall_max_level] = [current_max_power_level] + [waterfall_auto_level_margin[1]] +# +# ___|____________________________________|____________________________________|____________________________________|___> signal power +# \_waterfall_auto_level_margin[0]_/ |__ current_min_power_level | \_waterfall_auto_level_margin[1]_/ +# current_max_power_level __| + +# 3D view settings +mathbox_waterfall_frequency_resolution = 128 #bins +mathbox_waterfall_history_length = 10 #seconds +mathbox_waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" + +# === Experimental settings === +#Warning! The settings below are very experimental. +csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr. +csdr_print_bufsizes = False # This prints the buffer sizes used for csdr processes. +csdr_through = False # Setting this True will print out how much data is going into the DSP chains. + +nmux_memory = 50 #in megabytes. This sets the approximate size of the circular buffer used by nmux. + +#Look up external IP address automatically from icanhazip.com, and use it as [server_hostname] +""" +print "[openwebrx-config] Detecting external IP address..." +import urllib2 +server_hostname=urllib2.urlopen("http://icanhazip.com").read()[:-1] +print "[openwebrx-config] External IP address detected:", server_hostname +""" diff --git a/groundstation/cubesatsim-lite-alt.sh b/groundstation/cubesatsim-lite-alt.sh new file mode 100755 index 00000000..9ad01561 --- /dev/null +++ b/groundstation/cubesatsim-lite-alt.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# script to run CubeSat Simulator Lite +# +# on SDR application, listen at 107.9 + +echo -e "\nScript to run CubeSat Simulator Lite \n" + +sudo /home/pi/CubeSatSim/PiFmRds/src/pi_fm_rds -audio /home/pi/CubeSatSim/wav/afsk2.wav -freq 107.5 diff --git a/groundstation/cubesatsim-lite.sh b/groundstation/cubesatsim-lite.sh new file mode 100755 index 00000000..5a048954 --- /dev/null +++ b/groundstation/cubesatsim-lite.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# script to run CubeSat Simulator Lite +# +# on SDR application, listen at 107.9 + +echo -e "\nScript to run CubeSat Simulator Lite \n" + +sudo /home/pi/CubeSatSim/PiFmRds/src/pi_fm_rds -audio /home/pi/CubeSatSim/wav/afsk2.wav -freq 107.9 diff --git a/groundstation/decode-lite.sh b/groundstation/decode-lite.sh new file mode 100755 index 00000000..4db99571 --- /dev/null +++ b/groundstation/decode-lite.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# script to auto decode CubeSat Simulator telemetry + +# kill openwebrx if it is running +ps -ef | grep rtl | grep -v grep | awk '{print $2}' | sudo xargs kill + +echo -e "Script to auto decode CubeSat Simulator telemetry\n" + +sudo rtl_fm -f 107.906M -M wbfm -s 70000 -g 48 - | multimon-ng -a AFSK1200 -A -t raw - + diff --git a/groundstation/decode.sh b/groundstation/decode.sh new file mode 100755 index 00000000..44db5a06 --- /dev/null +++ b/groundstation/decode.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# script to auto decode CubeSat Simulator telemetry + +# kill openwebrx if it is running +ps -ef | grep rtl | grep -v grep | awk '{print $2}' | sudo xargs kill + +echo -e "Script to auto decode CubeSat Simulator telemetry\n" + +sudo rtl_fm -f 440.386M -s 22050 -g 48 - | multimon-ng -a AFSK1200 -A -t raw - + diff --git a/groundstation/default.conf b/groundstation/default.conf new file mode 100644 index 00000000..7f3e052c --- /dev/null +++ b/groundstation/default.conf @@ -0,0 +1,33 @@ +[General] +configversion=2 +crashed=false + +[audio] +gain=224 +udp_host=localhost + +[fft] +fft_size=4096 +split=40 + +[gui] +geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\0\0\0\0\0$\0\0\x3\xff\0\0\x2\xff\0\0\0\0\0\0\0\x42\0\0\x2\xe8\0\0\x2\xed\0\0\0\0\x2\0\0\0\x4\0) +state=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x2\0\0\0\x1\0\0\x1&\0\0\x2\x65\xfc\x2\0\0\0\x2\xfc\0\0\0\x41\0\0\x1\x90\0\0\x1\x83\0\b\0 \xfa\0\0\0\x1\x2\0\0\0\x3\xfb\0\0\0\x18\0\x44\0o\0\x63\0k\0I\0n\0p\0u\0t\0\x43\0t\0l\x1\0\0\0\0\xff\xff\xff\xff\0\0\x1.\0\xff\xff\xff\xfb\0\0\0\x12\0\x44\0o\0\x63\0k\0R\0x\0O\0p\0t\x1\0\0\0\0\xff\xff\xff\xff\0\0\x1\x62\0\a\xff\xff\xfb\0\0\0\xe\0\x44\0o\0\x63\0k\0\x46\0\x66\0t\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\xc8\0\a\xff\xff\xfc\0\0\x1\xd7\0\0\0\xcf\0\0\0\xc8\0\xff\xff\xff\xfa\0\0\0\0\x2\0\0\0\x2\xfb\0\0\0\x12\0\x44\0o\0\x63\0k\0\x41\0u\0\x64\0i\0o\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\xc8\0\xff\xff\xff\xfb\0\0\0\xe\0\x44\0o\0\x63\0k\0R\0\x44\0S\0\0\0\0\0\xff\xff\xff\xff\0\0\0h\0\xff\xff\xff\0\0\0\x3\0\0\x2\xd4\0\0\0\xe9\xfc\x1\0\0\0\x1\xfb\0\0\0\x1a\0\x44\0o\0\x63\0k\0\x42\0o\0o\0k\0m\0\x61\0r\0k\0s\x1\0\0\0\0\0\0\x2\xd4\0\0\x1\x42\0\xff\xff\xff\0\0\x2\xd4\0\0\x1v\0\0\0\x1\0\0\0\x2\0\0\0\b\0\0\0\x2\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x1\0\0\0\x16\0m\0\x61\0i\0n\0T\0o\0o\0l\0\x42\0\x61\0r\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0) + +[input] +device="rtl=0" +frequency=145800000 +gains=@Variant(\0\0\0\b\0\0\0\x1\0\0\0\x6\0L\0N\0\x41\0\0\0\x2\0\0\x1\xf0) +sample_rate=512000 + +[receiver] +agc_decay=100 +agc_off=true +demod=3 +filter_high_cut=5000 +filter_low_cut=-5000 +offset=-202000 +sql_level=-42.5 + +[remote_control] +allowed_hosts=::ffff:127.0.0.1 diff --git a/groundstation/gqrx.sh b/groundstation/gqrx.sh new file mode 100755 index 00000000..7e995d2e --- /dev/null +++ b/groundstation/gqrx.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# script to auto decode CubeSat Simulator telemetry + +# kill rtl if running +ps -ef | grep rtl | grep -v grep | awk '{print $2}' | sudo xargs kill + +# kill openwebrx process if running +ps -ef | grep openwebrx | grep -v grep | awk '{print $2}' | sudo xargs kill + +# kill csdr process if running +ps -ef | grep csdr | grep -v grep | awk '{print $2}' | sudo xargs kill + +echo -e "Script to run Gqrx\n" + +/home/pi/gqrx-sdr-2.11.5-linux-rpi3/gqrx + diff --git a/groundstation/ipaddress.sh b/groundstation/ipaddress.sh new file mode 100755 index 00000000..2b8d15e9 --- /dev/null +++ b/groundstation/ipaddress.sh @@ -0,0 +1,3 @@ +echo -e "IP Address of this Pi is: " + +hostname -I|cut -f1 -d ' ' diff --git a/groundstation/kill_all.sh b/groundstation/kill_all.sh new file mode 100755 index 00000000..2d9970ec --- /dev/null +++ b/groundstation/kill_all.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# script to kill all SDR or RTL processes +# + +echo -e "\nKilling all SDR or RTL processes \n" + +# kill rtl if running +ps -ef | grep rtl_ | grep -v grep | awk '{print $2}' | sudo xargs kill > /dev/null 2>&1 + +# kill openwebrx process if running +ps -ef | grep openwebrx | grep -v grep | awk '{print $2}' | sudo xargs kill > /dev/null 2>&1 + +# kill csdr process if running +ps -ef | grep csdr | grep -v grep | awk '{print $2}' | sudo xargs kill > /dev/null 2>&1 + +# kill gqrx process if running +ps -ef | grep gqrx-sdr-2.11.5-linux-rpi3/gqrx | grep -v grep | awk '{print $2}' | sudo xargs kill > /dev/null 2>&1 + + diff --git a/groundstation/rtl-tcp-alt.sh b/groundstation/rtl-tcp-alt.sh new file mode 100755 index 00000000..53cb0d6a --- /dev/null +++ b/groundstation/rtl-tcp-alt.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# script to run RTL-TCP Server +# +# On SDR client, use 10.3.141.1:1234 to connect + +echo -e "\nScript to run RTL-TCP Server for ARISS Ground Station\n" + +echo -e "IP Address to use in web browsers is: " + +hostname -I|cut -f1 -d ' ' + +./kill_all.sh + +sudo /bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f2 -d " ")' diff --git a/groundstation/rtl-tcp.sh b/groundstation/rtl-tcp.sh new file mode 100755 index 00000000..9559643c --- /dev/null +++ b/groundstation/rtl-tcp.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# script to run RTL-TCP Server +# +# On SDR client, use 10.3.141.1:1234 to connect + +echo -e "\nScript to run RTL-TCP Server for ARISS Ground Station\n" + +echo -e "IP Address to use in web browsers is: " + +hostname -I|cut -f1 -d ' ' + +./kill_all.sh + +sudo /bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ")' diff --git a/groundstation/satnogs_readme.txt b/groundstation/satnogs_readme.txt new file mode 100644 index 00000000..21f0ef05 --- /dev/null +++ b/groundstation/satnogs_readme.txt @@ -0,0 +1,19 @@ +This image has the SatNOGS client pre installed. It allows you to join the Satellite Network Operators Group network: + +https://network.satnogs.org + +To join, all you have to do is follow the instructions starting at SatNOGS Client Setup + +https://wiki.satnogs.org/SatNOGS_Client_Ansible#SatNOGS_Client_Setup + +You will need to Sign Up and create an account: + +https://network.satnogs.org/login/auth0 + +Maybe include "ARISS" in your SatNOGS station name? For example: Joe's ARISS GS + +Once you have an account and have logged in, click on the upper right corner and select Dashboard. Click on the API Key button to copy and paste your API Key which you will need to configure using sudo satnogs-setup Basic Configuration SATNOGS_API_TOKEN + +Good luck and feel free to message me ku2y on SatNOGS! + + diff --git a/groundstation/sdr-2m.sh b/groundstation/sdr-2m.sh new file mode 100755 index 00000000..429cb736 --- /dev/null +++ b/groundstation/sdr-2m.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# script to run OpenWebRX SDR + +echo -e "\nScript to run SDR for ARISS Ground Station\n" + +echo -e "IP Address to use in web browsers is: " + +hostname -I|cut -f1 -d ' ' + + +./kill_all.sh + +cd ~/openwebrx + +chromium-browser http://localhost:8073 & + +sudo python openwebrx.py config_webrx_145 diff --git a/groundstation/sdr-70cm.sh b/groundstation/sdr-70cm.sh new file mode 100755 index 00000000..e0895206 --- /dev/null +++ b/groundstation/sdr-70cm.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# script to run OpenWebRX SDR + +echo -e "\nScript to run SDR for ARISS Ground Station\n" + +echo -e "IP Address to use in web browsers is: " + +hostname -I|cut -f1 -d ' ' + + +./kill_all.sh + +./kill_all.sh + +cd ~/openwebrx + +chromium-browser http://localhost:8073 & + +sudo python openwebrx.py config_webrx_440 diff --git a/groundstation/sdr-fm.sh b/groundstation/sdr-fm.sh new file mode 100755 index 00000000..188db296 --- /dev/null +++ b/groundstation/sdr-fm.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# script to run OpenWebRX SDR + +echo -e "\nScript to run SDR for ARISS Ground Station\n" + +echo -e "IP Address to use in web browsers is: " + +hostname -I|cut -f1 -d ' ' + + +./kill_all.sh + +cd ~/openwebrx + +chromium-browser http://localhost:8073 & + +sudo python openwebrx.py config_webrx_107 + diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh new file mode 100755 index 00000000..03efef13 --- /dev/null +++ b/groundstation/sdr.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# script to run OpenWebRX SDR + +echo -e "\nScript to run SDR for CubeSat Simulator\n" + +echo -e "IP Address to use in web browsers is: " + +hostname -I|cut -f1 -d ' ' + +# kill rtl if running +ps -ef | grep rtl | grep -v grep | awk '{print $2}' | sudo xargs kill + +# kill openwebrx process if running +ps -ef | grep openwebrx | grep -v grep | awk '{print $2}' | sudo xargs kill + +cd ~/openwebrx + +sudo python openwebrx.py diff --git a/openwrt/rtl_tcp b/openwrt/rtl_tcp new file mode 100644 index 00000000..d8f9e244 --- /dev/null +++ b/openwrt/rtl_tcp @@ -0,0 +1,12 @@ +config rtl_tcp main + option disabled '0' + option respawn '1' + option device_index '' + option address '192.168.8.1' + option port '' + option frequency '440386000' + option gain '30' + option samplerate '' + option buffers '8' + option num_linked_lists '8' + option ppm_error '' diff --git a/sdr/frequencies.xml b/sdr/frequencies.xml new file mode 100644 index 00000000..ddf1a806 --- /dev/null +++ b/sdr/frequencies.xml @@ -0,0 +1,12 @@ + + + + true + AMSAT CubeSat Simulator/Name> + Misc + 440389653 + NFM + 0 + 13730 + + \ No newline at end of file diff --git a/spreadsheet/CubeSatSim TLM Analysis - Experimental.xlsx b/spreadsheet/CubeSatSim TLM Analysis - Experimental.xlsx new file mode 100644 index 00000000..04047ff1 Binary files /dev/null and b/spreadsheet/CubeSatSim TLM Analysis - Experimental.xlsx differ diff --git a/spreadsheet/CubeSatSim TLM Analysis.xlsx b/spreadsheet/CubeSatSim TLM Analysis.xlsx index e82382bb..d8e6dd82 100644 Binary files a/spreadsheet/CubeSatSim TLM Analysis.xlsx and b/spreadsheet/CubeSatSim TLM Analysis.xlsx differ diff --git a/spreadsheet/readme.txt b/spreadsheet/readme.txt index 8a1ac778..f0b13413 100644 --- a/spreadsheet/readme.txt +++ b/spreadsheet/readme.txt @@ -4,7 +4,7 @@ It has been tested with Office 365 (Windows) and Office Excel for Mac (Version: A version for Google Docs is available for copying and download at: - https://docs.google.com/spreadsheets/d/1JvvqCAMaiAT45BoUndiS_DKVOUskV6dXG9W9Ys_21Gw/edit?usp=sharing + http://cubesatsim.org/telem Instructions: diff --git a/wav/afsk5.wav b/wav/afsk5.wav new file mode 100644 index 00000000..bd735817 Binary files /dev/null and b/wav/afsk5.wav differ diff --git a/wav/afsk6.wav b/wav/afsk6.wav new file mode 100644 index 00000000..50ccb21a Binary files /dev/null and b/wav/afsk6.wav differ