Friday, March 1, 2024

AllStar Experimentation - South Africa (Part 3)


USING GPIO PINS TO KEY RADIO PTT VIA A HOMEBREW OPTO COUPLER (4N25) BOARD WITH THE RASPBERRY PI 3 B VER 1.2


This short manual discuss the method using the GPIO pins on the Rpi.

  • to indicate TX / RX LED status on a AllStar Node

  • to key PTT via opto coupler board on a AllStar Node.


Warning: Ensure that you connect the LED’s to the correct pins. The GPIO pins are 3.3 volts maximum and output pins have a limited current capability of 16 mA. When interfacing be aware of this because you can damage the PI if you exceed the ratings!! I am not responsible if you damage or destroy your Raspberry Pi!!

I use a 4N25 Opto Coupler, 1 Resistor and 1 Capacitor on Veroboard. I would however add a BAT43 Diode as further protection to the circuit. See image below.


I highlighted the changes in black for keying the homebrew PCB circuit using the GPIO pins.


Go to and open MobaXterm


Check to see if the rc.allstar file is in /usr/local/etc/


cd /usr/local/etc


enter


ls or dir


enter

sudo nano rc.allstar


enter


File will open. Add bold typed info as listed below.


#########################################

#!/bin/bash

#

# This is the startup rc script for allstar asterisk

#

# Rather than changing anything here

# please use the /usr/local/etc/allstar.env file

# for configuration changes.


#Makes gpio pins go to output upon startup

/etc/asterisk/local/write_gpio.sh


# If root profile missing, replace it.

if [ ! -f /root/.bash_profile ] ; then

/usr/bin/cp -f /etc/.bash_profile.backup /root/.bash_profile

fi


# source the allstar variables

if [ -f /usr/local/etc/allstar.env ] ; then

. /usr/local/etc/allstar.env

else

echo " Unable to read /usr/local/etc/allstar.env file."

echo " Asterisk will not start"

exit 1

################################################


Once the bold info is entered


save


ctrl + x


yes


cd


enter


cd /etc/asterisk/local/


enter


sudo nano write_gpio.sh


then type the following script


####################################


#!/bin/bash

#script name - write_gpio

gpio mode 7 out ; makes gpio 7 pin 7 an output

gpio mode 2 out ; makes gpio 2 pin 13 an output

gpio mode 4 out ; makes gpio 4 pin 16 an output


#####################################


(Real Pin 7 = COS or RX node receiving voice from the Internet.)

(Real Pin 13 = TX or PTT node transmitting your voice into the Internet.)

(Real Pin 16 = PTT radio using 4N25 Optocoupler to key your radio transmitter.)




save


ctrl x yes enter


Check if write_gpio.sh file was created using ls enter or dir enter


Make write_gpio.sh file executable


chmod +x write_gpio.sh


cd



cd /etc/asterisk


enter


sudo nano rpt.conf


Under “Events” add the following:


########################################


; EVENTS


[events467652]


sudo /usr/local/sbin/7high.sh = s|t|RPT_TXKEYED

sudo /usr/local/sbin/7low.sh = s|f|RPT_TXKEYED

sudo /usr/local/sbin/2high.sh = s|t|RPT_RXKEYED

sudo /usr/local/sbin/2low.sh = s|f|RPT_RXKEYED

sudo /usr/local/sbin/4high.sh = s|t|RPT_TXKEYED

sudo /usr/local/sbin/4low.sh = s|f|RPT_TXKEYED


; Commands for FOB COS indicator when available

; For this to work you must also add - gpio4 = out,0 - to simpleusb.conf

; Uncomment (remove ;) on next two lines to activate

;cop,62,GPIO4:1 = c|t|RPT_RXKEYED

;cop,62,GPIO4:0 = c|f|RPT_RXKEYED


[events1999]


; FUNCTIONS


##########################################


save

ctrl x

Yes

enter

cd

cd /usr/local/sbin/

enter



Create 6 script files (Example: sudo nano 7high.sh enter)

7high.sh

7low.sh

2high.sh

2low.sh

4high.sh

4low.sh



In each script put:



7high.sh

#################

#!/bin/bash

gpio write 7 1

#################

7low.sh

#################

#!/bin/bash

gpio write 7 0

#################

2high.sh

#################

#!/bin/bash

gpio write 2 1

#################

2low.sh

#################

#!/bin/bash

gpio write 2 0

#################

4high.sh

#################

#!/bin/bash

gpio write 4 1

#################

4low.sh

#################

#!/bin/bash

gpio write 4 0

#################

save each one

ctrl x

Yes

enter

still in cd /usr/local/sbin/

make all 4 executable using the command

sudo chmod +x /usr/local/sbin/xxxxxx.sh

chmod +x 7high.sh

chmod +x 7low.sh

chmod +x 2high.sh

chmod +x 2low.sh

chmod +x 4high.sh

chmod +x 4low.sh



cd

sudo reboot



TX / RX LED’s and 4N25 Optocoupler PTT will now be working!!



Note: The one LED will light to show that the radioless node is receiving voice from the Internet. The other LED will light to show that the radioless node is transmitting your voice into the Internet. The TX LED on your radio will light-up to indicate that the PTT is active.

Download Manual  HERE (PDF)

Recognition:

AllStarLink Discussion Groups

HamVoip



Manual compiled by:

Johan Terblanche ZS1I

Mossel Bay

Date: 24 February 2024

 

GPIO outlay diagram and photos related to the Raspberry Pi 3 B Ver 1.2 below:

 




Our own Story Teller - Richard Nicholls ZS5RMN grieves over the loss of a loved one.

Image: Richard's Mother next to her beloved vintage Alfa Romeo GT. (1960'S ?)  (Click on image for larger view.) It is with great sa...