2

Raspberry Pi has recently added fan control feature in its raspi-config tool. This made me curious to add a fan to my RPI 4. I did it recently with a 680-ohm resistor, 2N2222 transistor, 1N4007 diode, and a 5v 5x5 fan. I connected all stuff like the below enter image description here and it works, but faulty! The fan needs a hand to get started! It won't start without my hand's help, but it will work right when it started with my hand. Can it be due to the transistor's hFE? which is 100mA in this case. and if it is, which transistor should I use? also, I have to say that I connected the Base pinout of the transistor to the 5v pin just for test and see that It starts itself or not, but it didn't start, and still needed my hand!

SOLVED: First, I bought a new fan, previous fan needed too much current as a raspberry pi fan. Second, my bad! I had connected the emitter pinout and collector pinout wrongly!

enter image description here

3
  • 1
    What pins on the pi correspond to J1 1,2,3 in your diagram?
    – justinjt
    Commented May 6, 2021 at 21:06
  • 1
    1 to 5v power, 2 to GPIO 14 which is fan control pin & 3 to Ground
    – AmirHo3inF
    Commented May 7, 2021 at 9:37
  • Please provide a link to a spec sheet on that fan; 200 mA seems far too much for a small RPi cooling fan - 40-50 mA seems more reasonable.
    – Seamus
    Commented May 7, 2021 at 10:54

2 Answers 2

3

If it's connected as you claim, then the fan is probably faulty.

There are things you could do to check, but you didn't say if you had a voltmeter or oscilloscope available. So - here is one check you can make without a voltmeter:

  1. Disconnect and set aside all of your circuit components for now.

  2. Connect the fan's + terminal to a +5V pin in the header - Pin 2 or Pin 4

  3. Connect the fan's - terminal to a GND pin on the header - any pin labeled Ground on this web page

If the fan spins without help - your circuitry (or your software setup) is at fault. If it doesn't spin without help - your fan is broken - perhaps defective manufacture?


EDIT, re questions in your comments re the circuitry:

I think the problem is the circuit, but which component? transistor or resistor!? my fan needs 200mA and the 2N2222 transistor's hFE is 100mA, could it be the reason?

  • 200mA is a lot more current than I've ever seen on a RPi cooling fan, but let's go through the calculations for that load:

  • hFE is not 100mA. hFE is the dc current gain; Ic = hFE x Ib (collector current = hFE times base current) - hFE is "dimensionless".

  • Refer to the data sheet for the 2N2222. The Figures tell us what we need to know:

  • hFE is not a "static" number - it varies with manufacturing tolerances, base drive, temperature & other factors.

  • At 25degC, hFE may be in the range of 200. If we can drive the base of the 2N2222 with 10mA, we should be able to saturate the transistor, and pull 200mA.

  • To get 10mA base drive from a 3.3V GPIO pin, use Ohm's law: R = E / I, or 3.3V / 10mA = 330 Ohms. However VBE will reduce our 3.3V source to ~ 2.6V - let's choose a resistor in the range of 270-300 Ohms.

So - the resistor R1 should be changed: from 1K to 270/300 Ohms. You should double check the wiring in your J1 connector:

J1-1 = 5V.

J1-2 = the GPIO pin you've chosen.

J1-3 = GND.

Beyond this: Unless you have a voltmeter, I cannot think of any way to troubleshoot your circuit except to replace the transistor.

2
  • Hi, I connected it directly to 5v power and ground and it started working without help. I used to use this fan like this before. I think the problem is the circuit, but which component? transistor or resistor!? my fan needs 200mA and the 2N2222 transistor's hFE is 100mA, could it be the reason? every post I've seen about fan control had used 2N2222 by the way.
    – AmirHo3inF
    Commented May 7, 2021 at 9:27
  • 1
    @AmirHo3inF: 200 mA seems awfully high for the typical RPi cooling fan, but assuming that's correct, the circuit should work with a smaller value for R1. I've outlined the calculations in my edited answer. Here's more detail on how to bias the transistor.
    – Seamus
    Commented May 7, 2021 at 10:47
0

Really thank you for the complete explanations @Seamus. I was using this fan, which has written 0.20A current in its description.

Here's the news: today, I bought a 3x3 5v fan. First of all, I tested it with a direct connection to 5v pinout and ground, and it worked fine. Then I connected that to my circuit, and still, the same problem happened. so I went for the next solution, which was changing the resistor. First, I removed the resistor from the circuit (just for test in a sec) and it worked, but the transistor got hot. I had two 33Ω and a 150Ω in my box, so I put them together (series) and used that for R1, it didn't work, but when I removed two 33 ohm resistors, It started to spin with 150ohm on R1! Also I tested it with 66ohm on R1 and it spun faster. Neither of them caused the transistor to heat up. So, with lots of respect, here's the last question: Which is better to use? 66ohm or 150 ohm, and this amount of current will damage my GPIO?

EDIT: SOLVED. I explained in the first question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.