# Transistor basics

Discussion in 'General Electronics Chat' started by azog, Aug 25, 2008.

1. ### azog Thread Starter New Member

Aug 29, 2006
5
0
I'm trying to wrap my head around some basic operational concepts of a transistor. I'm more interested in practical applications, but most tutorials I find go way too deep into physics and theory.

So, what I did was just take a transistor and breadboard it with a relay, and would like to see if I can understand what is happening. I'm just trying to get the transistor to work as an on-off switch to turn on 12v. This is sort of what I am doing:

It's a 2n3906. The base is connected to a switch on 3.3v. The collector is connected to +12v, thru a 5k pot. The emitter is connected to one side of a relay coil, the other side of the coil is on ground. The only reason I'm using the pot is to make sure I don't overload my power supply. When I had +12v connected directly to the transistor, I could hear the fan on the power supply slow down, I guess drawing a large amount of current. I didn't destroy the power supply, nor the transistor, tho.

When the pot is turned to max resistance, the relay is off, which is what I expect. I actually see about 1.5v across the relay. When the pot is turned to a low resistance, the relay switches on, but I measure 6.4v across the relay.

(and fwiw, I measure 300ma current draw when the relay is on)

Since I have +12v on the collector, I expected to find 12-0.7 across the relay. At least, from what I read, it sounds like the transistor should drop 0.7v.

I've reversed the circuit, trying to have the relay across the collector and the +12v thru the emitter, and I'm pretty sure I measured the same behavior.

So what am I seeing? I did look at the transistor datasheet, but I'm not sure what parameters I need to keep in mind

2. ### mik3 Senior Member

Feb 4, 2008
4,846
63
This circuit is not working because your transistor is a pnp transistor. To make it work put a npn transistor. You can make it work with this transistor but you have to change the connections. What exactly do you want to do?

3. ### azog Thread Starter New Member

Aug 29, 2006
5
0
Other than learning various things, no specific goal in mind. I'd just like to grok some basic functionality of how transistors work. Just for experimenting, I trying to see if I can turn a 12v load off and on with an ATMega processor using just a transistor. That's why the relay is there, I figured it would be a good test. It's rated for 12v on the coil, it's probably more robust than an LED, and I can hear it when it clunks. Probably less of a chance of destroying something.

I'll try an NPN and see what happens.

Edit, didn't want to reply to myself. Well, that was a lot different than my previous experiment. I used an NPN, the base is still on a 3.3v switch, +12v on the emitter, and load on the collector. Now I see 10.mumble volts across the load. I didn't notice the exact number, but "close enough for government" for the nonce. I'm still trying to understand what I'm seeing, but it escapes me.

Last edited: Aug 25, 2008
4. ### Audioguru New Member

Dec 20, 2007
9,411
896
When you use an NPN transistor and the base resistor is at 3.3V then the relay will do nothing because the potentiometer limits the current.
Without the potentiomerter then the base will be at about +3.0V and the emitter will be at about only +2.3v which is much too low to drive a 12V relay.

It is good that it doesn't work because the relay coil is an inductor that creates a few hundred volts when it is turned off that would destroy the transistor. A reversed diode is connected across the relay coil to arrest the voltage spike.

Usually a load (the relay coil) is connected to the collector of a transistor for it to be turned on and off.

5. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
You need to limit the current through the base of the transistor.

If you're applying 3.3v to the base of an NPN transistor, with the emitter tied to ground 4 and no current limiting resistor, what you basically have is a forward-biased diode that begins conducting at about 0.6v, but you're subjecting it to a lot of current.

2N3904 and 2N3906 transistors are rated for a maximum collector current of around 200mA, but that is their "ragged edge" of performance. A more practical limit is around 100mA.

Take a look at the gain characteristics charts; "hFE". You'll notice that the gain starts out at perhaps 70-100 for very low collector currents, and gradually increases to over 200, then drops down to around 20 as the collector current nears 200mA.

No two transistors are exactly alike; the manufacturers only guarantee a minimum gain at a specific collector current.

Try downloading Motorola/OnSemi and Fairchild datasheets for those two transistors.

While you're at it, download datasheets for the 2N4401 and 2N4403 transistors; they're a bit higher gain with more collector current capacity.

Might as well download datasheets for the 2N2222 and the 2N2907 as well; they're not precisely complementary, but often used that way; and are pretty well suited for switching duties.

In the meantime, if you're using a 2N3904 transistor with that 3.3v supply, use a 270 Ohm resistor to limit the base current to around 10mA.

6. ### rezer Member

Aug 26, 2008
10
1
Just tie the emitter of your NPN to ground, using a 270 ohm resistor like what was suggested on your base (You can be really liberal here. You can saturate a 2N3904 with much less base current. So you can go higher, but I wouldn't go lower.) Strap a diode across the coil of the relay to suppress the back EMF. Connect the diode in a reverse bias configuration (Cathode to +12V and anode to the collector. Do this and the circuit will work fine. Have fun!