[arm-allstar] Temperature Based Fan Script

Doug Crompton wa3dsp at gmail.com
Sat Dec 1 22:59:40 EST 2018


Yes,  I always put a hidden typo in my scripts! Helps you learn. Only
kidding yes thanks for pointing that out. That is a comment but should be
corrected.


*73 Doug*

*WA3DSP*

*http://www.crompton.com/hamradio <http://www.crompton.com/hamradio>*


On Sat, Dec 1, 2018 at 10:26 PM "Arthur Putnam via ARM-allstar" <
arm-allstar at hamvoip.org> wrote:

> eventsxxxxx]
> # touch /tmp/RPT_TXXKEYED = s|t|RPT_TXKEYED
>
> This script I believe has a typo error has two X s in TXKEYEDword
> Art
> Sent from Yahoo Mail on Android
>
>   On Sat, Dec 1, 2018 at 4:22 PM, Mike Besemer via ARM-allstar<
> arm-allstar at hamvoip.org> wrote:   Thanks Doug!
>
>
> -----Original Message-----
> From: ARM-allstar [mailto:arm-allstar-bounces at hamvoip.org] On Behalf Of
> "Doug Crompton via ARM-allstar"
> Sent: Saturday, December 1, 2018 4:30 PM
> To: ARM Allstar
> Cc: Doug Crompton
> Subject: Re: [arm-allstar] Temperature Based Fan Script
>
> Mike,
>
>  Easy enough to do, Here is a script that combines temperature and a delay
> based on TX.  Of course this can be modified to your liking. There is lots
> of feedback so if you run this manually you will see what is happening. I
> would recommend lengthening the overall delay to maybe 5 seconds at the end
> after testing. The delay could be set to whatever you want  - 0 seconds to
> minutes.
>
>
> *73 Doug*
>
> *WA3DSP*
>
> *http://www.crompton.com/hamradio <http://www.crompton.com/hamradio>*
>
> #!/bin/bash
> # Script to check for PTT and turn on fan via GPIO
> # D. Crompton WA3DSP 11/2018
>
> # This script incorporates CPU temperature
>
> # Make sure the events stanza is named properly
> # The node stanza will have an events=enventsxxxxx
> # 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 - Seconds or Xm minutes
> fan_delay="5"
>
> # GPIO fan control pin
> # GPIO.23 Pi Physical pin 33
>
> FAN_BIT=23
>
> # Max CPU temperature in C
> MAX_TEMP=50
>
> function get_cpu_temp {
>
> PTEMP=`cat /sys/class/thermal/thermal_zone0/temp`
> PTEMP=`expr $PTEMP / 1000`
> echo "CPU Temp - $PTEMP"
>
> }
>
> function FAN_ON {
>
> # Turn on Fan
> gpio write $FAN_BIT 1
> echo "Fan ON"
>
> while [ -e $TXKEYED ]
> do
>   sleep 1
> done
> echo "Waiting Fan Delay"
> 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
>     get_cpu_temp
>     if [ $PTEMP -lt $MAX_TEMP ]
>       then
>       echo "Fan Below Max Temperature - Fan OFF"
>           gpio write $FAN_BIT 0
>       else
>           echo "CPU over temperature - Fan remains ON"
>           FAN_ON
>     fi
> fi
> sleep 1
> done
>
>
>
> On Sat, Dec 1, 2018 at 3:44 PM "Mike Besemer via ARM-allstar" <
> arm-allstar at hamvoip.org> wrote:
>
> > Has anyone written a fan control script based on CPU temperature?
> Ideally,
> > I'd like to have a script that could monitor the CPU temperature and run
> > the
> > fan when the CPU exceeds a certain (user setable)  setpoint.
> >
> > I saw the script that Doug wrote to control the fan based on PTT but one
> of
> > my Pi's needs intermittent cooling to keep the CPU below 50C regardless
> of
> > PTT activity.
> >
> > 73,
> >
> > Mike
> > WM4B
> > _______________________________________________
> >
> > ARM-allstar mailing list
> > ARM-allstar at hamvoip.org
> > http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
> >
> > Visit the BBB and RPi2/3 web page - http://hamvoip.org
> >
> _______________________________________________
>
> ARM-allstar mailing list
> ARM-allstar at hamvoip.org
> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>
> Visit the BBB and RPi2/3 web page - http://hamvoip.org
>
> _______________________________________________
>
> ARM-allstar mailing list
> ARM-allstar at hamvoip.org
> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>
> Visit the BBB and RPi2/3 web page - http://hamvoip.org
>
> _______________________________________________
>
> ARM-allstar mailing list
> ARM-allstar at hamvoip.org
> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>
> Visit the BBB and RPi2/3 web page - http://hamvoip.org


More information about the ARM-allstar mailing list