Channel Steering using the
RPi or USB FOB GPIO
Many radios allow "channel Steering" or the ability to change the operating frequency using bit manipulation. This is often done by using BCD (Binary Coded Decimal) input the the radio. BCD uses 1,2,4,8,16 bit coding. One bit would give 2 channels, 2 bits 4 channels, 3 bits 8 channels, 4 bits 16 channels, etc. When using Allstar the user has two readily available methods to manipulate the radio bits, the Raspberry Pi GPIO or the USB FOB GPIO. The Pi has many GPIO bits available but they are strictly 3V levels so some means of interfacing to a 5V TTL or other radio input would be necessary. The USB FOBs that use the CM119x chips have 8 bits of I/O with at least one used by Allstar for PTT. However not all interfaces bring out the bits to a convenient connector. The DMK-URI does so it would work nicely for a channel steering system. The CM119x chips are also 3V or 5V compliant so in most case interfacing would be easy.
Channel steering gives you the ability to change the frequency (channel) of a radio from a remote location. This could be done via DTMF or ssh commands.
What you need to channel steer
Of course you will need a radio that is steerable, a script to create the BCD codes from a decimal number and send them via GPIO to the radio, and cabling and a possibly a level changing interface between the GPIO and the radio.
The most simple form of interface is where 5V TTL lines are used at both the radio and the GPIO source. This would often be the case when using the USB FOB and many of the BCD steerable radios that are out there but check the voltage on the radio inputs. If it is greater than 5V you will need to use an interfacing method of some kind. If both the output and input are 5V compatible the lines could just be connected together outputs to inputs. For Pi GPIO I would recommend an interface such as the 74AHCT125 - Quad Level-Shifter (3V to 5V) This chip is available from Adafruit for $1.50 and also other sources. It is cheap insurance as a buffer between 3V and 5V logic.
I have written two scipts available in the hamvoip V1.5 image as of a 1-22-2018 update. bcd_control_pi.sh is for the Pi GPIO and bcd_control_usb_fob.sh is for the CM119x USB FOBs. They work in a similar fashion but output through the different GPIO's. Both have user configurable sections at the beginning of the script that allow you to set the number of bits (1-4) and the bit mapping - which BCD bits are mapped to the available GPIO bits, 1248 BCD to actual GPIO bit. The bit pattern can also be inverted if this is necessary for the radio or interface. The Pi GPIO script allows a 5th strobe bit. Both have the option of announcing the channel change on the local Allstar audio. Input formats for the scripts are -
bcd_control_pi.sh <channel> <node>
bcd_control_usb_fob.sh <channel> <node>
In both cases the node number is optional. If it is not specified the script uses the first node on the system defined as NODE1.
The USB FOB method also requires some initialization lines be added to you simpleusb.conf script. This required lines are defined in the script. The Pi version uses the installed 'gpio' program to set and reset the bit patterns. Users can use the 'gpio readall' command to view the bits and associted pin numbers.
Commanding the script
The scripts can be commanded directly from Linux and that is a good way to test but not very practical in actual use. To use DTMF commands to control the channel you will need to add statements in the [functions] stanza of /etc/asterisk/rpt.conf for the node you are controlling. Here is an example:
831=cmd,/etc/asterisk/local/bcd_control.sh 1 <node>
832=cmd,/etc/asterisk/local/bcd_control.sh 2 <node>
833=cmd,/etc/asterisk/local/bcd_control.sh 3 <node>
etc. (add codes for all desired channels)
The node is optional. It assumes your first node in rpt.conf. Using these examples sending a DTMF sequence of *831 would switch the radio to channel 1.
Another method of doing this can be achieved using a variation of the Allstar autopatch. See this howto for more information -
Here are some links and additional information on this topic.
The USB GPIO script will allow more than one radio interface to be controlled while the Pi GPIO method only supports one. To control more than one radio using the Pi GPIO method the script would need to be modified and more GPIO bits would need to be assigned on the PI GPIO. While the Pi method is presented the preferred way would be to use the USB GPIO method as this brings all signals in the case of the DMK-URI from one connector to the radio. It would be a much cleaner installation.
The Radius models with "LRA7" in the middle of the model number can do 3 bits of channel steering in the same way that the GM300 does 4 bits. Example: DnnLRA7nnnaa where "n" is a number and "a" is a letter)
© 2018 - WA3DSP