Antenna Switching project


#1

Here is a brief description of an automatic antenna switching project that uses the pre-observation script. You will need the pre/post observation modifications implemented by Chibill for this to work (see the mods at https://gitlab.com/librespacefoundation/satnogs/satnogs-client/blob/0/satnogsclient/observer/observer.py particularly those around the pre and post observation parts with the variables being passed to the scripts). For this to work you need to install wiring-pi which you can do with sudo apt-get install wiringpi

Firstly, run sudo satnogs-setup, go into advanced and set parameter SATNOGS_PRE_OBSERVATION_SCRIPT to /home/pi/preob.sh -f {{FREQ}}

Set parameter SATNOGS_POST_OBSERVATION_SCRIPT to /home/pi/postob.sh

Create file /home/pi/preob.sh with the following contents:

#!/bin/bash
#set the ports up and to known state
gpio mode 21 out
gpio mode 22 out
gpio mode 23 out
gpio mode 24 out
gpio write 21 0
gpio write 22 0
gpio write 23 0
gpio write 24 0

date=`date +%F" "%T`
freq=0

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

if ([ $freq -ge 136000000 ] && [ $freq -lt 139000000 ]) ;
then
    echo "$date 136 to 138 selected" >> /home/pi/freqset.txt
    gpio write 23 0
fi

if ([ $freq -ge 144000000 ] && [ $freq -lt 146000000 ]) ;
then
    echo "$date 144 to 146 selected" >> /home/pi/freqset.txt
    gpio write 23 0
fi

if ([ $freq -ge 399900000 ] && [ $freq -lt 405000000 ]) ;
then
    echo "$date 399.9 to 405 selected" >> /home/pi/freqset.txt
    gpio write 23 1
fi

if ([ $freq -ge 430000000 ] && [ $freq -lt 440000000 ]) ;
then
    echo "$date 430 to 440 selected" >> /home/pi/freqset.txt
    gpio write 23 1
fi

if ([ $freq -ge 460000000 ] && [ $freq -lt 470000000 ]) ;
then
    echo "$date 460 to 470 selected" >> /home/pi/freqset.txt
    gpio write 23 1
fi
done

write the file, then chmod +x /home/pi/preob.sh and chown satnogs:satnogs /home/pi/preob.sh

Create file /home/pi/postob.sh with the following contents:

#!/bin/bash
gpio write 21 1
sleep .2
gpio write 21 0
sleep .2
gpio write 22 1
sleep .2
gpio write 22 0
sleep .2
gpio write 23 1
sleep .2
gpio write 23 0
sleep .2
gpio write 24 1
sleep .2
gpio write 24 0
sleep .2
echo "Antenna switch reset" >> /home/pi/freqset.txt

write the file, then chmod +x /home/pi/postob.sh and chown satnogs:satnogs /home/pi/postob.sh - the post observation script is designed to cycle the relays to make sure the contacts are kept ‘fresh’ and losses minimized.

touch /home/pi/freqset.txt and chown it to satnogs:satnogs - this is the log file for antenna switching.

The picture above shows the basics of the switcher. I’ve tried to use parts that you can go and buy from eBay. Search for 4 channel optocoupler to find the above board. For coax relays, use something appropriate to the bands you want to switch. I used MD951 relays because they were in the junk box, you could push the boat out and use a nice SMA 18GHz multipole relay. Once you have the hardware installed, test it by writing to the various GPIO pins. I soldered an LED + 1.2K resistor across each of the relay coils as an easy way to see the various status’s of each relay.

Modify the /home/pi/preob.sh script to suite your frequency bands, and adjust the GPIO outputs to toggle the appropriate relay. There is scope for additional control such as switching in a down converter, toggling voltage up the coax to power LNA’s etc. If you make the above script better, please publish it on this thread - thanks.

The above picture shows the implementation here. 3 coax relays can be seen in the background, these are interconnected with semi-rigid 50 ohm coax. The right had relay connects to the SDR and selects the outputs of the pair of input select relays. The bottom relay is currently used to switch between VHF and UHF. The top relay will be used to select L-Band and probably S-Band IF. It is possible to add another relay using the spare opto-isolated port on the board, this could be for switching between two VHF antennas where losses will be less than at L-Band etc.

Any questions, please ping me in the @satnogs IRC, my nick is pjm.

I hope this is useful and some of you build it to expand your stations capabilities.

Paul M0EYT - Station #91


Ground Station Hardaware - Report
#2

Hopefully eventually the MR will be merged in to the current stuff. :slight_smile:


#3

Hi chilbill. I have a few small micro antenna relays, 3 in each sealed unit, and a handfull of Arduinos that I need to use for something.

If I could get the Arduino to read the antenna id codes, especially from the I/O pin from the RPI3, then the Arduino could switch many antennas and combinations as needed.

Would you be willing to discuss this change in your project?

bob
w4ush


#4

For reference the MR was

And is currently part of the main code.

Want to add relevant information for if people search this up.