URI GPIO pins for a fan controller

Has anyone setup these pins to operate as a cooling fan controller? I’d like to have the fan come on during transmit and stay on for period of time after the transmitter stops.
Thanks
Mike

  1. You need to build the circuit on DMK engineering’s web site; the uri only sinks about 5 mil, and you can’t drive a fan with that. Building that circuit, and using pin 2 of the URI (IIRC, it’s GPIO1) you can drive a relay that will switch the fan on and off.
    http://dmkeng.com/images/GPIO_Relay.pdf
  2. Look of KA0KN’s website in KC area or modify my script based on that included below. He’s got a fan control circuit script that reads a flag file you set with the event subsystem in asterisk and turns the fan on after an elapsed time, and runs it for a period of time (both configurable in the script) after the last PTT.
  3. in the node usbradio.conf for the node, you have to set the pin properly: gpio1=out0 to initialize.
  4. event subsystem in the node to set the flag looks something like this:
    [eventsnodenum]
    touch /tmp/~pttstate = s|t|RPT_TXKEYED
    rm -f /tmp/~pttstate = s|f|RPT_TXKEYED
    First one sets the flag when it’s true the repeater is keyed, second one removes the flag.

My fan control script, adapted from Kyle’s:

#!/bin/bash
#########################################################################

#Filename: txfan

#Description:

#This file controls a PC fan attached to any aux port. It starts up when
#PTT is detected, and will stay on for the time period specified in
#the TIMEAFTER variable after the PTT drops. If the PTT is triggered
#in the countdown period, the timer resets.

#Original Authors:

#The majority of this script (the state manager) was taken from
#the ID scripts by KC6HUR and WW4M.

#Add the following to the events stanza of rpt.conf for each node you want
#controlled by the fan. Multiple nodes can control a single fan.
#The Event Management Subsystem is used to indicate PTT state to the
#TXFAN process.

#touch /tmp/~pttstate = s|t|RPT_TXKEYED
#rm -f /tmp/~pttstate = s|f|RPT_TXKEYED

#Add the following code snipit near the end of /etc/rc.local
#This will restart TXFAN process each time the node is restarted.

CUSTOM=/etc/asterisk/scripts

if [ -f $CUSTOM/txfan ] ; then

echo -n “Starting TXFAN process…”

killall txfan &>/dev/null

/bin/su - -c $CUSTOM/txfan root &>/dev/null &

echo “done!”

fi

if [ -f /tmp/fanlog ] then

mv /tmp/fanlog /tmp/fanlog.old

touch /tmp/fanlog

fi

#History:
#2005-02-16 kd6hwc Initial creation (with help from other scripts)
#2007-07-29 k6jwn Added new variable PTTON, fan won’t come on until

this timer reaches its limit.

#2012-01-28 k0kn Adapted script for app_rpt system
#2012-01-29 wb0yle Adapted to fit ‘normal’ acid install w/scripts in

/etc/asterisk/scripts.

Moved pttstate to /tmp so other scripts could

potentially query the state which may not have

perms to look in asterisk hierarchy. Changed

some display verbiage when running interactively

such as ‘Initial’ to ‘Idle’, which more accurately

reflects the constant state when not keyed.

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

Define Asterisk paths

CUSTOM="/etc/asterisk/scripts"
BIN="/etc/asterisk"

Temp file that exists when PTT active which is set by event subsystem

PTTSTATE="/tmp/~pttstate"

Define the function that’s called to activate/deactive fan

FANON="$BIN/scripts/fanon"
FANOFF="$BIN/scripts/fanoff"

Define the period of time in seconds after the PTT drops to shut off the fan

TIMEAFTER=120

Define the max PTT time in seconds before the fan is activated

PTTON=20

define variables

declare -i IDLETIMER
declare -i PTTKEY

Start with state set to “Initial”

STATE=“Idle”

while [ TRUE ]
do

case “$STATE” in

"Idle")      # Wait for first keyup, then proceed to Countdown
	clear
	echo -en "\r"`date ` "STATE = Idle\n"
	sleep 1;
	PTTKEY=0
 while [ TRUE ]
            do
                    echo -en "\rPTT Timer: $PTTKEY    "
                    sleep 1;

                    # while PTT is silent (PTT=T)
                    if [ -f $PTTSTATE ] ; then
                            PTTKEY=$PTTKEY+1
                    fi

                    if ! [ -f $PTTSTATE ] ; then
                            PTTKEY=0
                    fi

                    if [ $PTTKEY -gt $PTTON ] ; then
                            break
                    fi
            done
                    echo -en "\nPTT time exceded, activating fans"
                    $FANON
                    STATE="Countdown"
    ;;


    "Countdown")      # Count down period, if PTT is triggered, reset the timer.

            echo -en "\n\n"`date ` "STATE = Countdown\n"
            sleep 1
            IDLETIMER=$TIMEAFTER

            while [ TRUE ]
            do
                    echo -en "\rFan powerdown timer: $IDLETIMER    "
                    IDLETIMER=$IDLETIMER-1
                    sleep 1

                    if [ -f  $PTTSTATE ]
                    then
                      IDLETIMER=$TIMEAFTER
                    fi

                    if [ $IDLETIMER = 0 ]
                    then
                            break
                    fi
            done

            echo -en "\nTimer expired, deactivating fan"
            $FANOFF
            STATE=Idle
    ;;

    esac

done

fanon script:
#!/bin/bash

Scrip to turn on GPIO port 1 on URI

By Kyle Yoksh

Modifications by Bryan Boyle

nodeno=nodenumber
ddd=date

asterisk -r -x “rpt cmd $nodeno cop 62,GPIO1=1 0”
echo "System fans started "$ddd >> /tmp/fanlog

fanoff
#!/bin/bash

Script to turn off GPIO port 1 on URI

By Kyle Yoksh

Modifications by Bryan Boyle

nodeno=nodenumber
ddd=date

asterisk -r -x “rpt cmd $nodeno cop 62,GPIO1=0 0”
echo "System fans stopped "$ddd >> /tmp/fanlog

Getting it to work is left as an exercise for you.

73 de wb0yle/w2fuv
morrisville pa
fall river ma

Thank you I will take a look at this and see what works best for me.

For my node, I use a W1209 Thermostat Temperature Control Switch sensor attached to the radio heat sink to control a small fan on & off. Very configurable for most applications. Purchased off eBay for a few dollars.

Cheers,

Rob…
VK6LD

1 Like

Thank you that’s exactly what I did and it works perfectly.

Mike

W1ZFB

···

From: Rob via AllStarLink Discussion Groups [mailto:noreply@community.allstarlink.org]
Sent: Monday, December 07, 2020 7:14 PM
To: mzfb@aol.com
Subject: [AllStarLink Discussion Groups] URI GPIO pins for a fan controller







VK6LD
December 8

For my node, I use a W1209 Thermostat Temperature Control Switch sensor attached to the radio heat sink to control a small fan on & off. Very configurable for most applications. Purchased off eBay for a few dollars.

Cheers,

Rob…
VK6LD


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

| Virus-free. www.avg.com |

  • | - |