How to use transistor as relay?
Ruby
Posts: 35
Hi , i want to use transistor 2n2222 as a relay. But the thing is i only want to close circuit. Instead of pressing a button just sending signals by parallel port. So I wired the base to the pin from parallel port , emitter to the ground and collector to the wire which has to be 0 V. I mean without Vcc or let's say Vcc=0 V. Is it ok? I tried it and works , but gets hot!
Ps: First i didn't put resistor to the base. Is it because of that or am i missing something?
Thanks.
Ps: First i didn't put resistor to the base. Is it because of that or am i missing something?
Thanks.
Comments
Max collector current is 600mA but for a small signal transistor a more usual number is 100mA. How much current are you switching?
The useful number on that datasheet is the hFE which is the gain. Scroll down for a graph of the gain, but ballpark it is about 100. So you put 1mA into the base and it switches 100mA.
Then you can work out a base resistor value. V=IR and V is 3.3V, I is 0.001 so R could be something like 3.3k.
If you are switching higher loads than 100mA there are many other options, eg the ULN2003 (and family) where you get 7 darlington transistors in one package and can switch 500mA per transistor http://www.jaycar.com.au/images_uploaded/ULN2003.PDF
Remember, you'll want to subract the base-emitter voltage (for an NPN) first:
base_resistor = (3.3 -Vbe) / base_current
So redoing that calc comes up with a 2.7k resistor.
-Phil
What I've done in recent experiments (based on what I remember from school & read about in my old text):
Determine the desired current through the load (and into the collector) when it's on, then calculate current for the base using hfe with Ib = hfe*Ic ; that's the Ib for the threshold of saturation. To drive the transistor into for-sure saturation, now multiple the resulting base current by some fudge factor to account for hfe variances, etc. Seems 10x comes to mind. To pick the resistor, use ohm's law, given the V feeding the base and the Vbe drop (approximately 0.6V IIRC) and the desired base current.
If you need more than 500-600mA there are TO92 transistors out there that do it. The one I ran across was the ZTX649/749 from Zetex which can do 2A continuous.
Btw, if there's a load to be switched, place it between Vcc and the collector. Tie emitter to ground. The above assumes NPN since you mentioned a 2N2222.
HTH.
If you want to switch a load, then you need to put the transistor into _saturation_, so I would say take the minimum value for hFE and halve it before doing the calculations - that way you'll be putting at least 2x the minimum current into the base which will guarantee saturation (where the voltage across the transistor is properly low).
This gives you the saturation voltage for various combinations of gate current and load current.
BTW, I assume that when you refer to a "2N2222" that you really mean a "PN2222", which is more common than the metal-can version.
-Phil
The same chip can be put in a plastic TO-92 package and should be called PN2222A / PN2907A with less performance.
Basically the metal hermetically sealed package can dissipate considerably more power.
Sure, there may be some venders that put 2N2222A transistors in a plastic package and mus-label them but this would be wrong.
Just saying! Buyer be ware.
Duane