Antenna switching

From SatNOGS Wiki

Sometimes it is necessary / useful to be able to switch between different antennas. In this way the observations can take place on different bands, or it is useful to have only one feeder, with excellent performance in terms of attenuation, from the antennas to the receiver.

Read carefully the full thread in [ ], where it's possible to find different solutions, ranging from "parallel" control exploited via GPIO pins, to "serial" solution via USB connection or via RS485 (under tests) for longer physical connections.

Several parts (software & hardware) are necessary to activate this kind of control. Once the type of control has been established there are some software setting to be done, mainly to write scripts which will be performed before and after the observations.

Firstly, run 'sudo satnogs-setup' , then into "Advanced" section edit the parameter SATNOGS_PRE_OBSERVATION_SCRIPT to <path_to_script> -f {{ FREQ }}.

In the same manner in satnogs-setup set the parameter SATNOGS_POST_OBSERVATION_SCRIPT to <path_to_script>

This, for example, is the content of and, invoked by the client to switch the correct antenna using an USB serial connection. Pay attention to the exact syntax and to the following described permissions on scripts and users:

  • : called just before observation starts, set the right antenna and write to the local satnogs log.

#set the ports up to known state and disable close between calls
stty -F /dev/ttyUSB0 9600 -hupcl

date=`date +"%d/%m/%y %H:%M:%S %Z"`

while getopts f: option
case "${option}"
f) freq=${OPTARG};;

if ([ $freq -ge 399900000 ] && [ $freq -lt 470000000 ]) ;
    echo "$date --> 399.9 to 470 frequency, ANT0 selected" >> /home/pi/tests/satnogs_log.txt
    echo -e "ANT0\n" > /dev/ttyUSB0

if ([ $freq -ge 136000000 ] && [ $freq -lt 150100000 ]) ;
    echo "$date --> 136 to 150.1 frequency, ANT1 selected" >> /home/pi/tests/satnogs_log.txt
    echo -e "ANT1\n" > /dev/ttyUSB0

if ([ $freq -ge 24000000 ] && [ $freq -lt 30000000 ]) ;
    echo "$date --> 24 to 30 frequency, ANT2 selected" >> /home/pi/tests/satnogs_log.txt
    echo -e "ANT2\n" > /dev/ttyUSB0

  • : called at observation end, puts RF relays in ‘deactivated’ position and to setup a know switch position.

# disable all relays... no power waste!

date=`date +"%d/%m/%y %H:%M:%S %Z"`
echo -e "ANT0\n" > /dev/ttyUSB0
echo "$date antenna switch reset " >> /home/pi/tests/satnogs_log.txt

Please take note about the following mandatory permissions, because the scripts are executed as “satnogs” user:

  • sudo usermod -a -G dialout satnogs, to access serial device by satnogs user
  • sudo usermod -a -G pi satnogs, to permit execution to satnogs as member of pi group
  • touch satnogs_log.txt, to create the log file
  • chmod 666 satnogs_log.txt, to permit everybody writing on this file
  • chmod +x, set script to be executable
  • chmod +x, set script to be executable

To test the whole stuff try to execute:

./ -f 435000000


tail ./satnogs_log.txt

and satnogs_log.txt should contain something like:

18/02/21 12:15:25 GMT --> 399.9 to 470 frequency, ANT0 selected
18/02/21 12:30:23 GMT antenna switch reset