[arm-allstar] Fan Control Script
Doug Crompton
wa3dsp at gmail.com
Sat Oct 27 16:42:19 EDT 2018
Below is a fan control script. It uses events to control the fan and as
configured it delays for 1 minute after unkey. The bit it sets is GPIO.23
to turn on the fan. This is also changeable. See gpio readall at the
Linux prompt. Do not apply any voltage to thie selected pin. It is an
output to drive a relay or solid-state fan controller. You can certainly
change this script to suit your needs. Put this script in
/etc/asterisk/local and run it in the background after testing. I call it
fan_control.sh
To run in the background put this at the beginning of /etc/rc.local -
/etc/asterisk/local/fan_control.sh &
#!/bin/bash
# Script to check for PTT and turn on fan via GPIO
# D. Crompton WA3DSP 10/2018
# Make sure the events stanza is named properly
# The node stanza will have an events=eventsxxxxx
# where xxxxx is the node number. Replace the
# xxxxx with the node number below
# Add the following three lines to rpt.conf
# [eventsxxxxx]
# touch /tmp/RPT_TXXKEYED = s|t|RPT_TXKEYED
# rm -f /tmp/RPT_TXKEYED = s|f|RPT_TXKEYED
# TX Key file check
TXKEYED="/tmp/RPT_TXKEYED"
# Fan delay at unkey
# This is in seconds or with 'm' for minutes
fan_delay="1m"
# GPIO fan control pin
# GPIO.23 Pi Physical pin 33
FAN_BIT=23
function FAN_ON {
# Turn on Fan
gpio write $FAN_BIT 1
while [ -e $TXKEYED ]
do
sleep 1
done
sleep $fan_delay
}
gpio mode $FAN_BIT out
while :
do
if [ -e $TXKEYED ]
then
echo "TX"
FAN_ON
else
echo "NO TX"
# turn fan off
gpio write $FAN_BIT 0
fi
sleep 1
done
*73 Doug*
*WA3DSP*
*http://www.crompton.com/hamradio <http://www.crompton.com/hamradio>*
More information about the ARM-allstar
mailing list