We have a really simple fan service that will control the onboard fan. The reason we have it set up as a service instead of keeping the fan on all the time is so that it doesn't drain too much power from the Pi during the initial power on.
The fan service basically controls turning GPIO 4 on at startup, which is what the fan is connected to. Installing the fan service is really simple and we have a script for doing that.
To install, just type sudo raspi-config
Select Performance Options
Select Fan
Select Yes
And make sure you put down GPIO pin 4 for the fan
You can customize the fan temperature setting
That's it!
You can then 'stress test' by running
sudo apt-get install stress
while true; do vcgencmd measure_clock arm; vcgencmd measure_temp; sleep 10; done& stress -c 4 -t 900s
When the temperature hits the limit you set earlier, the fan should turn on, and cool the pi back down (in this case I set it to 70 C):
Text editor powered by tinymce.