Raspberry pi 4 GPIO controlled cooling fan
About the project
When it gets too hot
Project info
Difficulty: Easy
Platforms: Raspberry Pi
Estimated time: 1 hour
License: GNU General Public License, version 3 or later (GPL3+)
Items used in this project
Hardware components
View all
Story
Using some python, few electronics parts and a fan, I added a GPIO controlled fan to my RPI 4.
While working on the raspberry live video with tkinter I noticed that my rpi 4 (knows issue) tend to run really hot. When I ordered the rpi4, I also ordered a case and a cooling fan, I should have bought a heat sink as well, which I did later (after the video was done). If you want to watch the project you can see it here
Now I did not want it to run all the time, so I did 2 things.I create a PCB that move the control of the fan to a GPIO using a NPN transistor as a switch.And I wrote a little python script that takes the core temperature using this command : vcgencmd measure_temp. Once I get the temperature, I check if it’s over the threshold, if so I turn on the fan. If not turn it off. Pretty simple. I added the script to the rc.local file and it works on boot now. When I tested it later on (again after the video was out) I noticed that my code was not perfect for the job, and changed it to have a gap between the turn on to the turn off by temperature, not using the same one. I also printed a case for the camera The files can be found here (not mine!) https://www.thingiverse.com/thing:2746186I had a great time also creating the box and mount using fusion360.I did not publish the files, but if any one wants then will be more the happy to send it to him. Hope you will find it useful.
Leave your feedback...