My goal was to cool the Raspberry Pi as well as to reduce the volume. So the Raspberry PI only cools when it gets too hot. At the same time I can display information on the display so I don't have to log in via SSH to get the status.
I use a Raspberry PI 4 with WaveShare PoE HAT (B).
Theoretical maximum temperature values are about 80C° before the Raspberry PI starts downclocking the CPU. Above 90-95C° damage can occur.
When idle, the Raspberry PI is about 40C° with the small heatsinks and the fan turned off. If there is a load now, the fan on the PoE HAT should be switched on and cool the Raspberry PI 4 additionally.
To keep my wish of a CPU temperature of around 50C° the fan is switched on from a CPU operating temperature of 50C° and stays switched on until the temperature is below 50C° again.
sudo apt install gcc git g++
sudo apt install nodejs
or a specified version
sudo curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt update
sudo apt install nodejs
Use raspi-config
as command when connected to ssh to enable the I2C interface (Interface Options) on your Raspberry Pi.
When mounting the Waveshare POE HAT, you will need to set the switch to P0 so we can program it later.
- EN for an automatic start of the fan when booting the Raspberry PI.
- P0 to be able to program the fan without automatic start.
Run the following command in the source folder.
npm install i2c-bus oled-i2c-bus oled-font-5x7 --save
Alternative
npm install
You can run the script with
node app.js
The best way to implement it is to register the script as a cronjob.
crontab -e
*/5 * * * * node /home/pi/raspberryPi-waveshare-PoE-HAT-B/app.js