Simple Python and shell scripts to run a fan based on CPU temperature for your Raspberry Pi.
This setup uses GPIO pin 18 with an NPN Transistor (S8050). Wiring diagrams
for this setup are provided in the wiring_diagrams
directory, with an image
of the most basic setup below.
Here's how to run this script automatically on boot:
- Modify the shell script to ensure you have the correct path run-fan.py.
- Make the files executable using sudo chmod a+x run-fan.py and sudo chmod a+x launcher.sh.
- Use crontab (or another method) to execute launcher.sh on boot.
The code included in this repository is mainly the work of others, with some modification and adaptations made to the code to document the approach.
Thanks to @vollman-ariel for providing a wiring diagram which includes an additional resistor.