Command and Control - alanbjohnston/CubeSatSim GitHub Wiki
Satellite Command and Control refers to the ability to connect, usually over radio, with a satellite and upload commands, settings, schedule operations and experiments, and other functions. For demonstrations, the CubeSatSim has a pushbutton that can be used to change modes or shut down.
The Beta v1.3.2 CubeSatSim can now support radio Command and Control using a FM transmitter in the UHF band, sending either a carrier signal, or DTMF tones or APRS packets.
Carrier (or squelch) Command and Control does not require any additional hardware, as it uses the squelch pin on the FM transceiver to detect a command.
This is built into the latest beta release, but it needs some extra hardware and updated software.
If you have the STEM Payload v1.3.2.3 PCB which looks like this:
Then you will need these three parts:
- USB sound card that plugs into the Pi Zero https://www.amazon.com/dp/B00IRVQ0F8/
- OTG cable that plugs into the micro USB on the Pi Zero and the sound card plugs into it https://www.amazon.com/dp/B0BX9FSCFH/
- 2.5mm to 3.5mm jumper https://www.amazon.com/dp/B07QLFNKTF/
The 2.5mm jumper plugs into J13 (mislabeled as J3) on the v1.3.2.3 STEM Payload board.
If you have an earlier version of the PCB, you can still add this capability with a 3.5mm plug soldered onto the Solar PCB. You won't need the 2.5mm to 3.5mm jumper, but instead will make a 3.5mm plug out of a JST wire with these parts:
- 3.5mm plug (same as the RBF plug) https://www.digikey.com/product-detail/en/cui-devices/MP-3502/102-4775-ND/9486669
- JST jumper wire (same as the ones soldered on the solar panels), although any pair of wires will work.
Cut off the JST connector and discard.
Solder the red wire to the center of the plug and the black wire to the outside of the plug.
On the top of the Solar PCB, solder the red wire to GPIO pin 24 and the black wire to GPIO pin 20:
This 3.5mm plug is plugged into the Microphone jack of the USB sound card (pink connector).
Plug the USB sound card into the USB side of the OTG cable. Plug the 3.5mm side of the jumper cable into the Microphone connector (pink connector). Plug the micro USB side of the OTG cable into the Pi Zero micro USB connector (NOT the Power micro USB connector!)
Plug the 2.5mm side of the jumper cable into the jack on the STEM Payload PCB:
Here's how it looks on the bottom of the board stack:
And the top of the board stack:
If you have the older STEM Payload board, it will look like this:
You will likely need to update your CubeSatSim software on the Pi Zero to the latest version by logging in and typing this command:
CubeSatSim/update
Alternatively, if you download the v1.3.2.4 Raspberry Pi image, it will have the software already installed: http://cubesatsim.org/download/cubesatsim-v1.3.2.4.iso.zip
Command and Control is off by default. It can be turned on by using the Pi Zero command:
CubeSatSim/config -T
This will default to the Carrier (squelch) command and control. Any carrier signal at the receive frequency (set by the CubeSatSim/config -F
command) will result in the CubeSatSim switching to the next mode (e.g. mode 2 will change to mode 3). Here is the sequence:
APRS (mode 1) -> FSK (mode 2) -> BPSK (mode 3) -> SSTV (mode 4) -> CW (mode 5) -> APRS (mode 1)
IMPORTANT NOTE: Command and Control messages can only be received when the CubeSatSim is not transmitting FM. Here's what that means for these modes. You can transmit Command and Control when:
- If the blue transmit LED is of or you can't hear the signal on a radio in APRS, SSTV, and CW modes.
- Anytime in FSK or BPSK modes since these modes aren't FM.
To change to the DTMF or APRS command and control, use this command:
CubeSatSim/config -d
Note that if no USB sound card is detected, the code will check if an RTL-SDR dongle is plugged into the Pi Zero. If it is, it will use the RTL-SDR. If not, there is no Command and Control.
Once running, you can check the Command and Control logs with this command:
CubeSatSim/log -c
Here are the commands in DTMF and APRS.
DTMF commands are sent by transmitting FM (pressing and holding the PTT on your radio) on the receive frequency, then pressing a number (1 - 5 for the five modes) and then '#' (pound) - you will hear two tones transmitted.
To select APRS mode, transmit DTMF 1#
To select FSK mode, transmit DTMF 2#
To select BPSK mode, transmit DTMF 3#
To select SSTV mode, transmit DTMF 4#
To select CW mode, transmit DTMF 5#
To turn transmission of telemetry on or off, transmit DTMF 10#
For APRS packet commands, anywhere in the packet should be the message Mode=x where x is either a, f, b, s, m for the five modes, or o to turn telemetry on or off.
Here are the APRS commands:
To select APRS mode, transmit an APRS packet with `MODE=a` somewhere in it
To select FSK mode, transmit an APRS packet with `MODE=f` somewhere in it
To select BPSK mode, transmit an APRS packet with `MODE=b` somewhere in it
To select SSTV mode, transmit an APRS packet with `MODE=s` somewhere in it
To select CW mode, transmit an APRS packet with `MODE=m` somewhere in it
To turn transmission of telemetry on or off, transmit an APRS packet with `MODE=o` somewhere in it where o is the Letter O.
Here is an example log output (CubeSatSim/log -c
) showing both APRS and DTMF commands received:
Jul 31 09:19:46 cubesatsim2 command[250]: Command and Control script for CubeSatSim v1.3.2
Jul 31 09:19:46 cubesatsim2 command[250]: Radio command and control is ON
Jul 31 09:19:46 cubesatsim2 command[250]: Waiting 20 seconds for USB
Jul 31 09:20:06 cubesatsim2 command[250]: Starting Direwolf DTMF and APRS Command and Control
Jul 31 09:20:06 cubesatsim2 command[516]: Dire Wolf version 1.5
Jul 31 09:20:06 cubesatsim2 command[516]: Reading config file /home/pi/CubeSatSim/direwolf-cc.conf
Jul 31 09:20:06 cubesatsim2 command[516]: Audio input device for receive: hw:CARD=Device,DEV=0 (channel 0)
Jul 31 09:20:06 cubesatsim2 command[516]: Audio out device for transmit: default (channel 0)
Jul 31 09:20:06 cubesatsim2 command[516]: Channel 0: 1200 baud, AFSK 1200 & 2200 Hz, E+, 44100 sample rate / 3, DTMF decoder enabled.
Jul 31 09:20:06 cubesatsim2 command[516]: Note: PTT not configured for channel 0. (Ignore this if using VOX.)
Jul 31 09:20:06 cubesatsim2 command[516]: Ready to accept KISS TCP client application 0 on port 8001 ...
Jul 31 09:20:06 cubesatsim2 command[516]: Ready to accept AGW client application 0 on port 8000 ...
Jul 31 09:23:51 cubesatsim2 command[516]: AMSAT-11 audio level = 169(80/40) [NONE] __|||||||
Jul 31 09:23:51 cubesatsim2 command[516]: Audio input level is too high. Reduce so most stations are around 50.
Jul 31 09:23:51 cubesatsim2 command[516]: [0.5] AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=o<0x0a>
Jul 31 09:23:51 cubesatsim2 command[595]: Beacon Mode toggle!!
Jul 31 09:23:51 cubesatsim2 command[516]: Position, Satellite/Pacsat, Cellular applications
Jul 31 09:23:51 cubesatsim2 command[516]: N 39 01.4000, W 077 04.3900
Jul 31 09:23:51 cubesatsim2 command[516]: hi hi MODE=o
Jul 31 09:23:51 cubesatsim2 command[596]: Beacon Mode toggle!!
Jul 31 09:23:51 cubesatsim2 sudo[598]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/bin/systemctl stop rpitx
Jul 31 09:23:51 cubesatsim2 sudo[598]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:23:51 cubesatsim2 sudo[598]: pam_unix(sudo:session): session closed for user root
Jul 31 09:23:51 cubesatsim2 command[601]: CubeSatSim v1.3.2 configuration tool
Jul 31 09:23:51 cubesatsim2 sudo[602]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/sbin/modprobe snd-aloop
Jul 31 09:23:51 cubesatsim2 sudo[602]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:23:51 cubesatsim2 sudo[602]: pam_unix(sudo:session): session closed for user root
Jul 31 09:23:51 cubesatsim2 command[601]: Change telemetry beacon transmit state
Jul 31 09:23:51 cubesatsim2 command[601]: Transmit beacon telemetry is off
Jul 31 09:23:51 cubesatsim2 command[601]: Turn beacon telemetry ON
Jul 31 09:23:51 cubesatsim2 sudo[605]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/bin/rm /home/pi/CubeSatSim/beacon_off
Jul 31 09:23:51 cubesatsim2 sudo[605]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:23:51 cubesatsim2 sudo[605]: pam_unix(sudo:session): session closed for user root
Jul 31 09:23:51 cubesatsim2 sudo[607]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/bin/systemctl restart rpitx
Jul 31 09:23:51 cubesatsim2 sudo[607]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:23:51 cubesatsim2 sudo[607]: pam_unix(sudo:session): session closed for user root
Jul 31 09:26:37 cubesatsim2 command[516]: DTMF audio level = 189 tt
Jul 31 09:26:37 cubesatsim2 command[516]: Audio input level is too high. Reduce so most stations are around 50.
Jul 31 09:26:37 cubesatsim2 command[516]: [0.dtmf] DTMF>APDW15:t1#
Jul 31 09:26:37 cubesatsim2 command[653]: APRS Mode!!
Jul 31 09:26:38 cubesatsim2 sudo[655]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/bin/systemctl stop rpitx
Jul 31 09:26:38 cubesatsim2 sudo[655]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:26:38 cubesatsim2 sudo[655]: pam_unix(sudo:session): session closed for user root
Jul 31 09:26:38 cubesatsim2 command[658]: CubeSatSim v1.3.2 configuration tool
Jul 31 09:26:38 cubesatsim2 sudo[659]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/sbin/modprobe snd-aloop
Jul 31 09:26:38 cubesatsim2 sudo[659]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:26:38 cubesatsim2 sudo[659]: pam_unix(sudo:session): session closed for user root
Jul 31 09:26:38 cubesatsim2 command[658]: changing CubeSatSim to AFSK mode
Jul 31 09:26:38 cubesatsim2 sudo[662]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/bin/echo a
Jul 31 09:26:38 cubesatsim2 sudo[662]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:26:38 cubesatsim2 sudo[662]: pam_unix(sudo:session): session closed for user root
Jul 31 09:26:38 cubesatsim2 command[658]: Restarting
Jul 31 09:26:38 cubesatsim2 sudo[664]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/bin/systemctl restart cubesatsim
Jul 31 09:26:38 cubesatsim2 sudo[664]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:26:38 cubesatsim2 sudo[664]: pam_unix(sudo:session): session closed for user root
Jul 31 09:26:38 cubesatsim2 sudo[672]: root : PWD=/home/pi/CubeSatSim ; USER=root ; COMMAND=/usr/bin/systemctl restart rpitx
Jul 31 09:26:38 cubesatsim2 sudo[672]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Jul 31 09:26:38 cubesatsim2 sudo[672]: pam_unix(sudo:session): session closed for user root
One way to transmit packet command and control is to use a Quan Sheng radio with updated firmware.
In Direwolf mode (set by CubeSatSim/config -d
), if a USB Sound Card is plugged in, that will be used. If no USB Sound Card is plugged in, an RTL-SDR will be used if plugged in. If no RTL-SDR, then there will be no command and control.
To see the Command and Control log, type:
CubeSatSim/log -c
Using the command CubeSatSim/config -o
you can turn the beacon transmission on or off. The transmission should start or stop within a few seconds.
You can turn transmission on/off using an APRS packet with MODE=o
where o is the lower case letter O. You can also do it with DTMF by 10#
.
You can set the new Transmit Commands Mode with the command CubeSatSim/config -n
The CubeSatSim will not transmit any telemetry in this mode and the green LED will be off. In this mode, changing modes either using the push button or by typing config commands will not change the mode, but will instead transmit the Command and Control message. The default is APRS, but you can use CubeSatSim/config -D
to select DTMF mode which will transmit DTMF instead of APRS.
The blue Transmit LED will go on when a command is being transmitted. Transmission on/off with CubeSatSim/config -o
also will transmit the command for this.
Note that receiving commands via command and control is still enabled, but a received command will cause the CubeSatSim to retransmit that command. So in theory, if the transmit and receive frequencies were set correctly, you could chain 3 or more CubeSatSim so that commands were relayed until the last one acted upon it. You could also have multiple CubeSatSims listening on the same frequency, so one command transmitted could cause multiple CubeSatSims to change mode or turn a beacon on or off.
To exit, Transmit Commands Mode, use CubeSatSim/config -n
again and it will switch back to FSK mode.
The default for transmitting commands is in APRS, but it can be set to DTMF instead using this command:
CubeSatSim/config -D
Now you will hear DTMF instead of APRS being transmitted.
You can change the microphone record level by typing:
CubeSatSim/config -L
And then entering 50 for 50%. Note recommended value is around 45.
If you check the configuration by typing:
CubeSatSim/config
you should see in the list:
RX PL code is: 0
TX PL code is: 0
0 means no PL so Command and Control should work as normal and not require any PL code to be set.
Next, try setting the CubeSatSim RX and TX CTCSS (Continuous Tone-Coded Squelch System) to 67 Hz by setting the RX and TX and PL code to 1 with this command where you enter 1 twice.
CubeSatSim/config -P
One you have done this, after the reboot, you should find Command and Control doesn't work until you set your HT transmit PL to 67 Hz. Then, it should work again.
You can set values of 1-38 for CTCSS, but double check the frequency since the numbers might be off by 1 between your HT and the CubeSatSim due to the 69.3 Hz being code 122 but on my Quan Sheng UV-K5, it is code 2, which results in 71.9 Hz being code 3 on my HT but a value of 2 on the CubeSatSim.
If you enter a PL value in the CubeSatSim/config -P
command in the range 39 - 121 you will set a DCS (Digital-Coded Squelch) number 1 - 83. For example, entering 39 will give you DCS number 1 which is code 23. However, the numbering seems to also be off for my HT, so check the DCS code value. For instance, DCS number 17 or code 116 is actually set with number 19 on my HT.
If you enable CTCSS or CDCSS on your HT receiver, you can verify that the CubeSatSim is transmitting the tone, but you need to be in APRS, SSTV, or CW modes and not in Safe Mode (battery saver) since FSK and BPSK modes do not have CTCSS support right now.
Don't forget to set the PL codes to 0 when you are finished to turn them off!
Here are tables of CTCSS (https://www.hitechwireless.com/ctcss-codes/) and DCS (https://www.buytwowayradios.com/blog/2022/11/chart-of-standard-dcs-codes.html) codes and frequencies.