From f8561155dc45865e0bb22a6e32806c95edeab51c Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 15:45:43 -0400 Subject: [PATCH 001/102] creating test.service to try passing command line arguments to service --- systemd/test.service | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 systemd/test.service diff --git a/systemd/test.service b/systemd/test.service new file mode 100644 index 00000000..20510db2 --- /dev/null +++ b/systemd/test.service @@ -0,0 +1,14 @@ +[Unit] +Description=Test service + +[Service +Environment="SCRIPT_ARGS=%I" +ExecStart=/home/pi/CubeSatSim/radioafsk $SCRIPT_ARGS +WorkingDirectory=/home/pi/CubeSatSim +StandardOutput=inherit +StandardError=inherit +Restart=always +User=root + +[Install] +WantedBy=default.target From 97da3c0f9fad973f2bf0d1eaf7ff8b7351a448de Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 15:47:35 -0400 Subject: [PATCH 002/102] Update README.md --- systemd/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/README.md b/systemd/README.md index 248f7683..3d4ea7e2 100644 --- a/systemd/README.md +++ b/systemd/README.md @@ -3,7 +3,7 @@ To make the CubeSat Simulator transmit automatically on boot, follow these steps Log into the Pi and type: -sudo cp ~/CubeSatSim/cubesatsim.service /etc/systemd/system/cubesatsim.service +sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service sudo systemctl enable cubesatsim From 381231f802cf164e4229b4c3b28d17fa0ebfdd8f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 15:52:33 -0400 Subject: [PATCH 003/102] Update test.service --- systemd/test.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/test.service b/systemd/test.service index 20510db2..a805b2fd 100644 --- a/systemd/test.service +++ b/systemd/test.service @@ -1,7 +1,7 @@ [Unit] Description=Test service -[Service +[Service] Environment="SCRIPT_ARGS=%I" ExecStart=/home/pi/CubeSatSim/radioafsk $SCRIPT_ARGS WorkingDirectory=/home/pi/CubeSatSim From e4d40828b47903758e9a882cb846c36c2dee7bbd Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:00:13 -0400 Subject: [PATCH 004/102] Update test.service --- systemd/test.service | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/systemd/test.service b/systemd/test.service index a805b2fd..1c84d161 100644 --- a/systemd/test.service +++ b/systemd/test.service @@ -2,8 +2,9 @@ Description=Test service [Service] -Environment="SCRIPT_ARGS=%I" -ExecStart=/home/pi/CubeSatSim/radioafsk $SCRIPT_ARGS +EnvironmentFile=/home/pi/CubeSatSim/.progconfig +ExecStart = /usr/bin/prog $ARG1 $ARG2 +ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit StandardError=inherit From d714f456211ff719abf2620215b713e89066e7f2 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:02:17 -0400 Subject: [PATCH 005/102] Update test.service --- systemd/test.service | 1 - 1 file changed, 1 deletion(-) diff --git a/systemd/test.service b/systemd/test.service index 1c84d161..51a72ab0 100644 --- a/systemd/test.service +++ b/systemd/test.service @@ -3,7 +3,6 @@ Description=Test service [Service] EnvironmentFile=/home/pi/CubeSatSim/.progconfig -ExecStart = /usr/bin/prog $ARG1 $ARG2 ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit From 1c441ee8eae88fa19666e08b31ac7f8d0f99946f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:09:40 -0400 Subject: [PATCH 006/102] Update test.service --- systemd/test.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/test.service b/systemd/test.service index 51a72ab0..a410c7f7 100644 --- a/systemd/test.service +++ b/systemd/test.service @@ -3,7 +3,7 @@ Description=Test service [Service] EnvironmentFile=/home/pi/CubeSatSim/.progconfig -ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 +ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 $ARG3 > /home/pi/CubeSatSim/log.txt 2>&1 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit StandardError=inherit From b9dd31ab5ecb2426b4d59c50d3518c2a0017a827 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:12:42 -0400 Subject: [PATCH 007/102] Update test.service --- systemd/test.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/test.service b/systemd/test.service index a410c7f7..7e487030 100644 --- a/systemd/test.service +++ b/systemd/test.service @@ -3,7 +3,7 @@ Description=Test service [Service] EnvironmentFile=/home/pi/CubeSatSim/.progconfig -ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 $ARG3 > /home/pi/CubeSatSim/log.txt 2>&1 +ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 > /home/pi/CubeSatSim/log.txt 2>&1 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit StandardError=inherit From 69b0a8ea4d5c6222caf5b4b139ee9de56c5de74c Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:15:34 -0400 Subject: [PATCH 008/102] Update test.service --- systemd/test.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/test.service b/systemd/test.service index 7e487030..a18eb35f 100644 --- a/systemd/test.service +++ b/systemd/test.service @@ -3,7 +3,7 @@ Description=Test service [Service] EnvironmentFile=/home/pi/CubeSatSim/.progconfig -ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 > /home/pi/CubeSatSim/log.txt 2>&1 +ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 $ARG3 >/home/pi/CubeSatSim/log.txt 2>&1 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit StandardError=inherit From c0efa6120d1ef730d7649a9a11889cf5b52229b8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:16:46 -0400 Subject: [PATCH 009/102] Update test.service --- systemd/test.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/test.service b/systemd/test.service index a18eb35f..26a5f951 100644 --- a/systemd/test.service +++ b/systemd/test.service @@ -3,7 +3,7 @@ Description=Test service [Service] EnvironmentFile=/home/pi/CubeSatSim/.progconfig -ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 $ARG3 >/home/pi/CubeSatSim/log.txt 2>&1 +ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 >/home/pi/CubeSatSim/log.txt 2>&1 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit StandardError=inherit From 326ac821712fb0fbb394b8f1238e765fa0adc00e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:17:31 -0400 Subject: [PATCH 010/102] Update test.service --- systemd/test.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/test.service b/systemd/test.service index 26a5f951..4573edf0 100644 --- a/systemd/test.service +++ b/systemd/test.service @@ -3,7 +3,7 @@ Description=Test service [Service] EnvironmentFile=/home/pi/CubeSatSim/.progconfig -ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 >/home/pi/CubeSatSim/log.txt 2>&1 +ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 $ARG3 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit StandardError=inherit From ddcc286d6e6c0451b8de558480593e7bcfea751a Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:24:42 -0400 Subject: [PATCH 011/102] Create demo.service --- systemd/demo.service | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 systemd/demo.service diff --git a/systemd/demo.service b/systemd/demo.service new file mode 100644 index 00000000..2486a4ce --- /dev/null +++ b/systemd/demo.service @@ -0,0 +1,15 @@ + +[Unit] +Description=Test service + +[Service] +EnvironmentFile=/home/pi/CubeSatSim/.progconfig +ExecStart=/home/pi/CubeSatSim/demo.sh $ARG1 +WorkingDirectory=/home/pi/CubeSatSim +StandardOutput=inherit +StandardError=inherit +Restart=always +User=root + +[Install] +WantedBy=default.target From 3e7a568ad901a9c53b94bd2fdfdde35b745c3f3c Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:28:38 -0400 Subject: [PATCH 012/102] modify demo.sh to have an argument to force mode --- demo.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/demo.sh b/demo.sh index 2e9c4027..6d5bf7f3 100755 --- a/demo.sh +++ b/demo.sh @@ -2,6 +2,14 @@ echo -e "\nDemo of CubeSatSim at 434.9 MHz\n" +if [ "$1" = "a" ]; then + echo "Mode is AFSK" +elif [ "$1" = "f" ]; then + echo "Mode is FSK" +elif [ "$1" = "b" ]; then + echo "Mode is BPSK" +fi + #exit y=$(last reboot | grep ^reboot | wc -l) From 05dbd4ade87096dafbe369f77190d276464262dd Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 3 May 2020 16:32:33 -0400 Subject: [PATCH 013/102] Update demo.sh --- demo.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/demo.sh b/demo.sh index 6d5bf7f3..29e9bf42 100755 --- a/demo.sh +++ b/demo.sh @@ -3,11 +3,14 @@ echo -e "\nDemo of CubeSatSim at 434.9 MHz\n" if [ "$1" = "a" ]; then - echo "Mode is AFSK" + echo "Mode is continuous AFSK" + /home/pi/CubeSatSim/radioafsk afsk elif [ "$1" = "f" ]; then - echo "Mode is FSK" + echo "Mode is continuous FSK" + /home/pi/CubeSatSim/radioafsk fsk elif [ "$1" = "b" ]; then - echo "Mode is BPSK" + echo "Mode is continuous BPSK" + /home/pi/CubeSatSim/radioafsk bpsk fi #exit From c989444933e108651ed7b808d04ddf242edd47f4 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 4 May 2020 12:17:22 -0400 Subject: [PATCH 014/102] Update demo.service --- systemd/demo.service | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/systemd/demo.service b/systemd/demo.service index 2486a4ce..00fe4c46 100644 --- a/systemd/demo.service +++ b/systemd/demo.service @@ -1,9 +1,8 @@ - [Unit] -Description=Test service +Description=Test demo service [Service] -EnvironmentFile=/home/pi/CubeSatSim/.progconfig +EnvironmentFile=/home/pi/CubeSatSim/.mode ExecStart=/home/pi/CubeSatSim/demo.sh $ARG1 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit From 5e2a0559f7aaab1de56eb143993801e977c1a37e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 4 May 2020 12:33:16 -0400 Subject: [PATCH 015/102] Update demo.sh --- demo.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/demo.sh b/demo.sh index 29e9bf42..737a6336 100755 --- a/demo.sh +++ b/demo.sh @@ -4,12 +4,24 @@ echo -e "\nDemo of CubeSatSim at 434.9 MHz\n" if [ "$1" = "a" ]; then echo "Mode is continuous AFSK" + sleep 1 + sudo killall -9 sendiq + sudo killall -9 sendiq + sleep 1 /home/pi/CubeSatSim/radioafsk afsk elif [ "$1" = "f" ]; then echo "Mode is continuous FSK" + sleep 1 + sudo killall -9 sendiq + sudo killall -9 sendiq + sleep 1 /home/pi/CubeSatSim/radioafsk fsk elif [ "$1" = "b" ]; then echo "Mode is continuous BPSK" + sleep 1 + sudo killall -9 sendiq + sudo killall -9 sendiq + sleep 1 /home/pi/CubeSatSim/radioafsk bpsk fi From 70f6b1bbd57e2d5995d01941375f48597904f9f4 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 14:53:16 -0400 Subject: [PATCH 016/102] Create rtl-tcp.service --- groundstation/rtl-tcp.service | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 groundstation/rtl-tcp.service diff --git a/groundstation/rtl-tcp.service b/groundstation/rtl-tcp.service new file mode 100644 index 00000000..c7ae7f81 --- /dev/null +++ b/groundstation/rtl-tcp.service @@ -0,0 +1,13 @@ +[Unit] +Description=RTL-TCP + +[Service] +ExecStart=/home/pi/rtl-tcp.sh > /dev/null 2>&1 +WorkingDirectory=/home/pi +StandardOutput=inherit +StandardError=inherit +Restart=always +User=root + +[Install] +WantedBy=default.target From a3e09901996d9aaa6e60390c5cd89dffa8133d1f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 15:03:10 -0400 Subject: [PATCH 017/102] Update rtl-tcp.sh --- groundstation/rtl-tcp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/rtl-tcp.sh b/groundstation/rtl-tcp.sh index 9559643c..c74cb352 100755 --- a/groundstation/rtl-tcp.sh +++ b/groundstation/rtl-tcp.sh @@ -9,6 +9,6 @@ echo -e "IP Address to use in web browsers is: " hostname -I|cut -f1 -d ' ' -./kill_all.sh +/home/pi/kill_all.sh sudo /bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ")' From d77ff8354fb19a21d15c67d8d9a159a154b100da Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 15:05:48 -0400 Subject: [PATCH 018/102] Update rtl-tcp.sh --- groundstation/rtl-tcp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/rtl-tcp.sh b/groundstation/rtl-tcp.sh index c74cb352..ecaebb75 100755 --- a/groundstation/rtl-tcp.sh +++ b/groundstation/rtl-tcp.sh @@ -11,4 +11,4 @@ hostname -I|cut -f1 -d ' ' /home/pi/kill_all.sh -sudo /bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ")' +/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ") From c15ca027be55e0327951f55ae891c9815007906b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 15:10:27 -0400 Subject: [PATCH 019/102] Update rtl-tcp.service --- groundstation/rtl-tcp.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/rtl-tcp.service b/groundstation/rtl-tcp.service index c7ae7f81..13e547fe 100644 --- a/groundstation/rtl-tcp.service +++ b/groundstation/rtl-tcp.service @@ -2,7 +2,7 @@ Description=RTL-TCP [Service] -ExecStart=/home/pi/rtl-tcp.sh > /dev/null 2>&1 +ExecStart=/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ") WorkingDirectory=/home/pi StandardOutput=inherit StandardError=inherit From e31051b08bff39dec60acd2ff3cf34d0b2888f3b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 15:20:53 -0400 Subject: [PATCH 020/102] Update and rename rtl-tcp.service to rtl_tcp.service --- groundstation/{rtl-tcp.service => rtl_tcp.service} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename groundstation/{rtl-tcp.service => rtl_tcp.service} (71%) diff --git a/groundstation/rtl-tcp.service b/groundstation/rtl_tcp.service similarity index 71% rename from groundstation/rtl-tcp.service rename to groundstation/rtl_tcp.service index 13e547fe..b08f651a 100644 --- a/groundstation/rtl-tcp.service +++ b/groundstation/rtl_tcp.service @@ -2,7 +2,7 @@ Description=RTL-TCP [Service] -ExecStart=/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ") +ExecStart=/bin/sh -c ‘/usr/local/bin/rtl_tcp -a $(hostname -I)’ WorkingDirectory=/home/pi StandardOutput=inherit StandardError=inherit From 6f5a03d2abee9878f674a4651e453ef034392269 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 15:25:36 -0400 Subject: [PATCH 021/102] Update rtl_tcp.service --- groundstation/rtl_tcp.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/rtl_tcp.service b/groundstation/rtl_tcp.service index b08f651a..8c33f07c 100644 --- a/groundstation/rtl_tcp.service +++ b/groundstation/rtl_tcp.service @@ -2,7 +2,7 @@ Description=RTL-TCP [Service] -ExecStart=/bin/sh -c ‘/usr/local/bin/rtl_tcp -a $(hostname -I)’ +ExecStart=/bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I)' WorkingDirectory=/home/pi StandardOutput=inherit StandardError=inherit From 20dcbfb20e692abb1f3a42717ec76c4f90628705 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:00:06 -0400 Subject: [PATCH 022/102] Update rtl_tcp.service --- groundstation/rtl_tcp.service | 1 + 1 file changed, 1 insertion(+) diff --git a/groundstation/rtl_tcp.service b/groundstation/rtl_tcp.service index 8c33f07c..b982edd8 100644 --- a/groundstation/rtl_tcp.service +++ b/groundstation/rtl_tcp.service @@ -2,6 +2,7 @@ Description=RTL-TCP [Service] +TimeoutStopSec = 10 ExecStart=/bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I)' WorkingDirectory=/home/pi StandardOutput=inherit From 641067797a6a000447279083781b751b984b2583 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:02:52 -0400 Subject: [PATCH 023/102] Update rtl_tcp.service --- groundstation/rtl_tcp.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/rtl_tcp.service b/groundstation/rtl_tcp.service index b982edd8..403425a3 100644 --- a/groundstation/rtl_tcp.service +++ b/groundstation/rtl_tcp.service @@ -2,7 +2,7 @@ Description=RTL-TCP [Service] -TimeoutStopSec = 10 +TimeoutStopSec = 5 ExecStart=/bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I)' WorkingDirectory=/home/pi StandardOutput=inherit From 041aa6f6a3b77b0cc05122d6db2205724f7c1a80 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:06:55 -0400 Subject: [PATCH 024/102] Update sdr-2m.sh --- groundstation/sdr-2m.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/groundstation/sdr-2m.sh b/groundstation/sdr-2m.sh index 429cb736..d3f96bb3 100755 --- a/groundstation/sdr-2m.sh +++ b/groundstation/sdr-2m.sh @@ -8,7 +8,9 @@ echo -e "IP Address to use in web browsers is: " hostname -I|cut -f1 -d ' ' -./kill_all.sh +#./kill_all.sh + +sudo systemctl stop rtl_sdr cd ~/openwebrx From b187bcfa49f767b5c7db38eab9eef6fdf35d22ec Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:10:04 -0400 Subject: [PATCH 025/102] Update sdr-2m.sh --- groundstation/sdr-2m.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/sdr-2m.sh b/groundstation/sdr-2m.sh index d3f96bb3..a2142704 100755 --- a/groundstation/sdr-2m.sh +++ b/groundstation/sdr-2m.sh @@ -10,7 +10,7 @@ hostname -I|cut -f1 -d ' ' #./kill_all.sh -sudo systemctl stop rtl_sdr +sudo systemctl stop rtl_tcp cd ~/openwebrx From 538c246a1043b11a6750effb5b22d758ccf693ef Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:11:41 -0400 Subject: [PATCH 026/102] Update rtl-tcp.sh --- groundstation/rtl-tcp.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/groundstation/rtl-tcp.sh b/groundstation/rtl-tcp.sh index ecaebb75..fab3b16b 100755 --- a/groundstation/rtl-tcp.sh +++ b/groundstation/rtl-tcp.sh @@ -7,8 +7,9 @@ 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 ' ' +#hostname -I|cut -f1 -d ' ' /home/pi/kill_all.sh -/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ") +#/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ") +sudo systemctl start rtl_tcp From 288fc8e94089a360962c5b5a62d3760bb65b6484 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:52:14 -0400 Subject: [PATCH 027/102] Update sdr.sh --- groundstation/sdr.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh index 03efef13..d3fe9a55 100755 --- a/groundstation/sdr.sh +++ b/groundstation/sdr.sh @@ -1,18 +1,19 @@ #!/bin/bash # script to run OpenWebRX SDR -echo -e "\nScript to run SDR for CubeSat Simulator\n" +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 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_all.sh -cd ~/openwebrx +#cd ~/openwebrx -sudo python openwebrx.py +sudo systemctl start openwebrx + +chromium-browser http://localhost:8073 & + +#sudo python openwebrx.py config_webrx_145 From 44cf9249774ecad43111eea2d4e2d50a6df1f3d8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:52:58 -0400 Subject: [PATCH 028/102] Update sdr.sh --- groundstation/sdr.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh index d3fe9a55..cbc43b7c 100755 --- a/groundstation/sdr.sh +++ b/groundstation/sdr.sh @@ -8,7 +8,9 @@ echo -e "IP Address to use in web browsers is: " hostname -I|cut -f1 -d ' ' -./kill_all.sh +#./kill_all.sh + +sudo sytemctl stop rtl_tcp #cd ~/openwebrx From b36220c148d2dfcecd25881452a07976ac606021 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:54:32 -0400 Subject: [PATCH 029/102] Update sdr.sh --- groundstation/sdr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh index cbc43b7c..8b06fa5e 100755 --- a/groundstation/sdr.sh +++ b/groundstation/sdr.sh @@ -10,7 +10,7 @@ hostname -I|cut -f1 -d ' ' #./kill_all.sh -sudo sytemctl stop rtl_tcp +sudo systemctl stop rtl_tcp #cd ~/openwebrx From 054c3cebf02a92875a0314e395347db7a69ae407 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 16:58:00 -0400 Subject: [PATCH 030/102] Update sdr.sh --- groundstation/sdr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh index 8b06fa5e..7ebf868d 100755 --- a/groundstation/sdr.sh +++ b/groundstation/sdr.sh @@ -14,7 +14,7 @@ sudo systemctl stop rtl_tcp #cd ~/openwebrx -sudo systemctl start openwebrx +sudo systemctl restart openwebrx chromium-browser http://localhost:8073 & From e07012868c7a4a36aac94c32fa6d1cbe0ee1f77a Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 20:47:16 -0400 Subject: [PATCH 031/102] Added 5 sec timeout --- systemd/demo.service | 1 + 1 file changed, 1 insertion(+) diff --git a/systemd/demo.service b/systemd/demo.service index 00fe4c46..731f5e26 100644 --- a/systemd/demo.service +++ b/systemd/demo.service @@ -2,6 +2,7 @@ Description=Test demo service [Service] +TimeoutStopSec=5 EnvironmentFile=/home/pi/CubeSatSim/.mode ExecStart=/home/pi/CubeSatSim/demo.sh $ARG1 WorkingDirectory=/home/pi/CubeSatSim From 1ded9de8064f17025c6d50d459b0ac97edf66184 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 21:09:58 -0400 Subject: [PATCH 032/102] Update cubesatsim.service --- systemd/cubesatsim.service | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 3da1a46e..633f689d 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -1,8 +1,10 @@ [Unit] -Description=My service +Description=CubeSatSim demo service [Service] -ExecStart=/home/pi/CubeSatSim/demo.sh > /home/pi/CubeSatSim/log.txt 2>&1 +TimeoutStopSec=5 +EnvironmentFile=/home/pi/CubeSatSim/.mode +ExecStart=/home/pi/CubeSatSim/demo.sh $ARG1 WorkingDirectory=/home/pi/CubeSatSim StandardOutput=inherit StandardError=inherit From d6076828602699ac317cbdd36bfc5561ce991819 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 21:17:48 -0400 Subject: [PATCH 033/102] with CW on AFSK --- afsk/main.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/afsk/main.c b/afsk/main.c index 351eecce..cbfa3cbb 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -776,7 +776,34 @@ for (int j = 0; j < frameCnt; j++) // printf("%s",tlm_str); strcat(str, tlm_str); } +// CW + { + char cw_str[500]; + char cw_header[] = "echo '"; + char cw_footer[] = "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3"; + + strcpy(cw_str, cw_header); +//printf("Before 1st strcpy\n"); + strcat(cw_str, str); +//printf("Before 1st strcpy\n"); + strcat(cw_str, cw_footer); +//printf("Before 1st strcpy\n"); + digitalWrite (txLed, txLedOn); +printf("Before cmd\n"); +//printf("CW String: %s\n", cw_str); +// FILE* f; + system(cw_str); +// printf("File %d \n", f); +// printf("close: %d \n", pclose(f)); // execute command and wait for termination before continuing +printf("After command\n"); +// sleep(7); +//printf("Before Write\n"); + digitalWrite (txLed, txLedOn); +//printf("After Write\n"); +} +//printf("Done CW!\n"); + } if (ax5043) { digitalWrite (txLed, txLedOn); From b66cee5410d9ccb80a3c321b52ebc0dd57a7a3f1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 21:21:51 -0400 Subject: [PATCH 034/102] Update main.c --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index cbfa3cbb..eb5076bb 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -801,7 +801,7 @@ printf("After command\n"); //printf("Before Write\n"); digitalWrite (txLed, txLedOn); //printf("After Write\n"); -} +//} //printf("Done CW!\n"); } if (ax5043) From b05d5e55ea45e12196141ea3d57a0e10d167a9bc Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 22:19:30 -0400 Subject: [PATCH 035/102] Update demo.sh --- demo.sh | 58 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/demo.sh b/demo.sh index 737a6336..ad5da628 100755 --- a/demo.sh +++ b/demo.sh @@ -2,29 +2,6 @@ echo -e "\nDemo of CubeSatSim at 434.9 MHz\n" -if [ "$1" = "a" ]; then - echo "Mode is continuous AFSK" - sleep 1 - sudo killall -9 sendiq - sudo killall -9 sendiq - sleep 1 - /home/pi/CubeSatSim/radioafsk afsk -elif [ "$1" = "f" ]; then - echo "Mode is continuous FSK" - sleep 1 - sudo killall -9 sendiq - sudo killall -9 sendiq - sleep 1 - /home/pi/CubeSatSim/radioafsk fsk -elif [ "$1" = "b" ]; then - echo "Mode is continuous BPSK" - sleep 1 - sudo killall -9 sendiq - sudo killall -9 sendiq - sleep 1 - /home/pi/CubeSatSim/radioafsk bpsk -fi - #exit y=$(last reboot | grep ^reboot | wc -l) @@ -32,21 +9,44 @@ echo $y if (( $y % 2 == 0 )) then - echo -e "\n Continuous FSK Mode\n\n" - /home/pi/CubeSatSim/radioafsk f + echo -e "\n Continuous Mode\n\n" +# /home/pi/CubeSatSim/radioafsk f + + if [ "$1" = "a" ]; then + echo "Mode is continuous AFSK" + sleep 1 + sudo killall -9 sendiq + sudo killall -9 sendiq + sleep 1 + /home/pi/CubeSatSim/radioafsk afsk + elif [ "$1" = "f" ]; then + echo "Mode is continuous FSK" + sleep 1 + sudo killall -9 sendiq + sudo killall -9 sendiq + sleep 1 + /home/pi/CubeSatSim/radioafsk fsk + elif [ "$1" = "b" ]; then + echo "Mode is continuous BPSK" + sleep 1 + sudo killall -9 sendiq + sudo killall -9 sendiq + sleep 1 + /home/pi/CubeSatSim/radioafsk bpsk + fi else echo -e "\n Alternating FSK, BPSK, and AFSK telemetry Mode \n\n" - /home/pi/CubeSatSim/radioafsk afsk 5 y + /home/pi/CubeSatSim/radioafsk afsk 4 y while true; do echo -e "\n Changing mode ******\n\n" - /home/pi/CubeSatSim/radioafsk fsk 5 n - /home/pi/CubeSatSim/radioafsk bpsk 5 n + /home/pi/CubeSatSim/radioafsk fsk 4 n + /home/pi/CubeSatSim/radioafsk bpsk 4 n # sleep 24 sleep 1 sudo killall -9 sendiq sudo killall -9 sendiq sleep 1 - /home/pi/CubeSatSim/radioafsk afsk 5 n + /home/pi/CubeSatSim/radioafsk afsk 4 n done fi From edcb0ab898fc4e1525e8b273c431cf01f1c9f18f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 22:31:45 -0400 Subject: [PATCH 036/102] Update main.c --- afsk/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index eb5076bb..152f23b7 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -779,21 +779,21 @@ for (int j = 0; j < frameCnt; j++) // CW { - char cw_str[500]; - char cw_header[] = "echo '"; - char cw_footer[] = "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3"; + char cw_str2[500]; + char cw_header2[] = "echo '"; + char cw_footer2[] = "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3"; - strcpy(cw_str, cw_header); + strcpy(cw_str2, cw_header2); //printf("Before 1st strcpy\n"); - strcat(cw_str, str); + strcat(cw_str2, str2); //printf("Before 1st strcpy\n"); - strcat(cw_str, cw_footer); + strcat(cw_str2, cw_footer2); //printf("Before 1st strcpy\n"); digitalWrite (txLed, txLedOn); printf("Before cmd\n"); -//printf("CW String: %s\n", cw_str); +printf("CW telem String: %s\n", cw_str2); // FILE* f; - system(cw_str); + system(cw_str2); // printf("File %d \n", f); // printf("close: %d \n", pclose(f)); // execute command and wait for termination before continuing printf("After command\n"); From 3cc46f3c40316d503f54bc9afb1cd21255e30dc9 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 22:34:27 -0400 Subject: [PATCH 037/102] Update main.c --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 152f23b7..3379a172 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -785,7 +785,7 @@ for (int j = 0; j < frameCnt; j++) strcpy(cw_str2, cw_header2); //printf("Before 1st strcpy\n"); - strcat(cw_str2, str2); + strcat(cw_str2, str); //printf("Before 1st strcpy\n"); strcat(cw_str2, cw_footer2); //printf("Before 1st strcpy\n"); From 8d92dd7253915fdeaea1db705eb54b5a88c9578b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 22:39:06 -0400 Subject: [PATCH 038/102] Update main.c --- afsk/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 3379a172..1b26e349 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -778,14 +778,13 @@ for (int j = 0; j < frameCnt; j++) } // CW - { char cw_str2[500]; char cw_header2[] = "echo '"; char cw_footer2[] = "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3"; strcpy(cw_str2, cw_header2); //printf("Before 1st strcpy\n"); - strcat(cw_str2, str); + strcat(cw_str2, tlm_str); //printf("Before 1st strcpy\n"); strcat(cw_str2, cw_footer2); //printf("Before 1st strcpy\n"); @@ -803,7 +802,7 @@ printf("After command\n"); //printf("After Write\n"); //} //printf("Done CW!\n"); - } + if (ax5043) { digitalWrite (txLed, txLedOn); From ab8dcd098d006fd0de9e3a35cf41d1070f8586ec Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 22:52:25 -0400 Subject: [PATCH 039/102] Update main.c --- afsk/main.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 1b26e349..6f9bbd97 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -90,9 +90,11 @@ int testCount = 0; short int buffer[2336400]; // max size for 10 frames count of BPSK #define S_RATE (48000) // (44100) -#define FSK 0 -#define BPSK 1 -#define AFSK 2 + +#define AFSK 1 +#define FSK 2 +#define BPSK 3 +#define CW 4 int rpitxStatus = -1; @@ -121,7 +123,7 @@ char call[5]; int bitRate, mode, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod; float sleepTime; int sampleTime = 0; -int cycle = OFF, cw_id = ON; +int cw_id = ON; int vB4 = FALSE, vB5 = FALSE, ax5043 = FALSE, transmit = FALSE, onLed, onLedOn, onLedOff, txLed, txLedOn, txLedOff, payload = OFF; float batteryThreshold = 0; @@ -256,8 +258,8 @@ int main(int argc, char *argv[]) { } else if (*argv[1] == 'c') { - cycle = ON; - printf("Mode cycle on\n"); + mode = CW; + printf("Mode CW\n"); } else { @@ -327,7 +329,7 @@ int main(int argc, char *argv[]) { ax5043 = TRUE; cw_id = OFF; mode = AFSK; - cycle = OFF; +// cycle = OFF; printf("Mode AFSK with AX5043\n"); transmit = TRUE; } @@ -402,8 +404,8 @@ int main(int argc, char *argv[]) { pinMode (onLed, OUTPUT); digitalWrite (onLed, onLedOn); - if ((cycle == ON) && !ax5043) // don't cycle modes if using AX5043 - mode = (reset_count) % 3; // alternate between the three modes +// if ((cycle == ON) && !ax5043) // don't cycle modes if using AX5043 +// mode = (reset_count) % 3; // alternate between the three modes config_file = fopen("sim.cfg","w"); fprintf(config_file, "%s %d", call, reset_count); @@ -498,6 +500,7 @@ else if (transmit == FALSE) { + fprintf(stderr,"\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); } @@ -752,6 +755,7 @@ for (int j = 0; j < frameCnt; j++) char header_str[] = "\x03\xf0hi hi "; char header_str3[] = "echo '"; char header_str2[] = ">CQ:hi hi "; + char header_str4[] = "hi hi "; char footer_str1[] = "\' > t.txt && echo \'"; char footer_str[] = ">CQ:hi hi ' >> t.txt && gen_packets -o telem.wav t.txt -r 48000 > /dev/null 2>&1 && cat telem.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3 > /dev/null 2>&1"; @@ -762,8 +766,14 @@ for (int j = 0; j < frameCnt; j++) else { strcpy(str, header_str3); - strcat(str, call); - strcat(str, header_str2); + if (mode != CW) + { + strcat(str, call); + strcat(str, header_str2); + } else + { + strcat(str, header_str4); + } } int channel; @@ -784,7 +794,7 @@ for (int j = 0; j < frameCnt; j++) strcpy(cw_str2, cw_header2); //printf("Before 1st strcpy\n"); - strcat(cw_str2, tlm_str); + strcat(cw_str2, str); //printf("Before 1st strcpy\n"); strcat(cw_str2, cw_footer2); //printf("Before 1st strcpy\n"); @@ -792,6 +802,7 @@ for (int j = 0; j < frameCnt; j++) printf("Before cmd\n"); printf("CW telem String: %s\n", cw_str2); // FILE* f; + if (mode = CW) system(cw_str2); // printf("File %d \n", f); // printf("close: %d \n", pclose(f)); // execute command and wait for termination before continuing From 9808485bb1ec06b909f3775d99c37ae100d2bbcc Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 22:56:31 -0400 Subject: [PATCH 040/102] Update main.c --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 6f9bbd97..8b604705 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -595,7 +595,7 @@ while (loop-- != 0) fprintf(stderr,"INFO: Getting TLM Data\n"); #endif - if (mode == AFSK) + if ((mode == AFSK) && (mode == CW)) { get_tlm(); } @@ -802,7 +802,7 @@ for (int j = 0; j < frameCnt; j++) printf("Before cmd\n"); printf("CW telem String: %s\n", cw_str2); // FILE* f; - if (mode = CW) + if (mode == CW) system(cw_str2); // printf("File %d \n", f); // printf("close: %d \n", pclose(f)); // execute command and wait for termination before continuing From 8efcc657e86e61fade6056737f776fe1fb250239 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 5 May 2020 23:00:06 -0400 Subject: [PATCH 041/102] Update main.c --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 8b604705..02584703 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -595,7 +595,7 @@ while (loop-- != 0) fprintf(stderr,"INFO: Getting TLM Data\n"); #endif - if ((mode == AFSK) && (mode == CW)) + if ((mode == AFSK) || (mode == CW)) { get_tlm(); } From 9969e441d32ed276de0902c953807f8ec1269e12 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 7 May 2020 10:03:50 -0400 Subject: [PATCH 042/102] updates for ARISS Radio Pi --- groundstation/fox.sh | 20 ++++++++++++++++++++ groundstation/rtl-tcp.sh | 29 ++++++++++++++++++++++++----- groundstation/sdr.sh | 23 +++++++++++++++-------- 3 files changed, 59 insertions(+), 13 deletions(-) create mode 100755 groundstation/fox.sh diff --git a/groundstation/fox.sh b/groundstation/fox.sh new file mode 100755 index 00000000..aa8dc1f8 --- /dev/null +++ b/groundstation/fox.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# script to run FoxTelem + +echo "Script to run FoxTelem for ARISS Radio Pi" + +echo + +sudo systemctl stop openwebrx + +sudo systemctl stop rtl_tcp + +pkill -o chromium &>/dev/null + +sudo killall -9 java &>/dev/null + +/home/pi/FoxTelem_1.09g_linux/FoxTelem & + +#/usr/bin/chromium-browser --noerrdialogs --disable-infobars http://localhost:8073 &>/dev/null & + +$SHELL diff --git a/groundstation/rtl-tcp.sh b/groundstation/rtl-tcp.sh index fab3b16b..58032674 100755 --- a/groundstation/rtl-tcp.sh +++ b/groundstation/rtl-tcp.sh @@ -3,13 +3,32 @@ # # 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 "Script to run RTL-TCP Server for ARISS Radio Pi" -echo -e "IP Address to use in web browsers is: " +ip=$(hostname -I|cut -f1 -d ' ') -#hostname -I|cut -f1 -d ' ' +echo -/home/pi/kill_all.sh +echo "IP Address to use in SDR application is: $ip" + +echo + +echo "Port to use in SDR application is the default: 1234" + +echo + +ssid=$(iwgetid -r) + +echo "Note: you need to be on the Wifi network: $ssid" + +echo + +pkill -o chromium &>/dev/null + +sudo killall -9 java &>/dev/null + +sudo systemctl stop openwebrx -#/usr/local/bin/rtl_tcp -a $(hostname -I|cut -f1 -d " ") sudo systemctl start rtl_tcp + +$SHELL diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh index 7ebf868d..e91f64e4 100755 --- a/groundstation/sdr.sh +++ b/groundstation/sdr.sh @@ -1,21 +1,28 @@ #!/bin/bash # script to run OpenWebRX SDR -echo -e "\nScript to run SDR for ARISS Ground Station\n" +echo "Script to run Web SDR for ARISS Radio Pi" -echo -e "IP Address to use in web browsers is: " +echo -hostname -I|cut -f1 -d ' ' +ip=$(hostname -I|cut -f1 -d ' ') +echo "IP Address to use in web browsers is: $ip:8073" -#./kill_all.sh +echo -sudo systemctl stop rtl_tcp +ssid=$(iwgetid -r) + +echo "Note: you need to be on the Wifi network: $ssid" + +echo -#cd ~/openwebrx +sudo killall -9 java &>/dev/null + +sudo systemctl stop rtl_tcp sudo systemctl restart openwebrx -chromium-browser http://localhost:8073 & +/usr/bin/chromium-browser --noerrdialogs --disable-infobars http://localhost:8073 &>/dev/null & -#sudo python openwebrx.py config_webrx_145 +$SHELL From 1aaf7b1b19c11480f368fbd65a9409394f8da9e3 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 4 Jul 2020 09:51:37 -0400 Subject: [PATCH 043/102] closed all fopens --- afsk/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 02584703..05c96adb 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -733,9 +733,10 @@ for (int j = 0; j < frameCnt; j++) #endif tlm[4][B] = (int)((95.8 - cpuTemp)/1.48 + 0.5) % 100; - fclose (cpuTempSensor); + } - + fclose (cpuTempSensor); + tlm[6][B] = 0 ; tlm[6][D] = 49 + rand() % 3; @@ -987,7 +988,8 @@ if (firstTime != ON) IHUcpuTemp = (int)((cpuTemp * 10.0) + 0.5); } - + fclose(cpuTempSensor); + memset(rs_frame,0,sizeof(rs_frame)); memset(parities,0,sizeof(parities)); From e86356aef2b0cae07143b97732288b040acdca93 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 4 Jul 2020 10:04:17 -0400 Subject: [PATCH 044/102] close all popens --- afsk/main.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 05c96adb..8fc48d87 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -306,17 +306,15 @@ int main(int argc, char *argv[]) { if (fgetc(file) == 48) { printf("SPI is enabled!\n"); - - file = popen("ls /dev/spidev0.* 2>&1", "r"); + + FILE *file2 = popen("ls /dev/spidev0.* 2>&1", "r"); // printf("Result: %d char: %c \n",file, getc(file)); if (fgetc(file) != 'l') { printf("SPI devices present!\n"); - - // } - + pclose(file2); setSpiChannel(SPI_CHANNEL); setSpiSpeed(SPI_SPEED); initializeSpi(); @@ -341,7 +339,7 @@ int main(int argc, char *argv[]) { // { // printf("SPI not enabled!\n"); // } - + pclose(file); txLed = 0; // defaults for vB3 board without TFB txLedOn = LOW; txLedOff = HIGH; @@ -624,10 +622,13 @@ while (loop-- != 0) printf("Done sleeping\n"); } // int transmit = popen("timeout 1 sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3","r"); - int txResult = popen("sudo killall -9 rpitx > /dev/null 2>&1", "r"); + int txResult = popen("sudo killall -9 rpitx > /dev/null 2>&1", "r"); + pclose(txResult); txResult = popen("sudo killall -9 sendiq > /dev/null 2>&1", "r"); + pclose(txResult); txResult = popen("sudo fuser -k 8080/tcp > /dev/null 2>&1", "r"); - + pclose(txResult); + if(cw_id == ON) // only turn off Power LED if CW ID is enabled (i.e. not demo.sh mode cycling) digitalWrite (onLed, onLedOff); @@ -1261,14 +1262,17 @@ if (firstTime != ON) printf("Changing rpitx mode!\n"); // txResult = popen("ps -ef | grep rpitx | grep -v grep | awk '{print $2}' | sudo xargs kill -9 > /dev/null 2>&1", "r"); txResult = popen("sudo killall -9 rpitx > /dev/null 2>&1", "r"); + pclose(txResult); // printf("1\n"); // sleep(1); // txResult = popen("ps -ef | grep sendiq | grep -v grep | awk '{print $2}' | sudo xargs kill -9 > /dev/null 2>&1", "r"); - txResult = popen("sudo killall -9 sendiq > /dev/null 2>&1", "r"); + txResult = popen("sudo killall -9 sendiq > /dev/null 2>&1", "r"); + pclose(txResult); // printf("2\n"); // digitalWrite (txLed, txLedOn); sleep(1); - txResult = popen("sudo fuser -k 8080/tcp > /dev/null 2>&1", "r"); + txResult = popen("sudo fuser -k 8080/tcp > /dev/null 2>&1", "r"); + pclose(txResult); socket_open = 0; // printf("3\n"); @@ -1280,13 +1284,14 @@ if (firstTime != ON) if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3&", "r"); -// printf("4\n"); + pclose(txResult); + // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1&", "r"); - } + pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); - pclose(txResult); + } else { From 09b9f6cc0657b3359acaba1d10c740696cf44895 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 5 Jul 2020 09:39:57 -0400 Subject: [PATCH 045/102] changing BPSK to 3 frames and extra sleep --- demo.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demo.sh b/demo.sh index ad5da628..66042de7 100755 --- a/demo.sh +++ b/demo.sh @@ -41,10 +41,12 @@ else while true; do echo -e "\n Changing mode ******\n\n" /home/pi/CubeSatSim/radioafsk fsk 4 n - /home/pi/CubeSatSim/radioafsk bpsk 4 n + /home/pi/CubeSatSim/radioafsk bpsk 3 n # sleep 24 sleep 1 sudo killall -9 sendiq + sudo killall -9 csdr + sleep 1 sudo killall -9 sendiq sleep 1 /home/pi/CubeSatSim/radioafsk afsk 4 n From 42743a77a45ed1ddf22e28866c52a05b9838f2cf Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 5 Jul 2020 10:03:54 -0400 Subject: [PATCH 046/102] trying more killall --- demo.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/demo.sh b/demo.sh index 66042de7..328933ee 100755 --- a/demo.sh +++ b/demo.sh @@ -41,7 +41,11 @@ else while true; do echo -e "\n Changing mode ******\n\n" /home/pi/CubeSatSim/radioafsk fsk 4 n - /home/pi/CubeSatSim/radioafsk bpsk 3 n + sudo killall -9 sendiq + sudo killall -9 csdr + sudo killall -9 rpitx + sleep 1 + /home/pi/CubeSatSim/radioafsk bpsk 4 n # sleep 24 sleep 1 sudo killall -9 sendiq From 525375d26e2aa8892b01a060daad64d8aaa22a50 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 5 Jul 2020 10:32:06 -0400 Subject: [PATCH 047/102] removing sendiq for BPSK --- afsk/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 8fc48d87..f3d36618 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1288,7 +1288,8 @@ if (firstTime != ON) // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1&", "r"); +// txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1&", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3&", "r"); pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); From 27c299a0c78c87f9ce456420e0a47a9c7622079b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 5 Jul 2020 11:47:33 -0400 Subject: [PATCH 048/102] took out BPSK in alternating mode --- demo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo.sh b/demo.sh index 328933ee..78acd633 100755 --- a/demo.sh +++ b/demo.sh @@ -45,7 +45,7 @@ else sudo killall -9 csdr sudo killall -9 rpitx sleep 1 - /home/pi/CubeSatSim/radioafsk bpsk 4 n +## /home/pi/CubeSatSim/radioafsk bpsk 4 n # sleep 24 sleep 1 sudo killall -9 sendiq From 975df210c5ecc517cde1e8988fe6aa70e029d09e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 5 Jul 2020 14:39:34 -0400 Subject: [PATCH 049/102] changed BPSK back to sendiq --- afsk/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index f3d36618..8fc48d87 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1288,8 +1288,7 @@ if (firstTime != ON) // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); -// txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3&", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1&", "r"); pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); From 1181486fdc27edf95aa203b72267660fc2f54c34 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 6 Jul 2020 11:38:27 -0400 Subject: [PATCH 050/102] removed alternating mode --- demo.sh | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/demo.sh b/demo.sh index 78acd633..7fef9919 100755 --- a/demo.sh +++ b/demo.sh @@ -7,8 +7,8 @@ echo -e "\nDemo of CubeSatSim at 434.9 MHz\n" y=$(last reboot | grep ^reboot | wc -l) echo $y -if (( $y % 2 == 0 )) -then +#if (( $y % 2 == 0 )) +#then echo -e "\n Continuous Mode\n\n" # /home/pi/CubeSatSim/radioafsk f @@ -34,25 +34,3 @@ then sleep 1 /home/pi/CubeSatSim/radioafsk bpsk fi -else - - echo -e "\n Alternating FSK, BPSK, and AFSK telemetry Mode \n\n" - /home/pi/CubeSatSim/radioafsk afsk 4 y - while true; do - echo -e "\n Changing mode ******\n\n" - /home/pi/CubeSatSim/radioafsk fsk 4 n - sudo killall -9 sendiq - sudo killall -9 csdr - sudo killall -9 rpitx - sleep 1 -## /home/pi/CubeSatSim/radioafsk bpsk 4 n -# sleep 24 - sleep 1 - sudo killall -9 sendiq - sudo killall -9 csdr - sleep 1 - sudo killall -9 sendiq - sleep 1 - /home/pi/CubeSatSim/radioafsk afsk 4 n - done -fi From 0b37e80879716f38c086ca0bee56873fe9c2e1e5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 6 Jul 2020 11:40:27 -0400 Subject: [PATCH 051/102] added default for FSK --- demo.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/demo.sh b/demo.sh index 7fef9919..6a3222ee 100755 --- a/demo.sh +++ b/demo.sh @@ -19,13 +19,6 @@ echo $y sudo killall -9 sendiq sleep 1 /home/pi/CubeSatSim/radioafsk afsk - elif [ "$1" = "f" ]; then - echo "Mode is continuous FSK" - sleep 1 - sudo killall -9 sendiq - sudo killall -9 sendiq - sleep 1 - /home/pi/CubeSatSim/radioafsk fsk elif [ "$1" = "b" ]; then echo "Mode is continuous BPSK" sleep 1 @@ -33,4 +26,11 @@ echo $y sudo killall -9 sendiq sleep 1 /home/pi/CubeSatSim/radioafsk bpsk + else + echo "Mode is continuous FSK" + sleep 1 + sudo killall -9 sendiq + sudo killall -9 sendiq + sleep 1 + /home/pi/CubeSatSim/radioafsk fsk fi From d344a2c192ec61446943453c3dbee0c131c88a19 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 7 Jul 2020 08:40:00 -0400 Subject: [PATCH 052/102] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5df7b78b..a85ac477 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Use the down arrow key to go down in the file until you find this line: `# Additional overlays and parameters are documented /boot/overlays/README ` -Add the following two lines under it: +Add the following two lines under it: (NOTE: there seems to be an issue with the i2c-gpio.dtbo file in the latest kernal. I'm investigating this temporary fix: https://github.com/raspberrypi/firmware/issues/1401. If adding dtoverlay=i2c-gpio in this step causes your Pi not to boot, then you are encountering this issue) `dtoverlay=i2c-gpio` From e88d156fd1f2e238bd0ad3fcf9081175e775b5cc Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 7 Jul 2020 10:17:40 -0400 Subject: [PATCH 053/102] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a85ac477..6b5b2f6e 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Then type: `git checkout master` -Create a sim.cfg configuration file with your amateur radio callsign by typing: +Create a sim.cfg configuration file with your amateur radio callsign (in all caps, no lower case letters!) by typing: `echo "callsign" >> sim.cfg` From 61e4697d253c1bac6d976e55a6843ba29e3a7d88 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 8 Jul 2020 11:26:30 -0400 Subject: [PATCH 054/102] fixed order of X, Y, Z telem in BPSK --- afsk/main.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 8fc48d87..f16b47a3 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1040,16 +1040,14 @@ if (firstTime != ON) if (payload == ON) STEMBoardFailure = 0; - -/* - posXv = 10, negXv = 20, posYv = 30, negYv = 40, posZv = 50, negZv = 60; - posXi = 110, negXi = 120, posYi = 130, negYi = 140, posZi = 150, negZi = 160; -*/ + encodeA(b, 0 + head_offset, batt_a_v); encodeB(b, 1 + head_offset, batt_b_v); encodeA(b, 3 + head_offset, batt_c_v); encodeA(b, 9 + head_offset, battCurr); + if (mode == FSK) + { encodeA(b, 12 + head_offset,posXv); encodeB(b, 13 + head_offset,negXv); encodeA(b, 15 + head_offset,posYv); @@ -1063,20 +1061,31 @@ if (firstTime != ON) encodeB(b, 25 + head_offset,negYi); encodeA(b, 27 + head_offset,posZi); encodeB(b, 28 + head_offset,negZi); - + } + else // BPSK + { + encodeA(b, 12 + head_offset,posXv); + encodeB(b, 13 + head_offset,posYv); + encodeA(b, 15 + head_offset,posZv); + encodeB(b, 16 + head_offset,negXv); + encodeA(b, 18 + head_offset,negYv); + encodeB(b, 19 + head_offset,negZv); + + encodeA(b, 21 + head_offset,posXi); + encodeB(b, 22 + head_offset,posXi); + encodeA(b, 24 + head_offset,posZi); + encodeB(b, 25 + head_offset,negXi); + encodeA(b, 27 + head_offset,negYi); + encodeB(b, 28 + head_offset,negZi); + } + encodeA(b, 30 + head_offset,PSUVoltage); encodeB(b, 46 + head_offset,PSUCurrent); encodeA(b, 39 + head_offset, IHUcpuTemp); encodeB(b, 51 + head_offset, STEMBoardFailure); - - -/* batt_c_v += 10; - battCurr -= 10; - encodeA(b, 3 + head_offset, batt_c_v); - encodeA(b, 9 + head_offset, battCurr); -*/ + short int data10[headerLen + rsFrames * (rsFrameLen + parityLen)]; short int data8[headerLen + rsFrames * (rsFrameLen + parityLen)]; From 5454e89d8aa09786243e4b00a1ac9ad92aa2a8b1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 8 Jul 2020 12:03:37 -0400 Subject: [PATCH 055/102] fixed typo in posYi --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index f16b47a3..c1d9e9c6 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1072,7 +1072,7 @@ if (firstTime != ON) encodeB(b, 19 + head_offset,negZv); encodeA(b, 21 + head_offset,posXi); - encodeB(b, 22 + head_offset,posXi); + encodeB(b, 22 + head_offset,posYi); encodeA(b, 24 + head_offset,posZi); encodeB(b, 25 + head_offset,negXi); encodeA(b, 27 + head_offset,negYi); From b504acc61dbab48725b6b078dcd31882eea388f2 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 9 Jul 2020 22:19:24 -0400 Subject: [PATCH 056/102] restart rpitx every 1000 frames --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index c1d9e9c6..a1de5989 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1264,7 +1264,7 @@ if (firstTime != ON) char cmdbuffer[1000]; FILE* txResult; - if ((rpitxStatus != mode)) // || (mode == BPSK)) + if ((rpitxStatus != mode) || ((loop % 1000) == 0)) { // change rpitx mode rpitxStatus = mode; From f20059a78afa6e96b5374b5325f80d09f968c4e8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 13 Jul 2020 15:01:33 -0400 Subject: [PATCH 057/102] removed loop % 1000 and added timeout to rpitx commands --- afsk/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index a1de5989..d592bae3 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1264,7 +1264,7 @@ if (firstTime != ON) char cmdbuffer[1000]; FILE* txResult; - if ((rpitxStatus != mode) || ((loop % 1000) == 0)) + if ((rpitxStatus != mode)) // || ((loop % 1000) == 0)) { // change rpitx mode rpitxStatus = mode; @@ -1292,12 +1292,12 @@ if (firstTime != ON) { if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3&", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3& done;", "r"); pclose(txResult); // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1&", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1& done;", "r"); pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); From f954213907c2e6381657936de4dec313bcc0939b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 13 Jul 2020 15:04:00 -0400 Subject: [PATCH 058/102] removed trailing & --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index d592bae3..7f8c455c 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1292,12 +1292,12 @@ if (firstTime != ON) { if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3& done;", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3 done;", "r"); pclose(txResult); // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1& done;", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1 done;", "r"); pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); From a2b23b2dadd5cc668e6a878bba20baa4fb33f961 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 13 Jul 2020 15:09:52 -0400 Subject: [PATCH 059/102] fixed ;done --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 7f8c455c..72b8f224 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1292,12 +1292,12 @@ if (firstTime != ON) { if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3 done;", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done", "r"); pclose(txResult); // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1 done;", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done", "r"); pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); From 28d7e1917b705046fdf9983209548470609b918f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 13 Jul 2020 15:15:34 -0400 Subject: [PATCH 060/102] moved & again --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 72b8f224..005cc357 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1292,12 +1292,12 @@ if (firstTime != ON) { if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done &", "r"); pclose(txResult); // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done &", "r"); pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); From 44fa3dd0e2ed2490cc381497d12d12637b1964e1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 13 Jul 2020 15:28:35 -0400 Subject: [PATCH 061/102] added -k 1 to timeout for BPSK mode --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 005cc357..a9602e24 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1292,12 +1292,12 @@ if (firstTime != ON) { if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done &", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done &", "r"); pclose(txResult); // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done &", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done &", "r"); pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); From 9638cd45096eb2956b7fdaa4b69abce69bcd3af1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 13 Jul 2020 15:38:28 -0400 Subject: [PATCH 062/102] changed to 60m --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index a9602e24..20a928ad 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1292,12 +1292,12 @@ if (firstTime != ON) { if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 2m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done &", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done &", "r"); pclose(txResult); // printf("4\n"); } else if (mode == BPSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/CubeSatSim/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8925e6 -t float 2>&1&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 2m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done &", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 60m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done &", "r"); pclose(txResult); } // fgets(cmdbuffer, 1000, txResult); From 8c6b0d841d7c221d60d430cd5aff75ff801e63ee Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 15 Jul 2020 09:50:36 -0400 Subject: [PATCH 063/102] added changes to remove delays on first four frames for BPSK --- afsk/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 20a928ad..1f51f9de 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -122,7 +122,7 @@ char call[5]; int bitRate, mode, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod; float sleepTime; -int sampleTime = 0; +int sampleTime = 0, frames_sent = 0; int cw_id = ON; int vB4 = FALSE, vB5 = FALSE, ax5043 = FALSE, transmit = FALSE, onLed, onLedOn, onLedOff, txLed, txLedOn, txLedOff, payload = OFF; float batteryThreshold = 0; @@ -534,7 +534,7 @@ printf("After command\n"); while (loop-- != 0) { - + frames_sent++; float batteryVoltage = read_sensor_data(sensor[BAT]).voltage; #ifdef DEBUG_LOGGING fprintf(stderr,"INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold); @@ -1379,7 +1379,11 @@ if (firstTime != ON) fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); } // digitalWrite (0, HIGH); - firstTime = 0; + + if (mode == FSK) + firstTime = 0; + else if (frames_sent > 5) + firstTime = 0; return 0; } From 249464f5134e472d941be9cfdaca68a3b257b741 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 15 Jul 2020 09:57:07 -0400 Subject: [PATCH 064/102] added 2>&1 to rpitx --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 1f51f9de..3a700103 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1292,7 +1292,7 @@ if (firstTime != ON) { if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done &", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3 2>&1; done &", "r"); pclose(txResult); // printf("4\n"); } else if (mode == BPSK) { From 4b644b0230776c20007ea785fb163bd091ba349d Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 15 Jul 2020 10:07:11 -0400 Subject: [PATCH 065/102] removed &2>1 --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 3a700103..1f51f9de 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1292,7 +1292,7 @@ if (firstTime != ON) { if (mode == FSK) { // txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.896e3&", "r"); - txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3 2>&1; done &", "r"); + txResult = popen("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done &", "r"); pclose(txResult); // printf("4\n"); } else if (mode == BPSK) { From fd5cb5fa03b57f6b8fea64b0518e89b19901e4ca Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 15 Jul 2020 16:25:07 -0400 Subject: [PATCH 066/102] changed to file2 for SPI check --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 20a928ad..5b4634a5 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -308,9 +308,9 @@ int main(int argc, char *argv[]) { printf("SPI is enabled!\n"); FILE *file2 = popen("ls /dev/spidev0.* 2>&1", "r"); -// printf("Result: %d char: %c \n",file, getc(file)); +// printf("Result getc: %c \n", getc(file2)); - if (fgetc(file) != 'l') + if (fgetc(file2) != 'l') { printf("SPI devices present!\n"); // } From 1a955cd09227a61a9bd02cd8b863c2895b1f7a47 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 15 Jul 2020 16:29:10 -0400 Subject: [PATCH 067/102] changed to file2 for SPI check --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 1f51f9de..086a8e43 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -308,9 +308,9 @@ int main(int argc, char *argv[]) { printf("SPI is enabled!\n"); FILE *file2 = popen("ls /dev/spidev0.* 2>&1", "r"); -// printf("Result: %d char: %c \n",file, getc(file)); +// printf("Result getc: %c \n", getc(file2)); - if (fgetc(file) != 'l') + if (fgetc(file2) != 'l') { printf("SPI devices present!\n"); // } From c087825dc925920bd9b261b80fad09f8377ff3b1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 15 Jul 2020 17:31:14 -0400 Subject: [PATCH 068/102] initial add of systemd for rpitx and sh --- rpitx.sh | 14 ++++++++++++++ systemd/rpitx.service | 15 +++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 rpitx.sh create mode 100644 systemd/rpitx.service diff --git a/rpitx.sh b/rpitx.sh new file mode 100755 index 00000000..2f39a135 --- /dev/null +++ b/rpitx.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo -e "\nrpitx for CubeSatSim at 434.9 MHz\n" + + if [ "$1" = "a" ]; then + echo "Mode is continuous AFSK" + sleep infinity + elif [ "$1" = "b" ]; then + echo "Tx is continuous BPSK" + sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done + else + echo "Tx is continuous FSK" + sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 60m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done + fi diff --git a/systemd/rpitx.service b/systemd/rpitx.service new file mode 100644 index 00000000..c58b7bd1 --- /dev/null +++ b/systemd/rpitx.service @@ -0,0 +1,15 @@ +[Unit] +Description=CubeSatSim rpitx service + +[Service] +TimeoutStopSec=5 +EnvironmentFile=/home/pi/CubeSatSim/.mode +ExecStart=/home/pi/CubeSatSim/rpitx.sh $ARG1 +WorkingDirectory=/home/pi/CubeSatSim +StandardOutput=inherit +StandardError=inherit +Restart=always +User=root + +[Install] +WantedBy=default.target From 048cd2a6a3b97d46465a04bafc3c988961078bf5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 15 Jul 2020 20:11:48 -0400 Subject: [PATCH 069/102] started removing rpitx --- afsk/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 086a8e43..85de018e 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1261,7 +1261,7 @@ if (firstTime != ON) // printf("\n"); // rpitx - +/* char cmdbuffer[1000]; FILE* txResult; if ((rpitxStatus != mode)) // || ((loop % 1000) == 0)) @@ -1287,7 +1287,7 @@ if (firstTime != ON) // printf("3\n"); sleep(1); // digitalWrite (txLed, txLedOff); - + if (transmit) { if (mode == FSK) { @@ -1310,6 +1310,7 @@ if (firstTime != ON) sleep(2); // printf("Results of transmit command: %s\n", cmdbuffer); } +*/ // socket write From d8f37caab6ceccf5831914fd8b0a30a34acbc6d7 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 15 Jul 2020 23:07:19 -0400 Subject: [PATCH 070/102] removed rest of rpitx except for AFSK --- afsk/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 85de018e..fe6c59f9 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -504,7 +504,7 @@ else } // Send ID in CW (Morse Code) - +cw_id = OFF; if (cw_id == ON) // Don't send CW if using AX5043 or in mode cycling or set by 3rd argument { char cw_str[200]; @@ -621,6 +621,7 @@ while (loop-- != 0) sleep(loop_count); printf("Done sleeping\n"); } +/* // int transmit = popen("timeout 1 sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3","r"); int txResult = popen("sudo killall -9 rpitx > /dev/null 2>&1", "r"); pclose(txResult); @@ -631,7 +632,7 @@ while (loop-- != 0) if(cw_id == ON) // only turn off Power LED if CW ID is enabled (i.e. not demo.sh mode cycling) digitalWrite (onLed, onLedOff); - +*/ return 0; } From e3d2acca34193db1ba32966a758ccbb02590942f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 15 Jul 2020 23:10:44 -0400 Subject: [PATCH 071/102] added restarting rpitx.service --- demo.sh | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/demo.sh b/demo.sh index 6a3222ee..6780d8e5 100755 --- a/demo.sh +++ b/demo.sh @@ -2,35 +2,19 @@ echo -e "\nDemo of CubeSatSim at 434.9 MHz\n" -#exit +sudo systemctl stop rpitx +sudo systemctl start rpitx -y=$(last reboot | grep ^reboot | wc -l) -echo $y - -#if (( $y % 2 == 0 )) -#then echo -e "\n Continuous Mode\n\n" # /home/pi/CubeSatSim/radioafsk f if [ "$1" = "a" ]; then echo "Mode is continuous AFSK" - sleep 1 - sudo killall -9 sendiq - sudo killall -9 sendiq - sleep 1 /home/pi/CubeSatSim/radioafsk afsk elif [ "$1" = "b" ]; then - echo "Mode is continuous BPSK" - sleep 1 - sudo killall -9 sendiq - sudo killall -9 sendiq - sleep 1 + echo "Mode is continuous BPSK" /home/pi/CubeSatSim/radioafsk bpsk else echo "Mode is continuous FSK" - sleep 1 - sudo killall -9 sendiq - sudo killall -9 sendiq - sleep 1 /home/pi/CubeSatSim/radioafsk fsk fi From 28b84c31ce5322435316876e9a383837b13caeb1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 15 Jul 2020 23:12:12 -0400 Subject: [PATCH 072/102] removed 2>&1 from sendiq --- rpitx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.sh b/rpitx.sh index 2f39a135..df9e2c34 100755 --- a/rpitx.sh +++ b/rpitx.sh @@ -10,5 +10,5 @@ echo -e "\nrpitx for CubeSatSim at 434.9 MHz\n" sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done else echo "Tx is continuous FSK" - sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 60m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float 2>&1; done + sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 60m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float; done fi From 952233f05f3ef65692f49dcebe3614e12650ea68 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 15 Jul 2020 23:21:05 -0400 Subject: [PATCH 073/102] swapped BPSK and FSK --- rpitx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpitx.sh b/rpitx.sh index df9e2c34..1136a5f3 100755 --- a/rpitx.sh +++ b/rpitx.sh @@ -7,8 +7,8 @@ echo -e "\nrpitx for CubeSatSim at 434.9 MHz\n" sleep infinity elif [ "$1" = "b" ]; then echo "Tx is continuous BPSK" - sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done + sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 60m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float; done else echo "Tx is continuous FSK" - sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 60m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float; done + sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done fi From 7754d0139d7aadada6e00a8ec6d37c4c1f793117 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 16 Jul 2020 16:58:56 -0400 Subject: [PATCH 074/102] removed timeout for v2beta rpitx branch --- rpitx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpitx.sh b/rpitx.sh index 1136a5f3..945de1a0 100755 --- a/rpitx.sh +++ b/rpitx.sh @@ -7,8 +7,8 @@ echo -e "\nrpitx for CubeSatSim at 434.9 MHz\n" sleep infinity elif [ "$1" = "b" ]; then echo "Tx is continuous BPSK" - sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | while true; do sudo timeout -k 1 60m /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float; done + sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float else echo "Tx is continuous FSK" - sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | while true; do sudo timeout -k 1 60m /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3; done + sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3 fi From 6b2fd33c03aeae517512e5150a688fd6fd03f9d0 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 16 Jul 2020 21:20:38 -0400 Subject: [PATCH 075/102] started --- rpitx.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 rpitx.py diff --git a/rpitx.py b/rpitx.py new file mode 100644 index 00000000..1cadee16 --- /dev/null +++ b/rpitx.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import RPi.GPIO as GPIO +import subprocess +import time +import os + +GPIO.setmode(GPIO.BCM) +GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP) +GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) +if GPIO.input(12) == False: + powerPin = 16 +else: + powerPin = 17 +GPIO.setwarnings(False) +GPIO.setup(powerPin, GPIO.OUT) +GPIO.output(powerPin, 1); + +while (True): + time.sleep(1) + GPIO.wait_for_edge(26, GPIO.FALLING) + + done = False; + time.sleep(1) + if GPIO.input(26): + print("sudo reboot -h now") + GPIO.setwarnings(False) + GPIO.setup(powerPin, GPIO.OUT) + GPIO.output(powerPin, 0); + subprocess.call(['reboot', '-h', 'now'], shell=False) + GPIO.output(powerPin, 0); From 46c23a4082c7bdca596089c4f2ed9845c8e1b49f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 16 Jul 2020 22:57:45 -0400 Subject: [PATCH 076/102] added transmit setting, callsign read, and Tx setting --- rpitx.py | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/rpitx.py b/rpitx.py index 1cadee16..5c9a5029 100644 --- a/rpitx.py +++ b/rpitx.py @@ -6,26 +6,36 @@ import time import os GPIO.setmode(GPIO.BCM) -GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP) +GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) +transmit = False if GPIO.input(12) == False: - powerPin = 16 -else: - powerPin = 17 -GPIO.setwarnings(False) -GPIO.setup(powerPin, GPIO.OUT) -GPIO.output(powerPin, 1); + transmit = True +if GPIO.input(27) == False; + transmit = True -while (True): - time.sleep(1) - GPIO.wait_for_edge(26, GPIO.FALLING) +print(transmit) - done = False; - time.sleep(1) - if GPIO.input(26): - print("sudo reboot -h now") - GPIO.setwarnings(False) - GPIO.setup(powerPin, GPIO.OUT) - GPIO.output(powerPin, 0); - subprocess.call(['reboot', '-h', 'now'], shell=False) - GPIO.output(powerPin, 0); +file = open("/home/pi/CubeSatSim/sim.cfg") +callsign = file.readline().split(" ")[0] +print(callsign) + +if __name__ == "__main__": +# print(f"Arguments count: {len(sys.argv)}") +# for i, arg in enumerate(sys.argv): +# print(f"Argument {i:>6}: {arg}") +# + print 'Length: ', len(sys.argv) + + if (len(sys.argv)) > 1: +# print("There are arguments!") + if (('a' == sys.argv[1]) or ('afsk' in sys.argv[1])): + print("AFSK") +# os.system("sleep infinity") + elif (('b' == sys.argv[1]) or ('bpsk' in sys.argv[1])): + print("BPSK") +# os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float") + else + mode = FSK + print("FSK") +# os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") From de21f15407099708d5de5b90ce6e7018e1975b88 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 16 Jul 2020 22:59:25 -0400 Subject: [PATCH 077/102] Update rpitx.py --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 5c9a5029..d0268743 100644 --- a/rpitx.py +++ b/rpitx.py @@ -11,7 +11,7 @@ GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) transmit = False if GPIO.input(12) == False: transmit = True -if GPIO.input(27) == False; +if GPIO.input(27) == False: transmit = True print(transmit) From 3d76c641e4d54e1ccc763b9ccc86bd19fcf67cc2 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 16 Jul 2020 23:00:34 -0400 Subject: [PATCH 078/102] Update rpitx.py --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index d0268743..7dae4a13 100644 --- a/rpitx.py +++ b/rpitx.py @@ -35,7 +35,7 @@ if __name__ == "__main__": elif (('b' == sys.argv[1]) or ('bpsk' in sys.argv[1])): print("BPSK") # os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float") - else + else: mode = FSK print("FSK") # os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") From e0bb481323955607e42565c71016966381c8a262 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 16 Jul 2020 23:01:29 -0400 Subject: [PATCH 079/102] Update rpitx.py --- rpitx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rpitx.py b/rpitx.py index 7dae4a13..5a3353ae 100644 --- a/rpitx.py +++ b/rpitx.py @@ -4,6 +4,7 @@ import RPi.GPIO as GPIO import subprocess import time import os +import sys GPIO.setmode(GPIO.BCM) GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP) From 037deeb086c29f5edc44f97c4de62f98cf214284 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 16 Jul 2020 23:02:14 -0400 Subject: [PATCH 080/102] Update rpitx.py --- rpitx.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 5a3353ae..32470eb8 100644 --- a/rpitx.py +++ b/rpitx.py @@ -37,6 +37,5 @@ if __name__ == "__main__": print("BPSK") # os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float") else: - mode = FSK print("FSK") # os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") From dc557dba98b9d0b2e12820a99db01f5f3dff91cf Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 17 Jul 2020 08:59:22 -0400 Subject: [PATCH 081/102] added cw id and rpitx calls --- rpitx.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rpitx.py b/rpitx.py index 32470eb8..d1757921 100644 --- a/rpitx.py +++ b/rpitx.py @@ -21,6 +21,10 @@ file = open("/home/pi/CubeSatSim/sim.cfg") callsign = file.readline().split(" ")[0] print(callsign) +os.system("echo 'de " + callsign + "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") + +time.sleep(2) + if __name__ == "__main__": # print(f"Arguments count: {len(sys.argv)}") # for i, arg in enumerate(sys.argv): @@ -32,10 +36,14 @@ if __name__ == "__main__": # print("There are arguments!") if (('a' == sys.argv[1]) or ('afsk' in sys.argv[1])): print("AFSK") -# os.system("sleep infinity") + while True: + time.sleep(5) elif (('b' == sys.argv[1]) or ('bpsk' in sys.argv[1])): print("BPSK") -# os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float") + os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float") else: print("FSK") -# os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") + os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") + else: + print("FSK") + os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") From 2d23de7c25ecfc6104f8f1cdb666df2967ee79ff Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 17 Jul 2020 09:25:14 -0400 Subject: [PATCH 082/102] add rptix.py call --- rpitx.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpitx.sh b/rpitx.sh index 945de1a0..6e376253 100755 --- a/rpitx.sh +++ b/rpitx.sh @@ -2,6 +2,8 @@ echo -e "\nrpitx for CubeSatSim at 434.9 MHz\n" +python rpitx.py $1 + if [ "$1" = "a" ]; then echo "Mode is continuous AFSK" sleep infinity From 63e0161321ed4303da62308d264255214b8758ef Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 18 Jul 2020 15:04:59 -0400 Subject: [PATCH 083/102] removed cw id transmit since in rpitx now --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index fe6c59f9..105bd795 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -495,7 +495,7 @@ else //uint8_t data[1024]; tx_freq_hz -= tx_channel * 50000; - +/* if (transmit == FALSE) { @@ -531,7 +531,7 @@ printf("After command\n"); //printf("After Write\n"); } //printf("Done CW!\n"); - +*/ while (loop-- != 0) { frames_sent++; From 379843640ffc178fe2c8d269172eb52167fbac25 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 18 Jul 2020 15:18:07 -0400 Subject: [PATCH 084/102] swapped HIGH and LOW for txLed On/Off for vB5 --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 105bd795..03772caa 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -385,8 +385,8 @@ int main(int argc, char *argv[]) { { printf("vB5 Present\n"); txLed = 2; - txLedOn = HIGH; - txLedOff = LOW; + txLedOn = LOW; //HIGH; + txLedOff = HIGH; //LOW; vB5 = TRUE; onLed = 27; onLedOn = HIGH; From 9cac292894bc36d5ef74f44decf29b0ada3b8875 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 20 Jul 2020 17:25:49 -0400 Subject: [PATCH 085/102] reset Hi and LOW for Tx LED --- afsk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 03772caa..105bd795 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -385,8 +385,8 @@ int main(int argc, char *argv[]) { { printf("vB5 Present\n"); txLed = 2; - txLedOn = LOW; //HIGH; - txLedOff = HIGH; //LOW; + txLedOn = HIGH; + txLedOff = LOW; vB5 = TRUE; onLed = 27; onLedOn = HIGH; From f59751e35bf14b6650a0ffd07c2ee13e6615925d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jul 2020 18:11:52 -0400 Subject: [PATCH 086/102] added Tx LED Logging - occational 8 sec BPSK --- afsk/main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ rpitx.sh | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 105bd795..f54d30dc 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -399,8 +399,14 @@ int main(int argc, char *argv[]) { } pinMode (txLed, OUTPUT); digitalWrite (txLed, txLedOff); + #ifdef DEBUG_LOGGING + printf("Tx LED Off\n"); + #endif pinMode (onLed, OUTPUT); digitalWrite (onLed, onLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif // if ((cycle == ON) && !ax5043) // don't cycle modes if using AX5043 // mode = (reset_count) % 3; // alternate between the three modes @@ -518,6 +524,9 @@ if (cw_id == ON) // Don't send CW if using AX5043 or in mode cycling or set by 3 strcat(cw_str, cw_footer); //printf("Before 1st strcpy\n"); digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif printf("Before cmd\n"); //printf("CW String: %s\n", cw_str); // FILE* f; @@ -528,6 +537,9 @@ printf("After command\n"); // sleep(7); //printf("Before Write\n"); digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif //printf("After Write\n"); } //printf("Done CW!\n"); @@ -610,10 +622,16 @@ while (loop-- != 0) if (mode == BPSK) { digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif printf("Sleeping to allow BPSK transmission to finish.\n"); sleep(loop_count * 5); printf("Done sleeping\n"); digitalWrite (txLed, txLedOff); + #ifdef DEBUG_LOGGING + printf("Tx LED Off\n"); + #endif } else if (mode == FSK) { @@ -632,6 +650,9 @@ while (loop-- != 0) if(cw_id == ON) // only turn off Power LED if CW ID is enabled (i.e. not demo.sh mode cycling) digitalWrite (onLed, onLedOff); + #ifdef DEBUG_LOGGING + printf("Tx LED Off\n"); + #endif */ return 0; } @@ -682,6 +703,9 @@ int get_tlm(void) { for (int j = 0; j < frameCnt; j++) { digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif int tlm[7][5]; memset(tlm, 0, sizeof tlm); @@ -802,6 +826,9 @@ for (int j = 0; j < frameCnt; j++) strcat(cw_str2, cw_footer2); //printf("Before 1st strcpy\n"); digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif printf("Before cmd\n"); printf("CW telem String: %s\n", cw_str2); // FILE* f; @@ -813,6 +840,9 @@ printf("After command\n"); // sleep(7); //printf("Before Write\n"); digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif //printf("After Write\n"); //} //printf("Done CW!\n"); @@ -820,6 +850,9 @@ printf("After command\n"); if (ax5043) { digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif fprintf(stderr,"INFO: Transmitting X.25 packet\n"); memcpy(data, str, strnlen(str, 256)); int ret = ax25_tx_frame(&hax25, &hax5043, data, strnlen(str, 256)); @@ -831,6 +864,9 @@ printf("After command\n"); } ax5043_wait_for_transmit(); digitalWrite (txLed, txLedOff); + #ifdef DEBUG_LOGGING + printf("Tx LED Off\n"); + #endif if (ret) { fprintf(stderr, @@ -857,8 +893,14 @@ printf("After command\n"); fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); } digitalWrite (txLed, txLedOff); + #ifdef DEBUG_LOGGING + printf("Tx LED Off\n"); + #endif sleep(3); digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif } //digitalWrite (txLed, txLedOff); @@ -868,6 +910,9 @@ printf("After command\n"); printf("End of get_tlm and rpitx =========================================================\n"); digitalWrite (txLed, txLedOff); + #ifdef DEBUG_LOGGING + printf("Tx LED Off\n"); + #endif return; } @@ -943,11 +988,17 @@ if (firstTime != ON) { // delay for sample period digitalWrite (txLed, txLedOn); + #ifdef DEBUG_LOGGING + printf("Tx LED On\n"); + #endif while ((millis() - sampleTime) < samplePeriod) sleep(sleepTime); digitalWrite (txLed, txLedOff); + #ifdef DEBUG_LOGGING + printf("Tx LED Off\n"); + #endif printf("Sample period: %d\n",millis() - sampleTime); sampleTime = millis(); diff --git a/rpitx.sh b/rpitx.sh index 6e376253..44aa3f45 100755 --- a/rpitx.sh +++ b/rpitx.sh @@ -2,7 +2,7 @@ echo -e "\nrpitx for CubeSatSim at 434.9 MHz\n" -python rpitx.py $1 +#python rpitx.py $1 if [ "$1" = "a" ]; then echo "Mode is continuous AFSK" From 902177cdf0ee90aaaef0c707fd9b862a9b8d424d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Jul 2020 18:41:49 -0400 Subject: [PATCH 087/102] removed BPSK 4 frame no delay --- afsk/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index f54d30dc..35e2ae39 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1435,7 +1435,7 @@ if (firstTime != ON) if (mode == FSK) firstTime = 0; - else if (frames_sent > 5) + else if (frames_sent > 0) //5) firstTime = 0; return 0; From 56eb9aafa4e02577cf2a57c94656444c7a8b7fdd Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 20 Jul 2020 20:47:31 -0400 Subject: [PATCH 088/102] cleaned up frequency and added GPIO.setwarnings(False) --- rpitx.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/rpitx.py b/rpitx.py index d1757921..bbfecbc4 100644 --- a/rpitx.py +++ b/rpitx.py @@ -7,6 +7,7 @@ import os import sys GPIO.setmode(GPIO.BCM) +GPIO.setwarnings(False) GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) transmit = False @@ -21,15 +22,11 @@ file = open("/home/pi/CubeSatSim/sim.cfg") callsign = file.readline().split(" ")[0] print(callsign) -os.system("echo 'de " + callsign + "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") +os.system("echo 'de " + callsign + "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") time.sleep(2) if __name__ == "__main__": -# print(f"Arguments count: {len(sys.argv)}") -# for i, arg in enumerate(sys.argv): -# print(f"Argument {i:>6}: {arg}") -# print 'Length: ', len(sys.argv) if (len(sys.argv)) > 1: @@ -40,10 +37,10 @@ if __name__ == "__main__": time.sleep(5) elif (('b' == sys.argv[1]) or ('bpsk' in sys.argv[1])): print("BPSK") - os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float") + os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float") else: print("FSK") - os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") + os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") else: print("FSK") - os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3") + os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") From 68f73b53c5b5557c694ec02af6212fc3a4a41e30 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 20 Jul 2020 20:48:26 -0400 Subject: [PATCH 089/102] made rpitx.py python only --- rpitx.sh | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/rpitx.sh b/rpitx.sh index 44aa3f45..edd07085 100755 --- a/rpitx.sh +++ b/rpitx.sh @@ -1,16 +1,5 @@ #!/bin/bash -echo -e "\nrpitx for CubeSatSim at 434.9 MHz\n" +echo -e "\nrpitx for CubeSatSim at 434.9 MHz using python\n" -#python rpitx.py $1 - - if [ "$1" = "a" ]; then - echo "Mode is continuous AFSK" - sleep infinity - elif [ "$1" = "b" ]; then - echo "Tx is continuous BPSK" - sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.8945e6 -t float - else - echo "Tx is continuous FSK" - sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.897e3 - fi +python rpitx.py $1 From 33c3ac8fd312bd28226db169c958d3478139e035 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 20 Jul 2020 20:52:51 -0400 Subject: [PATCH 090/102] cleaned up with restart --- demo.sh | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/demo.sh b/demo.sh index 6780d8e5..7a29a981 100755 --- a/demo.sh +++ b/demo.sh @@ -2,19 +2,15 @@ echo -e "\nDemo of CubeSatSim at 434.9 MHz\n" -sudo systemctl stop rpitx -sudo systemctl start rpitx +sudo systemctl restart rpitx - echo -e "\n Continuous Mode\n\n" -# /home/pi/CubeSatSim/radioafsk f - - if [ "$1" = "a" ]; then - echo "Mode is continuous AFSK" - /home/pi/CubeSatSim/radioafsk afsk - elif [ "$1" = "b" ]; then - echo "Mode is continuous BPSK" - /home/pi/CubeSatSim/radioafsk bpsk - else - echo "Mode is continuous FSK" - /home/pi/CubeSatSim/radioafsk fsk - fi +if [ "$1" = "a" ]; then + echo "Mode is continuous AFSK" + /home/pi/CubeSatSim/radioafsk afsk +elif [ "$1" = "b" ]; then + echo "Mode is continuous BPSK" + /home/pi/CubeSatSim/radioafsk bpsk +else + echo "Mode is continuous FSK" + /home/pi/CubeSatSim/radioafsk fsk +fi From dd0ab8dd25106c0e3aa25d0e6411f3d65dc404f6 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 20 Jul 2020 21:07:19 -0400 Subject: [PATCH 091/102] put in full path for rpitx.py --- rpitx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.sh b/rpitx.sh index edd07085..e2cb4245 100755 --- a/rpitx.sh +++ b/rpitx.sh @@ -2,4 +2,4 @@ echo -e "\nrpitx for CubeSatSim at 434.9 MHz using python\n" -python rpitx.py $1 +python /home/pi/CubeSatSim/rpitx.py $1 From efd4219abd4ce7d1bd3b8e54b157d716b6b646e8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 20 Jul 2020 21:13:59 -0400 Subject: [PATCH 092/102] added 15 sec timeout to cw id --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index bbfecbc4..329a47d7 100644 --- a/rpitx.py +++ b/rpitx.py @@ -22,7 +22,7 @@ file = open("/home/pi/CubeSatSim/sim.cfg") callsign = file.readline().split(" ")[0] print(callsign) -os.system("echo 'de " + callsign + "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") +os.system("echo 'de " + callsign + "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo timeout -k 1 15 /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") time.sleep(2) From 888507c4e7aea1f9dc313903034f05e123bb5f75 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 21 Jul 2020 05:26:40 -0400 Subject: [PATCH 093/102] switched to rpitx master and removed timeout for cw id --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 329a47d7..bbfecbc4 100644 --- a/rpitx.py +++ b/rpitx.py @@ -22,7 +22,7 @@ file = open("/home/pi/CubeSatSim/sim.cfg") callsign = file.readline().split(" ")[0] print(callsign) -os.system("echo 'de " + callsign + "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo timeout -k 1 15 /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") +os.system("echo 'de " + callsign + "' > id.txt && gen_packets -M 20 id.txt -o morse.wav -r 48000 > /dev/null 2>&1 && cat morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") time.sleep(2) From 199531a7205df874715450aaecf5dcf3e79710fc Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 21 Jul 2020 14:35:57 -0400 Subject: [PATCH 094/102] Update README.md --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6b5b2f6e..7d4b2b08 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The CubeSat Simulator https://github.com/alanbjohnston/CubeSatSim/wiki is a low There are several hardware versions and software branches to go with them - see below for information. -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 (doesn't work on Pi 4 since rpitx doesn't work on it yet): +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+, Pi Zero or Pi Zero W (doesn't work on Pi 4 since rpitx doesn't work on it yet): Requires: - Raspbian Stretch or Buster, full desktop or Lite - wiringpi @@ -14,9 +14,15 @@ Requires: - Direwolf - rpitx -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 (Does NOT work on a Pi 4 since rpitx does not work on it yet): +See the Wiki Software Install page for more details: https://github.com/alanbjohnston/CubeSatSim/wiki/Software-Install. Runs on a Raspberry Pi 3B, 3B+, or Pi Zero W (Does NOT work on a Pi 4 since rpitx does not work on it yet). The Pi Zero W or Pi Zero are recommended since they are draw the least power and will result in the best performance under battery power. -`sudo apt-get install -y wiringpi git libasound2-dev i2c-tools` +These instructions assume a Pi Zero W with WiFi connectivity. If you have a Pi Zero, follow these instructions to get connectivity: https://desertbot.io/blog/headless-pi-zero-ssh-access-over-usb-windows + +To begin the software install, after logging in type: + +`sudo apt update -y && sudo apt dist-upgrade -y` + +`sudo apt install -y wiringpi git libasound2-dev i2c-tools` Run raspi-config and enable the I2C bus by selecting Option 5 Interfacing Options and then Option 5 I2C and selecting Y to enable the ARM I2C bus: @@ -80,6 +86,8 @@ Create a sim.cfg configuration file with your amateur radio callsign (in all cap `echo "callsign" >> sim.cfg` +`echo >> .mode` + Compile the code: `make rebuild` @@ -125,6 +133,10 @@ To make the demo.sh script run automatically on boot: `sudo systemctl enable cubesatsim` +`sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service` + +`sudo systemctl enable rpitx` + Now reboot for all the changes to take effect: `sudo reboot now` From b66f6c41f0e378ce522d7ced66bba608e342c802 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 22 Jul 2020 12:39:03 +0000 Subject: [PATCH 095/102] cleanup of ax5043 code --- afsk/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index 35e2ae39..2bb8ba99 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -527,7 +527,7 @@ if (cw_id == ON) // Don't send CW if using AX5043 or in mode cycling or set by 3 #ifdef DEBUG_LOGGING printf("Tx LED On\n"); #endif -printf("Before cmd\n"); +//printf("Before cmd\n"); //printf("CW String: %s\n", cw_str); // FILE* f; system(cw_str); @@ -829,14 +829,14 @@ for (int j = 0; j < frameCnt; j++) #ifdef DEBUG_LOGGING printf("Tx LED On\n"); #endif -printf("Before cmd\n"); -printf("CW telem String: %s\n", cw_str2); +//printf("Before cmd\n"); +//printf("CW telem String: %s\n", cw_str2); // FILE* f; if (mode == CW) system(cw_str2); // printf("File %d \n", f); // printf("close: %d \n", pclose(f)); // execute command and wait for termination before continuing -printf("After command\n"); +//printf("After command\n"); // sleep(7); //printf("Before Write\n"); digitalWrite (txLed, txLedOn); @@ -853,7 +853,7 @@ printf("After command\n"); #ifdef DEBUG_LOGGING printf("Tx LED On\n"); #endif - fprintf(stderr,"INFO: Transmitting X.25 packet\n"); + fprintf(stderr,"INFO: Transmitting X.25 packet using AX5043\n"); memcpy(data, str, strnlen(str, 256)); int ret = ax25_tx_frame(&hax25, &hax5043, data, strnlen(str, 256)); if (ret) { @@ -907,7 +907,7 @@ printf("After command\n"); } -printf("End of get_tlm and rpitx =========================================================\n"); +//printf("End of get_tlm and rpitx =========================================================\n"); digitalWrite (txLed, txLedOff); #ifdef DEBUG_LOGGING From 0beb5e7d1d6f707cc97f569032ecc9eb1c3cb331 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 22 Jul 2020 10:43:18 -0400 Subject: [PATCH 096/102] Update README.md --- systemd/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/systemd/README.md b/systemd/README.md index 3d4ea7e2..85b7d95f 100644 --- a/systemd/README.md +++ b/systemd/README.md @@ -7,10 +7,15 @@ sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.s sudo systemctl enable cubesatsim +sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service + +sudo systemctl enable rpitx + Reboot to start the autoboot service: sudo reboot now -Now after the Pi starts up, the demo.sh script will run automatically, and the console will log to ~/CubeSatSim/log.txt To see it: +Now after the Pi starts up, the demo.sh script will run automatically, to see the console: + +sudo journalctl -u cubesatsim -tail ~/CubeSatSim/log.txt From 4672c39ab17123539be6e728e71494a05f51ea41 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 22 Jul 2020 10:43:31 -0400 Subject: [PATCH 097/102] Delete demo.service --- systemd/demo.service | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 systemd/demo.service diff --git a/systemd/demo.service b/systemd/demo.service deleted file mode 100644 index 731f5e26..00000000 --- a/systemd/demo.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Test demo service - -[Service] -TimeoutStopSec=5 -EnvironmentFile=/home/pi/CubeSatSim/.mode -ExecStart=/home/pi/CubeSatSim/demo.sh $ARG1 -WorkingDirectory=/home/pi/CubeSatSim -StandardOutput=inherit -StandardError=inherit -Restart=always -User=root - -[Install] -WantedBy=default.target From 46c5c0eba07a9b7bfb2e82e309da472ce06a72b9 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 22 Jul 2020 10:43:41 -0400 Subject: [PATCH 098/102] Delete test.service --- systemd/test.service | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 systemd/test.service diff --git a/systemd/test.service b/systemd/test.service deleted file mode 100644 index 4573edf0..00000000 --- a/systemd/test.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Test service - -[Service] -EnvironmentFile=/home/pi/CubeSatSim/.progconfig -ExecStart=/home/pi/CubeSatSim/radioafsk $ARG1 $ARG2 $ARG3 -WorkingDirectory=/home/pi/CubeSatSim -StandardOutput=inherit -StandardError=inherit -Restart=always -User=root - -[Install] -WantedBy=default.target From 6fd23d7a4e1d9a748f169789d8f7f5c8d5f921ff Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 22 Jul 2020 10:47:08 -0400 Subject: [PATCH 099/102] Update README.md --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7d4b2b08..143f9e6a 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,9 @@ Create a sim.cfg configuration file with your amateur radio callsign (in all cap `echo "callsign" >> sim.cfg` -`echo >> .mode` +`echo "ARG1=f" >> .mode` +This will set the telemetry mode to FSK. To set it to AFSK or BPSK, change it to ARG1=a or ARG1=b Compile the code: `make rebuild` @@ -143,13 +144,13 @@ Now reboot for all the changes to take effect: After rebooting, tune your radio or SDR to 434.9 MHz FM, and you should receive telemetry from the CubeSatSim! The green LED will be on when the CubeSatSim software is running. The red LED when charging is occuring either through the micro USB or through the solar panels. The blue LED will illuminate when the CubeSatSim is transmitting. -The demo.sh script alternates between two modes: -1. Continuous FSK telmetry, decodeable by FoxTelem -2. Alternativing between APRS AFSK, FSK, and BPSK telemetry +You can change the telemetry mode using the pushbutton or in the command line. Edit the .mode file and change the value to change the mode, then restart the cubesatsim service. + +`sudo systemctl restart cubesatsim` Pressing and releasing the push button will cause the Pi to reboot and change mode. The green LED will go off as it reboots. -Pressing and holding the pushbutton for 3 seconds will cause the green LED to flash, then the Pi will shutdown. The RBF pin can then be safely inserted. Removing the RBF pin or pressing the push button will cause the Pi to start. +Pressing and holding the pushbutton for 6 seconds will cause the green LED to slowly flash, then the Pi will shutdown. The RBF pin can then be safely inserted. Removing the RBF pin or pressing the push button will cause the Pi to start. You can stop the service when it is running by SSH into the Pi and typing: From 78b3af338ecd99f8ef2d8cd3aea11b354bb5f4a6 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 22 Jul 2020 13:51:10 -0400 Subject: [PATCH 100/102] Update README.md --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 143f9e6a..6f17989e 100644 --- a/README.md +++ b/README.md @@ -144,13 +144,21 @@ Now reboot for all the changes to take effect: After rebooting, tune your radio or SDR to 434.9 MHz FM, and you should receive telemetry from the CubeSatSim! The green LED will be on when the CubeSatSim software is running. The red LED when charging is occuring either through the micro USB or through the solar panels. The blue LED will illuminate when the CubeSatSim is transmitting. +The push button with the pi-power-button software will cause the Pi to reboot, change telemetry mode, or shutdown. Pressing and holding the pushbutton will make the green power LED blink first once, then two times, then three times, then blinks slowly. Depending on when you release the button, different things will happen. Here's what happens if you: + +Press and release (don't hold button in at all): reboots CubeSatSim. The green LED will go out, and after 30 seconds, the CubeSatSim will be transmitting again. +Press and release after one blink of green LED: switches to AFSK telemetry mode. After about 5 seconds, the telemetry mode will switch to AFSK. +Press and release after two blinks of green LED: switches to FSK mode. After about 5 seconds, the telemetry mode will switch to FSK. +Press and release after three blinks of green LED: switches to BPSK mode. After about 5 seconds, the telemetry mode will switch to BPSK. +Press and release after green LED begins slow blinking: shuts down CubeSatSim. + +Once the CubeSatSim shuts down, the RBF pin can then be safely inserted. Removing the RBF pin or pressing the push button will cause the CubeSatSim to start up again. It will use the same mode it was running when it was shutdown. + You can change the telemetry mode using the pushbutton or in the command line. Edit the .mode file and change the value to change the mode, then restart the cubesatsim service. `sudo systemctl restart cubesatsim` -Pressing and releasing the push button will cause the Pi to reboot and change mode. The green LED will go off as it reboots. - -Pressing and holding the pushbutton for 6 seconds will cause the green LED to slowly flash, then the Pi will shutdown. The RBF pin can then be safely inserted. Removing the RBF pin or pressing the push button will cause the Pi to start. +Note that to get FoxTelem to decode BPSK, you need to be in BPSK Fox/Husky mode (depending on which version of FoxTelem). Also, you usually need to click on the center of the FFT. For the first 30 seconds, it is just a carrier, so there will be no lock. After that, it should lock and the Phasor will show a line that jumps around, and the Frame count should start increasing at the bottom of the FoxTelem window. You can stop the service when it is running by SSH into the Pi and typing: From 365c3215bf6ddd1f012c0068104c866ac2a2cb6e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 22 Jul 2020 13:54:56 -0400 Subject: [PATCH 101/102] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 6f17989e..cbd110e2 100644 --- a/README.md +++ b/README.md @@ -147,9 +147,13 @@ After rebooting, tune your radio or SDR to 434.9 MHz FM, and you should receive The push button with the pi-power-button software will cause the Pi to reboot, change telemetry mode, or shutdown. Pressing and holding the pushbutton will make the green power LED blink first once, then two times, then three times, then blinks slowly. Depending on when you release the button, different things will happen. Here's what happens if you: Press and release (don't hold button in at all): reboots CubeSatSim. The green LED will go out, and after 30 seconds, the CubeSatSim will be transmitting again. + Press and release after one blink of green LED: switches to AFSK telemetry mode. After about 5 seconds, the telemetry mode will switch to AFSK. + Press and release after two blinks of green LED: switches to FSK mode. After about 5 seconds, the telemetry mode will switch to FSK. + Press and release after three blinks of green LED: switches to BPSK mode. After about 5 seconds, the telemetry mode will switch to BPSK. + Press and release after green LED begins slow blinking: shuts down CubeSatSim. Once the CubeSatSim shuts down, the RBF pin can then be safely inserted. Removing the RBF pin or pressing the push button will cause the CubeSatSim to start up again. It will use the same mode it was running when it was shutdown. From 1746191ae070930eb9e51d3fdcab6ad522203d16 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 22 Jul 2020 13:58:14 -0400 Subject: [PATCH 102/102] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cbd110e2..3915e4c3 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ Press and release after green LED begins slow blinking: shuts down CubeSatSim. Once the CubeSatSim shuts down, the RBF pin can then be safely inserted. Removing the RBF pin or pressing the push button will cause the CubeSatSim to start up again. It will use the same mode it was running when it was shutdown. -You can change the telemetry mode using the pushbutton or in the command line. Edit the .mode file and change the value to change the mode, then restart the cubesatsim service. +You can also change the telemetry mode using the command line. Edit the CubeSatSim/.mode file and change the value to change the mode. A value of ARG1=a will give you AFSK, ARG1=f will give you FSK, and ARG2=b gives BPSK. After saving the .mode file, restart the cubesatsim service to switch the mode by typing: `sudo systemctl restart cubesatsim`