I'm pretty new to Pi and electronics.

I need to use my Pi as fans controller. I got two 12V fans and need to control it from Pi. I want to use external power supply (12V) to give them propper power.

I use: 2N222, BC327, 1N4007, resistor 300 ohm, resistor 10k ohm and this "schematic": schematic

I have a ready example that works great, for one device (fan):


But now I need two fans and control it independently, alternately (so as not to overload PI).

  1. Is it possible to modify this circuit to control two fans?
  2. Should I make two such circuits and connect them in parallel to a 12v power supply?
  3. Or maybe make another better layout, someone from 'ekektroda' told me that the circuit is wrong...
  • Questions: (1) Are you using 2N2222 to drive one fan, and BC237 to drive another? (2) I guess 300R is transistor base to Rpi, 10k is base to ground. Diode is flyback across the fan motor. Please correct me if I made wrong guesses. Yes, you can connect the two fan driving circuits in parallel, connected to the same 12V power supply. If you don't drive the two circuits at the same time, then you are not "overloading" something. If someone tells the circuit is wrong, perhaps you can draw the schematic and let us see.
    – tlfong01
    Oct 7 '19 at 13:27
  • Since you are using an external power supply to power the motors and only use the Pi to control them using the transistors, there's no problem in driving multiple of these fans. Just make sure the current out of the GPIO pins isn't getting to high (I think the limit is 50mA per Pin)
    – PMF
    Oct 7 '19 at 13:33
  • @tlfong01 (1) no, I use both to controll one fan. (2) yes sir. My power suply is 12V 2.0A. Fans are 0,18 A. It seems to me that I should not overloading.
    – Konop
    Oct 7 '19 at 14:04
  • @PMF 300R is transistor should ensure that, right?
    – Konop
    Oct 7 '19 at 14:05
  • @Konop, Oh my goodness, 2 transistors to drive one fan is "innovative"! Let me redraw the circuit and do the circuit analysis again. I now tend to agree with your friend that your design has a program. :) Anyway, let us check out later.
    – tlfong01
    Oct 7 '19 at 14:13

What you have shown is NOT a "schematic", it is a layout diagram, but is too vague to determine exactly what you have (although we can guess), but seems unnecessarily complex.

RPi_GPIO_Interface_Circuits shows output circuits which should work for your small motors. (The Driving a relay is most appropriate).

If using a single transistor you should use a smaller base resistor (~270Ω - although the exact value is not critical).

If using a complementary Darlington pair (as I guess you are currently) a lower base current would suffice.

Use 2 circuits - one for each motor if you want independent control, but you should be able to drive 2 motors in parallel.



I am using two transistors to drive two fans. Is the following circuit OK?

two fan circuit

two fan circuit 2

two fan circuit


Looks OK.

Learning Notes

Circuit Analysis

(1) Ib = 3V / 300R = 3000 / 300 mA ~= 10 mA.

(2) Transistor current amplification factor (h(fe)) > 100.

(3) Ic = Ib x 100 = 10mA x 100 = 1000 mA.

(4) Motor resistance would limit Ic to << 1000 mA, possibly < 200 mA.


(1) 2N2222 datasheet - Fairchild/On

(3) 1N4001 datasheet - Diodes

(2) 12V 40mm Cooling fan motor datasheet

(3) Measuring Current in 12V DC Fan - EE Stack Exchange

(4) Electroda Forums

(5) Introduction to NPN Transistor - Electronics Tutorials

(6) NPN Transistor as a switch - Electronics Tutorials

(7) AliExpress PWM 40mm, 12V, 400mA, 5W, 28,000rpm, 4wire, Double Ball Bearing, 16.3cm, 58dB, CPU Cooling Fan, - GreenTech SanYo SanAce, US$4

  • Can I use second 2N2222 transistor instead BC237 in this circuit?
    – Konop
    Oct 7 '19 at 14:21
  • You mean two 2N2222 transistors. That would be better, because two sister can work together, sharing the work. And it is easier to calculate the load.
    – tlfong01
    Oct 7 '19 at 14:24
  • There you are: Version 0.3 with two 2N2222's. But why you want two 2N2222? I vaguely remember that 2N2222 can drive 500mA. So one strong 2N2222 guy can drive two CPU cooling fans, not the other way round. Anyway, perhaps PMF can discuss with you to conclude something. I am feeling dizzy now, because it is bed time for me. I hope I could sleep well, not having a bad dream, like surrounded by the Arduino guys watching this forum, LOL at three stupid Rpi guys, designing wierd electronic citcuits! :) See you tomorrow and cheers!
    – tlfong01
    Oct 7 '19 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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