[arm-allstar] Troubleshooting Fan Control Script

Luc Drolet VE2LUQ ldrolet at cgocable.ca
Wed Nov 8 05:50:32 EST 2023


Hello to you,

I use this script and it works very well for my fan
she stops to ask the temperature


for all my repeaters and fans starts and stops alone depending on the temperature
----------------



#!/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_TXXKEYED
# rm -f /tmp/RPT_TXXKEYED = s|f|RPT_TXXKEYED

# TX Key file check
TXXKEYED="/tmp/RPT_TXXKEYED"

# 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=45

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 $TXXKEYED ]
do
  sleep 1
done
echo "Waiting Fan Delay"
sleep $fan_delay

}

gpio mode $FAN_BIT out

while :
do
if [ -e  $TXXKEYED ]
 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

————————

Good day
73’s


Luc Drolet VE2 LUQ
Président de VE2CVA
C.R.A.V.A.
Club Radio Amateur Vallée de l'Amiante
VE2 CVA
ve2cva at gmail.com
ldrolet at cgocable.ca
https://clubs.raqi.ca/ve2cva/
https://www.facebook.com/groups/ve2cva
Instagram : https://www.instagram.com/ve2cva/
Echolink =   VE2RVA-R    NODE #24560
Sécurité Civil du Québec, Node #1400








> Le 7 nov. 2023 à 22:01, ve3rwj via ARM-allstar <arm-allstar at hamvoip.org> a écrit :
> 
> Thank you so much Danny. I'll investigate this fully tomorrow and report
> back.
> 73
> Chris
> 
> 
> _______________________________________________
> 
> 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/4 web page - http://hamvoip.org
Good day


More information about the ARM-allstar mailing list