Raspberry Pi3 GPIO tx/rx status led

Hello All I have a AllStar node using a raspberry pi 3b and was looking at using the GPIO pins on the RPi to send a tx and rx status to an rgb led. Any help would be great i have tried several ways but no success.

Hi Brett,

Welcome aboard our new community site.

Take a look at the app_rpt management system. Have it call a script that turns your LEDs on and off.

For anyone looking at using Raspberry pi Gpio pins for Led status this what i did to get it to work.

Go to and open using winSCP
under /usr/local/etc/rc.allstar
type in /etc/asterisk/local/write_gpio.sh (makes gpio pins go to output upon startup)
then save

then type nano /etc/asterisk/local/write_gpio.sh
then type the following script

#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

make executable by chmod +x write_gpio.sh
open rpt.conf in asterisk folder and under events ad the following
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

under /usr/local/sbin/
create 4 scripts
7high.sh inside each script put #!/bin/bash next line put gpio write 7 1
7low.sh inside each script put #!/bin/bash next line put gpio write 7 0
2high.sh inside each script put #!/bin/bash next line put gpio write 2 1
2low.sh inside each script put #!/bin/bash next line put gpio write 2 0

save each one and make them executable using the chmod +x command

then reboot
and enjoy.

1 Like

Woohoo! :clap: :tada: :confetti_ball: Congratulations on using the app_rpt Event Management system. As far as I know, you are the first. That’s awesome!

I for many years have been using what seems like a complex event system, but it is really simple and works great and does exactly what I wanted it to do.

It lets the person who timedout the repeater and others, know when a timed out repeater has reset from a local timeout and it also prevents weather announcements from interrupting a QSO. We, 27383, are almost always permalinked with 27426. If the permalink is down the events script does cause error messages in the log, but everything still works fine. YMMV. If someone knows how to avoid the link down errorlog messages, please let me know.



In the weather script, /usr/local/sbin/wx_condition.sh, just before “function round ()” I add a few lines like this

if [[ -f /tmp/key27383 ]]
then {
} fi
if [[ -f /tmp/key27426 ]]
then {
} fi
if [[ -f /tmp/qsoactive ]]
then {
} fi

Then I create or edit all of the following files with the content just below the filename added to the appropriate place in the file.



TEMPVARAA = v|e|${RPT_ALINKS} =~ “”,27426[TRC]K""
/usr/local/bin/ericunkey.sh = s|f|TEMPVARAA
/usr/local/bin/erickey.sh = s|t|TEMPVARAA
/usr/local/bin/weunkey.sh = s|f|RPT_RXKEYED
/usr/local/bin/wekey.sh = s|t|RPT_RXKEYED
/usr/local/bin/wetxunkey.sh = s|f|RPT_TXKEYED
/usr/local/bin/wetxkey.sh = s|t|RPT_TXKEYED

I put all of my scripts in /usr/local/bin/


rm -f /tmp/key27426


touch /tmp/key27426


touch /tmp/key27383


rm -f /tmp/key27383
if [ ! -f /tmp/txkey27383 ]
then {
/usr/bin/asterisk -rx “rpt localplay 27383 ha/reset”
} fi


touch /tmp/txkey27383


rm -f /tmp/txkey27383


$now = time();
open($fh, “>”, “/tmp/qsoactive”)
or die “Can’t open > /tmp/qsoactive: $!”;
print $fh “$now\n”;
$then = $now + 180;
open($fh, “>”, “/tmp/qsoexpire”)
or die “Can’t open > /tmp/qsoexpire: $!”;
print $fh “$then\n”;

crontab -e

*/2 * * * * /usr/local/bin/qsoexpired.pl

0 6-22/2 * * * /usr/local/sbin/wx_condition.sh KBMI 27383


use PortLocker;
my $port = 47262;
my $locker = new PortLocker;
if(! $locker->lock())
#— failed, port already locked
$now = time();
$then = $now + 10;
$qsoexpired = $then;
while($qsoexpired >= $now) {
sleep 17;
$qsoexpired = 0;
open($fh, “<”, “/tmp/qsoexpire”)
or die “Can’t open < /tmp/qsoexpire: $!”;
$qsoexpired = readline($fh);
$now = time();
unlink “/tmp/qsoactive”;


2 posts were split to a new topic: Winscp as root user