<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.satnogs.org/index.php?action=history&amp;feed=atom&amp;title=Antenna_switching</id>
	<title>Antenna switching - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.satnogs.org/index.php?action=history&amp;feed=atom&amp;title=Antenna_switching"/>
	<link rel="alternate" type="text/html" href="https://wiki.satnogs.org/index.php?title=Antenna_switching&amp;action=history"/>
	<updated>2026-04-20T08:43:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>https://wiki.satnogs.org/index.php?title=Antenna_switching&amp;diff=3733&amp;oldid=prev</id>
		<title>Vittorio at 14:17, 15 March 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.satnogs.org/index.php?title=Antenna_switching&amp;diff=3733&amp;oldid=prev"/>
		<updated>2021-03-15T14:17:22Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 14:17, 15 March 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot; &gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Several parts (software &amp;amp;amp; 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.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Several parts (software &amp;amp;amp; 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.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Firstly, run 'sudo satnogs-setup' , then into &amp;amp;quot;Advanced&amp;amp;quot; section edit the parameter &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;SATNOGS&lt;/del&gt;''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;PRE&lt;/del&gt;''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;OBSERVATION&lt;/del&gt;''SCRIPT to &amp;amp;lt;path_''to_script&amp;amp;gt;preob.sh -f &amp;lt;nowiki&amp;gt;{{ FREQ }}&amp;lt;/nowiki&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Firstly, run 'sudo satnogs-setup' , then into &amp;amp;quot;Advanced&amp;amp;quot; section edit the parameter &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;SATNOGS_&lt;/ins&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;PRE_&lt;/ins&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;OBSERVATION_&lt;/ins&gt;''SCRIPT to &amp;amp;lt;path_''to_script&amp;amp;gt;preob.sh -f &amp;lt;nowiki&amp;gt;{{ FREQ }}&amp;lt;/nowiki&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the same manner in satnogs-setup set the parameter &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;SATNOGS&lt;/del&gt;''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;POST&lt;/del&gt;''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;OBSERVATION&lt;/del&gt;''SCRIPT to &amp;amp;lt;path''_to_script&amp;amp;gt;postob.sh&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the same manner in satnogs-setup set the parameter &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;SATNOGS_&lt;/ins&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;POST_&lt;/ins&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;OBSERVATION_&lt;/ins&gt;''SCRIPT to &amp;amp;lt;path''_to_script&amp;amp;gt;postob.sh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This, for example, is the content of preob.sh and postob.sh, 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:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This, for example, is the content of preob.sh and postob.sh, 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:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l67&quot; &gt;Line 67:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 67:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*&amp;lt;code&amp;gt;chmod +x preob.sh&amp;lt;/code&amp;gt;, set script to be executable&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*&amp;lt;code&amp;gt;chmod +x preob.sh&amp;lt;/code&amp;gt;, set script to be executable&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*&amp;lt;code&amp;gt;chmod +x postob.sh&amp;lt;/code&amp;gt;, set script to be executable&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*&amp;lt;code&amp;gt;chmod +x postob.sh&amp;lt;/code&amp;gt;, set script to be executable&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Vittorio</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.satnogs.org/index.php?title=Antenna_switching&amp;diff=3731&amp;oldid=prev</id>
		<title>Vittorio: Created page with &quot;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 onl...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.satnogs.org/index.php?title=Antenna_switching&amp;diff=3731&amp;oldid=prev"/>
		<updated>2021-03-15T13:55:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;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 onl...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;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.&lt;br /&gt;
&lt;br /&gt;
Read &amp;lt;u&amp;gt;carefully&amp;lt;/u&amp;gt; the full thread in [ https://community.libre.space/t/antenna-switching-project/2311 ], where it's possible to find different solutions, ranging from &amp;amp;quot;parallel&amp;amp;quot; control exploited via GPIO pins, to &amp;amp;quot;serial&amp;amp;quot; solution via USB connection or via RS485 (under tests) for longer physical connections.&lt;br /&gt;
&lt;br /&gt;
Several parts (software &amp;amp;amp; 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.&lt;br /&gt;
&lt;br /&gt;
Firstly, run 'sudo satnogs-setup' , then into &amp;amp;quot;Advanced&amp;amp;quot; section edit the parameter SATNOGS''PRE''OBSERVATION''SCRIPT to &amp;amp;lt;path_''to_script&amp;amp;gt;preob.sh -f &amp;lt;nowiki&amp;gt;{{ FREQ }}&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In the same manner in satnogs-setup set the parameter SATNOGS''POST''OBSERVATION''SCRIPT to &amp;amp;lt;path''_to_script&amp;amp;gt;postob.sh&lt;br /&gt;
&lt;br /&gt;
This, for example, is the content of preob.sh and postob.sh, 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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''preob.sh''' : called just before observation starts, set the right antenna and write to the local satnogs log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;pre class=&amp;quot;&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
#set the ports up to known state and disable close between calls&lt;br /&gt;
stty -F /dev/ttyUSB0 9600 -hupcl&lt;br /&gt;
&lt;br /&gt;
date=`date +&amp;amp;quot;%d/%m/%y %H:%M:%S %Z&amp;amp;quot;`&lt;br /&gt;
freq=0&lt;br /&gt;
&lt;br /&gt;
while getopts f: option&lt;br /&gt;
do&lt;br /&gt;
case &amp;amp;quot;${option}&amp;amp;quot;&lt;br /&gt;
in&lt;br /&gt;
f) freq=${OPTARG};;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
if ([ $freq -ge 399900000 ] &amp;amp;amp;&amp;amp;amp; [ $freq -lt 470000000 ]) ;&lt;br /&gt;
then&lt;br /&gt;
    echo &amp;amp;quot;$date --&amp;amp;gt; 399.9 to 470 frequency, ANT0 selected&amp;amp;quot; &amp;amp;gt;&amp;amp;gt; /home/pi/tests/satnogs_log.txt&lt;br /&gt;
    echo -e &amp;amp;quot;ANT0\n&amp;amp;quot; &amp;amp;gt; /dev/ttyUSB0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if ([ $freq -ge 136000000 ] &amp;amp;amp;&amp;amp;amp; [ $freq -lt 150100000 ]) ;&lt;br /&gt;
then&lt;br /&gt;
    echo &amp;amp;quot;$date --&amp;amp;gt; 136 to 150.1 frequency, ANT1 selected&amp;amp;quot; &amp;amp;gt;&amp;amp;gt; /home/pi/tests/satnogs_log.txt&lt;br /&gt;
    echo -e &amp;amp;quot;ANT1\n&amp;amp;quot; &amp;amp;gt; /dev/ttyUSB0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if ([ $freq -ge 24000000 ] &amp;amp;amp;&amp;amp;amp; [ $freq -lt 30000000 ]) ;&lt;br /&gt;
then&lt;br /&gt;
    echo &amp;amp;quot;$date --&amp;amp;gt; 24 to 30 frequency, ANT2 selected&amp;amp;quot; &amp;amp;gt;&amp;amp;gt; /home/pi/tests/satnogs_log.txt&lt;br /&gt;
    echo -e &amp;amp;quot;ANT2\n&amp;amp;quot; &amp;amp;gt; /dev/ttyUSB0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
done&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''postob.sh''' : called at observation end, puts RF relays in ‘deactivated’ position and to setup a know switch position.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;pre class=&amp;quot;&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
# disable all relays... no power waste!&lt;br /&gt;
&lt;br /&gt;
date=`date +&amp;amp;quot;%d/%m/%y %H:%M:%S %Z&amp;amp;quot;`&lt;br /&gt;
echo -e &amp;amp;quot;ANT0\n&amp;amp;quot; &amp;amp;gt; /dev/ttyUSB0&lt;br /&gt;
echo &amp;amp;quot;$date antenna switch reset &amp;amp;quot; &amp;amp;gt;&amp;amp;gt; /home/pi/tests/satnogs_log.txt&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please take note about the following mandatory permissions, because the scripts are executed as “satnogs” user:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;sudo usermod -a -G dialout satnogs&amp;lt;/code&amp;gt;, to access serial device by satnogs user&lt;br /&gt;
*&amp;lt;code&amp;gt;sudo usermod -a -G pi satnogs&amp;lt;/code&amp;gt;, to permit execution to satnogs as member of pi group&lt;br /&gt;
*&amp;lt;code&amp;gt;touch satnogs_log.txt&amp;lt;/code&amp;gt;, to create the log file&lt;br /&gt;
*&amp;lt;code&amp;gt;chmod 666 satnogs_log.txt&amp;lt;/code&amp;gt;, to permit everybody writing on this file&lt;br /&gt;
*&amp;lt;code&amp;gt;chmod +x preob.sh&amp;lt;/code&amp;gt;, set script to be executable&lt;br /&gt;
*&amp;lt;code&amp;gt;chmod +x postob.sh&amp;lt;/code&amp;gt;, set script to be executable&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To test the whole stuff try to execute:&amp;lt;pre class=&amp;quot;&amp;quot;&amp;gt;./preob.sh -f 435000000&lt;br /&gt;
&lt;br /&gt;
./postob.sh&lt;br /&gt;
&lt;br /&gt;
tail ./satnogs_log.txt&amp;lt;/pre&amp;gt;and satnogs_log.txt should contain something like:&amp;lt;pre class=&amp;quot;&amp;quot;&amp;gt;18/02/21 12:15:25 GMT --&amp;amp;gt; 399.9 to 470 frequency, ANT0 selected&lt;br /&gt;
18/02/21 12:30:23 GMT antenna switch reset &amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vittorio</name></author>
		
	</entry>
</feed>