NPN transistor to run 12V 0.5A from 3.3v 4mA

I assume this question is very common, because I read a lot of answers here, but I still missing somthing..

I have "Electric Imp" module, which have max I/O pin power output of 4mA, and its run on 3.3V.
I need to run electric door, which consume 12vdc 500mA at max.

So i started and checked the 2N2222A transitor:
Ic(MAX) = 1A - good enough.
Vceo(MAX) = 40V - good enough

and now I am geting to the base needs (the gain):
in the Hfe I see that the closest is Ic=500mA, Vce = 10V (I need 500mA and 12V, so it is close enough), the gain for this will be 40, which means I need 500/40 = 12.5mA as output.. I do not have it.. am I right so far?

Another thing I am missing is - where can I see in the datasheet that 3.3V is enough on the base, BJTs is not Voltage , but current base, right?

if I am right so far, so I need 500mA/4mA = Hfe of 125, but I couldnt find such resistor.. I can add relay 12vdc coil with lower current than 500mA and use the NPN to run the coil so it will run the door lock..

Thanks, Gabi.

You are correct. With a gain of 40, the 2n2222A is not right for your limited current. There are four solutions.

1. Replace the load with something smaller. Using a smaller relay, which turns on the electric door lock. simulate this circuit – Schematic created using CircuitLab

1. Make a Darlington Pair with two transistors. The beta will square, but the voltage drop across the base will be higher (1.4V instead of 0.7V). Just need to recalculate the resistor. simulate this circuit

1. Use the 2n2222 as a switch for a PNP transistor. A 2N2907 is the typical complementary PNP transistor for the 2N2222, but any suitable PN will work. R3 is a weak pull up, R2 sets the base current for Q2 when Q1 is on. simulate this circuit

1. Use two NPN as a simple switch. This inverts logic. When your output is low, Q1 is Off, so Q2 is on via R2. When your output is high, then Q1 is On, pulling Q2's base to ground, keeping it off. The default state of this, when the GPIO is not yet turned on, may result in the lock opening when the GPIO is not yet turned on. simulate this circuit

• Fantastic answer! – Samuel Danielson Jan 4 '18 at 4:21 simulate this circuit – Schematic created using CircuitLab

Something similar like that.

• Wow, very cool, I did not knew BC517 derlington pair. in its spec I see the gain is 1000 (figure 2), and looking at the graph I see voltage drop of 1v, at 500mA Ic. so if i need 500mA and the gain is 1000, I need to give the base 0.5mA , lets say 1mA. if my output voltage is 3.3, and I need the base to get 1V for saturation, i need the resistor to get 2V. R=V/I=2/0.001=2000 ohm. Why did you wrote 0.18mA and 10Kohm on the base? (I see why the R=10Kohm if I-0.18mA, but in the spec I see gain of 1000, not 30000).. – gabi May 9 '16 at 17:48
• @gabi I have this one: fairchildsemi.com/datasheets/BC/BC517.pdf, while I was cheating the schematics with this one: ebay.com/itm/… – Marko Buršič May 9 '16 at 18:29
• I understood it, but i just need to understand the gain, you wrote it is 30000, but on figure 2 on the datasheet i see b=1000 – gabi May 9 '16 at 18:35
• Vbe(on)=1.4V; 3.3V-1.4V=1.9V, R=V/I=1.9V/0.18mA=cca 10kOhm; 0.18*30000=5400mA (saturated). I don't know why they put 100k resistor. Maybe you want something more powerful and you can choose some BD transistor or TIP122,...the BC517 is so tiny. – Marko Buršič May 9 '16 at 18:37
• @gabi Sorry, I can't explain the real hfe of this transitor, I see the beta of 1000, too. It was just an example, I would choose different one for door lock, a power transitor this is too small in my opinion. If you have two 2n2222 you can use the suggestion of Passerby. – Marko Buršič May 9 '16 at 18:43