LexDexter
Posts: 5
Joined: Tue May 26, 2020 2:58 pm

Adding 12V PC Fan to Raspi 4B

Sat Jun 27, 2020 2:40 pm

Why? Overkill

The fan is a 3pin 12V DC PC fan, with a positive, negative and signal (red, black and yellow). I haven't bought the fan (yet), so if this cant be done, or is pointless, lemmi know. I have an old 12V Power supply that takes 220V AC, which i hope can be used to power the fan, while using the raspi to control the RPM.

Can i connect the black and red wire to the positive and negative corrisponding wires on the power supply, and then connect the yellow signal wire to some pin on the raspi, and then use python to send a signal telling it at what RPM to spin, while at the same time monitoring the CPU temp?

I know how to do the python coding (i think), but i dont know how to wire it all up, while not blowing up the raspi. I read that i also need to protect the raspi from blowback when the fan is powering off but still spinning, but that project didnt include an external power supply, does that apply here?

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Adding 12V PC Fan to Raspi 4B

Sat Jun 27, 2020 8:41 pm

No do not connect the yellow wire to your pi gpio it's is an output which indicates fan speed it may well have a 12V signal on it Which will damage your pi.

If you want to control the fan speed you will need a transistor control circuit to switch the 12V power under control of the gpio pin.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
HawaiianPi
Posts: 5710
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Adding 12V PC Fan to Raspi 4B

Sat Jun 27, 2020 9:38 pm

The yellow wire is a tachometer output that pulses to indicate the fan speed. It has nothing to do with actually controlling the speed, and it outputs voltage similar to the input, so connecting the tach wire from a 12V fan to the Pi's GPIO will instantly damage it. Actually, even the tach wire from a 5V fan would damage the Pi, because GPIO is 3.3V input.

To be safe an opto isolator could be used to control the fan circuit. An opto isolator could also be used to read the tach signal (I believe it's 2 pulses per revolution, but it may not be the same for all fans).

If you actually want to control the speed (as opposed to just switching the fan on/off), then you want a PWM compatible fan. If your fan is quiet enough then on/off is much simpler to do, and will work with any fan.


FYI:
Some 12V fans can actually run on 5V, at a lower RPM and CFM (and with less noise). I used to have a double stack case for a pair of SBCs cooled by a single 12V fan running on 5V. It worked well and was almost silent. Not true for all of them, of course, and some will run, but not reliably start (they may need a little push now and then).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

jbudd
Posts: 1358
Joined: Mon Dec 16, 2013 10:23 am

Re: Adding 12V PC Fan to Raspi 4B

Sun Jun 28, 2020 12:41 am

According to your other post you are intending to buy heatsinks as well as a fan, and the reason is "overkill".

There is an excellent overkill cooler for the Pi - the Ice Tower https://www.52pi.com/home/136-52pi-ice- ... del-b.html It looks awesome, it spins, it even lights up. And this one is the best cooling solution tested on this site https://www.arrow.com/en/research-and-e ... comparison

A cheaper and lower profile option is a Noctua fan such as NF-A4x10 5V or NF-A4x20 5V mounted over the CPU without heatsink, powered from the 5V pin. My Pi 4B with such a fan does not get hot enough to throttle the CPU frequency even running cpuburn-a53 continuously.

I suspect that cheap low profile heatsinks with sticky "thermal pad"s are worse than useless.

LexDexter
Posts: 5
Joined: Tue May 26, 2020 2:58 pm

Re: Adding 12V PC Fan to Raspi 4B

Sun Jun 28, 2020 1:00 am

jbudd wrote:
Sun Jun 28, 2020 12:41 am
According to your other post you are intending to buy heatsinks as well as a fan, and the reason is "overkill".

There is an excellent overkill cooler for the Pi - the Ice Tower https://www.52pi.com/home/136-52pi-ice- ... del-b.html It looks awesome, it spins, it even lights up. And this one is the best cooling solution tested on this site https://www.arrow.com/en/research-and-e ... comparison

A cheaper and lower profile option is a Noctua fan such as NF-A4x10 5V or NF-A4x20 5V mounted over the CPU without heatsink, powered from the 5V pin. My Pi 4B with such a fan does not get hot enough to throttle the CPU frequency even running cpuburn-a53 continuously.

I suspect that cheap low profile heatsinks with sticky "thermal pad"s are worse than useless.
while I understand that your way is cost-effective, and in the long run a much better solution, I already modeled a case, and i like big fans, so, yea. Also, these are the heatsinks:
https://www.mikroprinc.com/sr/proizvod/ ... rni-set-31
(site is in Serbian, that's where I'm from) Also, this set is a bronze CPU heatsink with the RAM and USB controller heatsinks being aluminum.
HawaiianPi wrote:
Sat Jun 27, 2020 9:38 pm
The yellow wire is a tachometer output that pulses to indicate the fan speed. It has nothing to do with actually controlling the speed, and it outputs voltage similar to the input, so connecting the tach wire from a 12V fan to the Pi's GPIO will instantly damage it. Actually, even the tach wire from a 5V fan would damage the Pi, because GPIO is 3.3V input.

To be safe an opto isolator could be used to control the fan circuit. An opto isolator could also be used to read the tach signal (I believe it's 2 pulses per revolution, but it may not be the same for all fans).

If you actually want to control the speed (as opposed to just switching the fan on/off), then you want a PWM compatible fan. If your fan is quiet enough then on/off is much simpler to do, and will work with any fan.


FYI:
Some 12V fans can actually run on 5V, at a lower RPM and CFM (and with less noise). I used to have a double stack case for a pair of SBCs cooled by a single 12V fan running on 5V. It worked well and was almost silent. Not true for all of them, of course, and some will run, but not reliably start (they may need a little push now and then).
An optical isolator is a component meant to transfer electrical signals via light to protect other components correct?
Either way, it would be hard to get my hands on one. Also found this:
Fan Circuit.jpg
Fan Circuit.jpg (99.31 KiB) Viewed 291 times
Would it work for my situation?
Is there any risk of damaging the raspi with this circuit?
Can I improve it in any way?
As I understand, I can control the fan speed without connecting the yellow wire to anything, with the circuit in the picture above.
Pls help I stupid :D

22over7
Posts: 33
Joined: Sat Jun 13, 2020 8:39 pm

Re: Adding 12V PC Fan to Raspi 4B

Sun Jun 28, 2020 2:07 am

jbudd wrote:
Sun Jun 28, 2020 12:41 am
A cheaper and lower profile option is a Noctua fan such as NF-A4x10 5V or NF-A4x20 5V mounted over the CPU without heatsink, powered from the 5V pin. My Pi 4B with such a fan does not get hot enough to throttle the CPU frequency even running cpuburn-a53 continuously.
Question from a newbie who's still waiting for the pi to arrive: How do you mount the fan over the CPU without heatsink? I don't see any pre-drilled holes on the PCB. Maybe you're using a case that allows for the mounting of a fan?

What about the ram chip? I also recall seeing thermo-photos of pi's where the lower left hand corner (where the power regulator) lights up. Is there a way/is it necessary to do something about that? (the components there are so small...)

Like I said I have not gotten my pi so there are "abstract questions". I do plan to put loads on mine so I'm interested in these issues. Thanks!

jbudd
Posts: 1358
Joined: Mon Dec 16, 2013 10:23 am

Re: Adding 12V PC Fan to Raspi 4B

Sun Jun 28, 2020 2:28 am

22over7 wrote:
Sun Jun 28, 2020 2:07 am
jbudd wrote:
Sun Jun 28, 2020 12:41 am
A cheaper and lower profile option is a Noctua fan such as NF-A4x10 5V or NF-A4x20 5V mounted over the CPU without heatsink, powered from the 5V pin. My Pi 4B with such a fan does not get hot enough to throttle the CPU frequency even running cpuburn-a53 continuously.
Question from a newbie who's still waiting for the pi to arrive: How do you mount the fan over the CPU without heatsink? I don't see any pre-drilled holes on the PCB. Maybe you're using a case that allows for the mounting of a fan?

What about the ram chip? I also recall seeing thermo-photos of pi's where the lower left hand corner (where the power regulator) lights up. Is there a way/is it necessary to do something about that? (the components there are so small...)
My Pi is in a Pimoroni PiBow case which has a big hole over the CPU. I stuck the Noctua fan to the case above the hole with hot melt glue. It's not pretty but it works OK.
I think the Ice Tower uses standoffs screwed through 4 of the holes in the board and metal brackets. You might be able to do something like that with your bigger fan.

If you blow air over the board it will cool everything down with or without heatsinks.

User avatar
HawaiianPi
Posts: 5710
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Adding 12V PC Fan to Raspi 4B

Sun Jun 28, 2020 5:14 am

22over7 wrote:
Sun Jun 28, 2020 2:07 am
How do you mount the fan over the CPU without heatsink?
Image

That's an old picture with a Pi 3B, but my 4B2 is configured the same way. Its a 2 layer acrylic case with no sides and a 40x10mm fan. It was less than $4 and allows easy access to the Pi system board while keeping it somewhat protected. The cheap included fan was quite loud, so it was replaced with a Noctua fan that cools well and is almost silent. I used some short M3 standoffs on top to mount the SSD, and added the knurled brass thumb nuts as feet. I like these cases for systems where I need board or GPIO access, otherwise I use Flirc cases.

No heatsink is needed. It stays nice and cool without them in this configuration. I was planning on adding a fan control circuit, but the fan is so quiet I never bothered. I recently bought a similar case for only $2.99, but it has a 30mm fan.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

boyoh
Posts: 1468
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Adding 12V PC Fan to Raspi 4B

Sun Jun 28, 2020 10:59 am

In my opinion you don't need extra heat sinks or fans , If you use the Pi to do low level current switching and not use
it as a power house, Use the Pi out puts to switch higher current buffer stages . You can us transistors or Opto Isolators
as voltage levelers , Why load the Pi up with all kinds of thing that will lower It's out put working capacity.
Why buy a upgrade moor power full model, when you have not master the first one. Some think all you have to do is
put few lines of code in to the Pi, then it will do what you are thinking, It is for learning coding and electronics
it is not plug and play. There is more fun in building your own project , righting a program for it ,then seeing it work
At least if the project don't work you will know how to to test it. Just remember in time there will be more Programmers
then Electronic Engineers

Regards BoyOh Retired Electrical / Electronic Technician
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

22over7
Posts: 33
Joined: Sat Jun 13, 2020 8:39 pm

Re: Adding 12V PC Fan to Raspi 4B

Sun Jun 28, 2020 2:31 pm

HawaiianPi wrote:
Sun Jun 28, 2020 5:14 am
22over7 wrote:
Sun Jun 28, 2020 2:07 am
How do you mount the fan over the CPU without heatsink?
Image

That's an old picture with a Pi 3B, but my 4B2 is configured the same way. Its a 2 layer acrylic case with no sides and a 40x10mm fan. It was less than $4 and allows easy access to the Pi system board while keeping it somewhat protected. The cheap included fan was quite loud, so it was replaced with a Noctua fan that cools well and is almost silent. I used some short M3 standoffs on top to mount the SSD, and added the knurled brass thumb nuts as feet. I like these cases for systems where I need board or GPIO access, otherwise I use Flirc cases.
THANKS! You have not only answered my fan+case question but also revealed the name of the little thing I've been wondering about --- M3 standoffs! :-)

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Adding 12V PC Fan to Raspi 4B

Sun Jun 28, 2020 2:49 pm

An average PC cooling fan will draw a few hundred mA , so you can get away with a single NPN transistor like the 2N2222 to control your fan.

wired like this

Image


this code will demonstrate fan speed control

Code: Select all


import RPi.GPIO as GPIO 
from time import sleep  
      
GPIO.setmode(GPIO.BCM)  
      
GPIO.setup(25, GPIO.OUT)

 

fan = GPIO.PWM(25, 100)  
print ("start")
fan.start(0)              
sleep (5)  
print ("Run 100%")   
fan.ChangeDutyCycle(100)
sleep(0.5)
speed = [15,25,50,75,100]
for sp in speed:
    print ("Run", sp,"%")
    fan.ChangeDutyCycle(sp)      
    sleep(10)
fan.ChangeDutyCycle(0) 
print ("Stop")
sleep (5)  
print ("Run 100%") 
fan.ChangeDutyCycle(100)
sleep(0.5)  
for sp in range(15,101,5):
    print ("Run", sp,"%")
    fan.ChangeDutyCycle(sp)      
    sleep(2)
sleep(5)
print ("Stop")
fan.stop()     
GPIO.cleanup()
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Beginners”