Update 1 :

After some help and advices from nice people here i'm going to use this circuit : http://everycircuit.com/circuit/5857347480322048

enter image description here

the 25 ohm resistance being the fan.

I'm requesting your help for a little electronic circuit, a simple transistor switch. I need help because i don't know how to choose the right transistor or the right resistance for my circuit. I need advice for adding a protective diode.

I explain myself :

it's a circuit that switch a 5v 0.2A dc fan to cool my raspberry pi because i use it intensively.

here is the circuit i designed :

updated (look up)

the online link to it : Updated to new link (look up) (the 25ohm resistance is the fan's resistance, i didn't know how to modelise it).

I use the 5v pin to power the fan and a gpio pin (3.3V 16mA) to turn the transistor on/off by a python code i will do myself later.

is the resistance choosen ok ? how can i choose the right transistor after it's specs ?

if i get to make the circuit work fine, i will then use the PWM pin of the RPI to make it's speed variable with the temperature of the CPU, but that's after.

i hope my question is complete, What do you guys think ?

  • 2
    \$\begingroup\$ The 18 k ohm resistor is a bit high, that could prevent the transistor from fully closing and making it hot. I would Use a 1 kohm resistor instead of that 18 kohm. Include a link to the datasheet of the fan, not all fans like a PWM signal on their supply. \$\endgroup\$ Commented Aug 30, 2017 at 15:08
  • \$\begingroup\$ Link to the transistor datasheet would be good too. \$\endgroup\$ Commented Aug 30, 2017 at 15:18
  • 1
    \$\begingroup\$ Assuming a 0.7V drop from base to emitter, the base resistor will see 3.3V - 0.7V = 2.5V. For 16 mA to flow the base resistor would have to be 2.5V / 0.016A = 156 Ohm. So in order to keep the current below the limit of the GPIO, 220 Ohm should be plenty. \$\endgroup\$
    – Dampmaskin
    Commented Aug 30, 2017 at 15:25
  • \$\begingroup\$ @Bimpelrekkie i got the fan with the pi's case, all i got is voltage/current. \$\endgroup\$
    – Corn
    Commented Aug 30, 2017 at 16:36
  • \$\begingroup\$ @pericynthion i do not own a transistor yet, i though i'd choose one with the circuit's demand. Isn't that right ? \$\endgroup\$
    – Corn
    Commented Aug 30, 2017 at 16:38

1 Answer 1


Try using a common switching transistor such as 2N4401. You should have Ib in the range of the fan current divided by 20 to have the transistor fairly well saturated. 10:1 (Ic/Ib) would conform to the guaranteed specs, but 20:1 is good enough for this, at 200mA or less. If you look at Fig 17 in the linked datasheet, things go pear shaped at higher collector currents:

enter image description here

If you had a much higher current fan, it would likely be better to use a MOSFET rather than a BJT.

@Dampaskin's suggestion of 220 ohms for the base resistor will be fine for this. And you're done.

  • \$\begingroup\$ I better understand now, one more thing that i don't get is, Hfe here is 196mA/11mA ~= 17, is that normal ? \$\endgroup\$
    – Corn
    Commented Aug 31, 2017 at 6:35
  • \$\begingroup\$ Yes, it is normal. The datasheet saturation voltage is rated at 10 "forced beta". You must keep the forced beta << hFE (as measured with large Vce) to have the transistor Vce as low as practical. So you pick the Ic/Ib to be sufficiently low that the transistor is well "on" and it thus runs cool. \$\endgroup\$ Commented Aug 31, 2017 at 10:21
  • \$\begingroup\$ It is not simple to understand this but i got it, thank you very much. \$\endgroup\$
    – Corn
    Commented Aug 31, 2017 at 14:39
  • \$\begingroup\$ @Corn. Good.. it's a bit hard to describe in words. \$\endgroup\$ Commented Aug 31, 2017 at 14:43

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.