-
Notifications
You must be signed in to change notification settings - Fork 14
B. Thermal Protection
Chad McCue edited this page May 10, 2017
·
32 revisions
The Linksys WRT3200\1900\1200 routers have temperature sensors built in. You can use those sensors to shutdown your router if one of it's components gets too hot or turn on the cooling fan if the router has one. In most cases you just want to log the events so you can add cooling if required. If a thermal protection action occurs it will be logged in a file "/root/overheat.log".
- Install lm-sensors package that is used to read the sensors.
apt-get install lm-sensors
- Auto detect the sensors by answering yes to all configuration questions.
sensors-detect
Check if auto detecting sensors was successful.
sensors
Output should be:
root@MCDEBIAN:~# sensors
tmp421-i2c-0-4c
Adapter: mv64xxx_i2c adapter
temp1: +40.4 C
temp2: +42.7 C
armada_thermal-virtual-0
Adapter: Virtual device
temp1: +67.5 C
- Create sensor configuration file for sensor labels.
cat <<'EOF' >> /etc/sensors3.conf
chip "tmp421-*"
label temp1 "DDR"
label temp2 "WIFI"
chip "armada_thermal-virtual-*"
label temp1 "CPU"
EOF
Check that the sensor labels are correct:
sensors
Output should be:
root@MCDEBIAN:~# sensors
tmp421-i2c-0-4c
Adapter: mv64xxx_i2c adapter
DDR: +40.4 C
WIFI: +42.7 C
armada_thermal-virtual-0
Adapter: Virtual device
CPU: +68.0 C
- Install Debian fancontrol package
apt-get update
apt-get install fancontrol
- Configure fancontrol
pwmconfig
- Recommended fancontrol settings
root@MCDEBIAN:~# cat /etc/fancontrol
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon0=devices/platform/gpio_fan hwmon2=
DEVNAME=hwmon0=gpio_fan hwmon2=armada_thermal
FCTEMPS= hwmon0/pwm1=hwmon2/temp1_input
FCFANS= hwmon0/pwm1=hwmon0/fan1_input
MINTEMP= hwmon0/pwm1=80
MAXTEMP= hwmon0/pwm1=85
MINSTART= hwmon0/pwm1=0
MINSTOP= hwmon0/pwm1=0
MAXPWM=hwmon0/pwm1=255
- Add a systemd service for overheat protection
cat <<'EOF' >> /etc/systemd/system/thermalcontrol.service
[Unit]
Description=WRT1900AC V2, WRT1900ACS V1 and WRT1200AC Thermal Control
After=networking.service
[Service]
Type=simple
ExecStart=/usr/local/sbin/thermalcontrol
ExecStop=/usr/bin/pkill thermalcontrol
PrivateTmp=true
NonBlocking=yes
[Install]
WantedBy=multi-user.target
EOF
- Create the on overheat shutdown script.
cat <<'EOF' >> /usr/local/sbin/thermalcontrol
#!/bin/sh
while true ; do
for TEMP in `sensors|cut -s -d+ -f2|cut -d. -f1`; do
if [ $TEMP -ge 85 ]; then
DATE=`date`;
echo "$DATE: Overheat shutting down system" >> /root/overheat.log
echo `sensors|grep +` >> /root/overheat.log
systemctl poweroff;
break;
fi
done
sleep 30
done
EOF
chmod +x /usr/local/sbin/thermalcontrol
systemctl enable thermalcontrol.service
- Reboot
reboot