12V relay using a 5V NPN transistor to turn it on.

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was having some troubles using a NPN transistor controlling a 12V relay. I connected my circuit as in Figure A:

V+ is 12V and the input to the base of the transistor is 5V or 0V (using an Atmel Microcontroller). The resistor from the microcontroller output to the base of the transistor is 1k ohms. The transistor has an hfe value of 200.

Everything works fine when I try to switch the relay on, I apply 5V to the base of the transistor and I measure 12V across the inductive load of the relay. My problem occurs when I try to turn the relay off. I apply a 0V signal to the base of the transistor and I measure about 3.8V across the inductive load of the relay. The relay says it needs .25V to switch off, so 3.8V is way too much.

Does anyone know how to make it so when I apply a 5V signal, the relay gets 12V and when I apply a 0V signal the relay gets below .25V? Any help would be greatly appreciated!

(I'm making a motion sensor lamp that will only turn on when it's dark. It almost works, it just doesn't turn off!)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds like your doing the right thing. Have you put the diode in parallel with the coil as is shown in figure A? Its quite important to have this diode as it protects the transistor.

What part number is the transistor you are using? What is the coil resistance of the relay you are using?

oddbudman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the collector breakdown rating of the transistor and the collector current rating? Equivalently, the transistor type? And the DC coil resistance of the relay?

If you remove power and start over, does it work, again?

What is the base voltage of the transistor when you try to have it turned off?

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please double check that the collector and emitter are the right way around. If they are interchanged the transistor will exhibit low gain and low breakdown voltage.

Fig. A is correct.
Fig D is correct for inverting operation, but when you use a uC you do such things in code.
Fig B is not suitable. It will work but it will need a base drive of about 12V, so you will need to add more components to get that.
Fig C is useful when very heavy relays are used. The cascaded transistors ensure that the actual relay driver transistor gets sufficient base drive.

If you think education is expensive, try ignorance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is the relay I am using:

http://www.radioshack.com/product/index.jsp?productId=2062482

Here is the transistor I am using:

http://www.radioshack.com/product/index.jsp?productId=2062586

I got them from radioshack, I wish they came with datasheets.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think you have the transistor the wrong way around, like I said in my first post. 2N2222 is a very good transistor.

If you think education is expensive, try ignorance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Awesome, thanks Emular!!! It works.

Check out this review of the transistors I bought...

Quote:
The E and C labels are reversed on the TO-92 package. This is no problem when using the TO-92 because one can simply rotate the component; however, I had a board fabricated using the SOT-23 package which cannot be rotated (not symetric) and used the pin-outs indicated on the back label. Be careful this was an expensive mistake.

Should have read the reviews from RadioShack more carefully.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually you know what it was? The transistors I bought from radioshack came with the 2N2222, 2N3904, and 2N3906. It said on the label that they were all 2N2222 transistors (NPN). I didn't read the part numbers when using the transistors. The 2N3906 is a PNP transistor, which completely screws everything up! I must have used the 2N3906.