Raspberry pi 4 GPIO controlled cooling fan - python script
Vložit
- čas přidán 20. 08. 2024
- While working on the raspberry live video with tkinter I printed a case for the camera
• Raspberry pi Video str...
The case files can be found here
www.thingivers...
Full details
• Raspberry pi config bu...
I had to adjust it a bit, but it turned out great.
Now the more important thing I wanted to do was to add a fan to the rpi 4 that tend to run hot.
but 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.
I had a great time also creating the box and mount using fusion360.
Hope you will find it useful.
Fan shim work super
had to google it, looks cool, never used one.
Appreciate the video but the part @2:27 is what viewers like me actually interested on. You just gave an overflow rather than showing circuit diagram or elaborate more.
Thanks for the comment, you can see all the extra info here
www.electromaker.io/project/view/raspberry-pi-4-gpio-controlled-cooling-fan
great one, can we see the schematic ? especially to know the resistor values for the base and the collector
Thank you
Here is a full review
It's a 1K for the transistor and 220Ohm for the led
www.hackster.io/talofer99/raspberry-pi-4-gpio-controlled-cooling-fan-20fe85
Also just so you know - now there is a build in setup in rpi for this
czcams.com/video/0jFWbNrWhN8/video.html
@@talofer99 thanks a lot,
I will make a PI or PID controller with it, so..the built in on/off won't be useful for me..
Thanks again 🌹
This is great and exactly what i was looking for! Awesome job. Question.. will this work with the Raspberry Pi 3 B+? Also, Can this is done without an LED & switch? I want to be able to do this to my cooling fan without any of the additional bells and wistles.
Thank you very much.
Yes it can be done the same way on the Pi3 B+
And no need for LED and Switch, I did it as an addon - to know I get power and to be able to run the fan with out the need for using the python code
I'm brand new to everything raspberry pi related. I've found some good resources on python so I feel like I at least know where to start on the software side.
But I don't understand why the circuit is necessary for controlling the fan. I don't know if it's because I don't understand the limitations of he raspberry pi, or if I just altogether don't understand how electronics work. Can you think of some places that would be good starting points where I can gain a better understanding of what you did in this video?
The GPIO voltage level of the RPI is 3V. and can only supply low miliamp current.
The fan needs 5V to work and love its amps ....
Soliton - you drive a transistor with the GPIO - that can work with 3V and need only few miliamp to work. the transistor will act as a switch to "connect" the fan to 5V.
Since when a fan stops working, it can, due to its physics, create a reverse voltage on the system the diode is there to "take it" instead of it running to your power source and rpi.
I made a tutorial on this, you can see the schematics
www.electromaker.io/project/view/raspberry-pi-4-gpio-controlled-cooling-fan
Here is a video on transistors as switch
czcams.com/video/bK4vyPVBITA/video.html
also, few days back I found out the rpi config has a new feature for what I done in python script
czcams.com/video/0jFWbNrWhN8/video.html
Let me know if it helped answering your question
@@talofer99 thank you for getting back so quick. You answered question very well. I will have to dive deeper on I get my pi, and I'll definitely check out more of your videos
Great, glad I could help.
Can you please share the Python file?
sure thing - there you go
pastebin.com/7iBM34ZN