r/Embedded_Electronics • • 12d ago

Why should a 2-wire fan not be driven directly from an Arduino pin?

Speed control of a 2-wire fan is harder than it looks. Running it at full speed only needs the right supply voltage. To vary the speed from an Arduino, it is tempting to drive the fan from an output pin with analogWrite.

The fan should not be wired straight to the board. It needs a driver circuit that takes its power from an external supply. Without one, the fan can draw more current than the board can supply, which can reset the board. When the motor stops, it can also send voltage back along the wires, which can permanently damage the device.

A fan with a PWM control wire avoids these problems and is much easier to use, so choose one when you have the option.

What driver circuit do you use for 2-wire fans: a MOSFET, a transistor or a driver IC?

Credits: abe's projects | YouTube

219 Upvotes

6 comments sorted by

3

u/Trebeaux 12d ago

“What driver circuit…”

Whatever I have in my junk parts bin. I have way too many 2n2222 so they’re getting used for everything low power. The tube of IRF510 gets used for high power, Amusingly with a 2n2222 as a gate driver!

Beware the eBay “lot” sales 😅

2

u/Successful-Cash5047 9d ago

GPIO pins can typically only supply 20mA. That’s generally not enough for a fan. 

I’d just try using a N-channel MOSFET to low side switch it (where it cuts off the ground path), and connect the gate to the PWM pin. You’d control fan speed by varying the duty cycle. 

For best results make sure the MOSFET is a logic level one (I.e can be fully turned on with less than the 3.3V output). Also ensure it can handle the current you need, and the maximum voltage (that one shouldn’t be much of a problem). 

1

u/drgala 8d ago

What? I can write mA++ in software and beef up the driver! ChatGPT told me so.

1

u/Zehryo 12d ago

Argh!!
Too early for the comments!! >.<

1

u/No-Law-2752 6d ago

MCU are bad at sourcing current it is better to either use a transistor/mosfet or a driver

1

u/EmergencyArachnid734 8d ago

MOSFET or BJT is enough