Hi all, I have a situation where I want to put a raspberry pi inside a rack-mounted computer case. Since I want to include full size 12V case fans I will obviously need a 12V source. Since the case has space for a standard PC power supply I am considering buying a cheap power supply and then wiring a custom cable to adapt the 5V and ground pins of the ATX pins to the USB-C input to power the pi. Then I could take 12V power to the fans separately.
I realize I loose PWM support but I am prepared to use a transistor on the ground side of the fans to act as a rudimentary PWM control of the fans. If necessary I am prepared to run the fans at a constant speed.
I also notice that if I could somehow get my hands on a computer module I could use a smaller (and cheaper) 12V power supply. But as best I understand I would have to take the 12V for the fans from the power supply before it gets to the pi, a feasible task. That obviously assumes that I could get my hands on a compute module.
I guess what I’m asking is whether there is any possible issues I haven’t considered or even if a better method exists.
Regardless thanks for all the help, Jem.
One way around this would be to use 4-pin “PWM” fans, they have a transistor built in that handles switching PWM on and off, you’d just need to wire that 4th pin into a GPIO on your Pi, you just need to find a fan that is happy being driven from 3.3V:
Alternatively, some mosfets with 10k pullup resistors on a protoboard on top of the Pi would do the job too, freeing you to use whatever fans you liked:
Andreas Spiess has a good video on this, worth giving it a look:
Let us know what you think of the above!
This is an interesting point but since I’m using a rack-mounted computer enclosure I don’t expect I’ll be able to find a 3.3/5V 120mm case fan.
Perhaps I’m being naive but since the MOSFET/Transistor would be connecting and disconnecting the ground a pull up resistor would be unnecessary and would work outright. And my watching of the linked video appears to agree with my understanding.
Is anyone familiar enough with ATX/Ras Pi power input to know if I will run into any obscure functionality that will give me grief?
Seems I got that a bit wrong, Andreas is using a pulldown resistor instead.
He does talk of omitting a protection resistor between the gate and the Pi pin, but that’s for making sure it doesn’t draw too much current at very high frequencies.
The pulldown is useful if your pin defaults to an input (hence floating) before your code starts, or the connection to the Pi is interrupted. A floating gate will switch the FET constantly and generate some heat and unwanted behavior.
Ah I see. I’ll do some experimentation to confirm my own understanding, thanks for the tip.
Just butting in a bit here but
That series resistor is there to protect the Pi GPIO pin. At the instant of switch on the Gate of the Mosfet presents a short to ground to the Pi pin due the the Gate capacitor resulting in potentially high current. The same applies the other way, the gate capacitor has to be discharged and this series resistor prevents destructive currents in and out of the Pi pin.
So I think this Andreas is asking for trouble omitting this resistor and should not be publishing and spreading the word.
The value is a bit of a compromise as if too high the Mosfet switching time is slowed down possibly causing overheating when switching larger currents. A value of about 1k seems to do the job in most cases although for high current applications I have seen as low as 10Ω but the Gate then is interfaced with some transistors or a specialised driver to supply the charging/discharging current.
May be this will be useful
You can also get 2 pin 12V fans and use this Instructables to make a PWM controlled by Pi. I made one for 5V fan for my Pi 4.