2N2222 transistor as a switch

![](http://C:\Users\Mr. Great\Desktop) If you can't see this image I've attached it.
I’ve used a 2n2222 Transistor, an Arduino Uno, a 12 volt power supply, a 12 volt relay and a multi-meter. On the figure, C represents the collector side of the transistor and E represents the emitter side, R represents the 12 volt relay and M represents the Multi-meter. The base is connected with a 330Ohm resistor or a 10K resistor (I’ve tried both). In principle the relay should be turned on whenever the PWM from the Arduino is high, but it is not turning on or off for whatever the signal is. I should have get 12 volts – 0.7 volts = 11.3 volts at the relay side, but instead I’m getting around 4.6 volts. What did I do wrong? Shouldn’t the drop of the transistor be 0.7 volt?

Untitled.png

Your simply applying an NPN transistor improperly. You should wire it up as a 'low side switch' with the emitter grounded, the collector to the motor and motor to +12vdc. A reverse wired diode across the motor terminals is a good idea also.

Lefty

Why not? This transistor is just a switch, right? You should have get around 11.3v after being transferred through the transistor.

No a transistor is not a switch - it switches, but its not that simple (MOSFETs are conceptually a bit more like
switches incidentally).

For an NPN transistor to conduct the base voltage has to be above the emitter voltage. The Arduino can
only generate 5V, so the emitter in your circuit has to be less than 5V (about 0.6 to 0.7V below in practice).

The circuit configuration you have is called an emitter-follower, and it not used for switching, its used for
buffering analog signals typically.

You need a "common-emitter" configuration. emitter to ground, collector to load, base via resistor to
Arduino - many examples all over this and other sites - so long as there is enough current through
the base resistor it rises 0.7V above the emitter and allows conduction.

For a transistor to be a switch it needs to go from hard-off to hard-on under control - hard-on is called
"saturated" and requires more base current than you might naively suppose (if the transistor has a gain
of 100, saturation might require the base current to be > 1/20th of collector current). In saturation the
collector voltage falls to very close to ground (below the base voltage in fact).

greatmebratu:
Why not? This transistor is just a switch, right? You should have get around 11.3v after being transferred through the transistor.

Just trying to tell you how you can make it work. Using a NPN transistor in a high side switch requires a base voltage too high to safely wire directly to a arduino 5vdc output pin unless you use a two transistor circuit.

Lefty

Ok thanks for the response guys. What I'm trying to make here is an H-bridge using only 4 2n2222 transistors. After googling, I found that the collector side of the two transistors should be connected directly to the +12v source and each of their emitters to each side of the motor as shown in the following website Motor driver using only a 2N2222 transistor? - Electrical Engineering Stack Exchange, you are saying that in order for the above circuit to work the base voltage should be as high as the motor needs to rotate. Anyways check it out and tell me what u think.

You really should use a PNP transistor for high side switching as NPN are for low side. The information in that website is not quite accurate. While that is general idea for an H-Bridge, you need PNPs between the positive supply and the load.

You can always use an other two 2N2222s to get the base voltage on the top pair of transistors up to 12V. Otherwise that circuit will not work.
There is a lot of that sort of miss information about.

Could u suggest me some PNPs suitable for this job?

You still need driver transistors though if you are using a 12V supply.

Problem solved! I’ve used two 12 volt relays, four 2N2222 NPN transistors, and an Arduino of course. I’ve connected the circuit as shown below. There seems to be one problem though, when I connect a small 6v dc motor it works fine, but when I connect a motor (a typical car window opener), the transistors will get hot and the motor won’t turn on. I suspect the transistors aren’t designed to carry that much current so I need a higher rating transistors (Correct me if I’m wrong). Could you list a higher power (Voltage and Current) rating transistors which can equivalently replace 2N2222s. Thank you all!

I am not sure I understand that schematic it doesn't use conventional symbols.

I suspect the transistors aren’t designed to carry that much current so I need a higher rating transistors

They are not, only about 600mA which is nothing for a motor of that size.

Could you list a higher power (Voltage and Current) rating transistors which can equivalently replace 2N2222s

I would not be surprised if there were not thousands of these. In fact with this current then a transistor is not the best solution and you need a logic level FET. It depends on where you live what is available in your location. Find a suppler and look for an n-channel logic level FET.