# Transistor replacing relay

Discussion in 'The Projects Forum' started by TexasTony, Jul 15, 2010.

1. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
Hey Guys, I just found this forum and have a problem hopefully you can help with.

OK, here's my current circuit. I have a small microcontroller that controls a motor through two SPDT relays controlling voltage to a small motor. It let's me put 12 volts DC to the motor, reversing polarity so I can run it both directions. It's a 5 volt controller and a 12 volt motor.

I'm looking to get rid of the two relays. It's easy with 4 transistors if everything were on the same voltage (2 per leg of the motor, one driving high & the other low controlled by the uC), but the translation from 5 to 12 throws me off. Is there a simple way to do this?

Thank you
Tony

2. ### campeck Active Member

Sep 5, 2009
194
3
If I am not mistaken an H-bridge built out of transistors can control as large a voltage as the transistors can handle with the 5v from your microcontroller.

3. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
Cam,

I think that will work great if my control voltages were the same as the drive voltage. But using your diagram, let me explain where I see a problem. Please correct me if I missed something.

Signal B goes high (5v), so we want Q2 and Q4 to turn on. Q4 will clearly turn on. That base sees 5v, and the B-E voltage is 5v. So it turns on just fine. Q2 is where I see a problem. At first, with Q4 on the emitter is 0v, so the transistor sees 5v B-E and turns on. Great. But the 12v at the collector drives 12v onto the emitter. That drops me B-E voltage from +5v to -7v which should turn it off. I would expect that transistor to eventually setting in the linear region which wouldn't be a good thing.

Does that make sense?
Thanks
Tony

4. ### campeck Active Member

Sep 5, 2009
194
3
no. not making sense. I lost which transistor you were talking about at what time.

And you wont have -7v B-E. You will have .7v B-E cause that's how much it takes to turn on.

Even if my thinking is wrong. H bridges work...I have built and used them and controlled 12v motors with 5v signals.

5. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
Cam,

If you've built them, then I should just get some parts & try it out. I appreciate the help.

Thanks
Tony

6. ### campeck Active Member

Sep 5, 2009
194
3
yeah. throw one together and measure the voltages for yourself. nothing like learning hands on!

7. ### ELECTRONERD Senior Member

May 26, 2009
1,146
16
At what voltage would you like the transistor to go into saturation?

Consider the circuit in the following schematic:

As Vs1 is increased, Ib will increase, Ic will likewise increase and Vc will decrease. Eventually, Vc will become low enough for the transistor to enter the saturation region. This is known as the Edge of Saturation or (EOS). The following equations govern it's conditions:

$I_C_(_E_O_S_) = \frac{V_C_C - 0.3}{R_C} - Assuming V_B_E = 0.7V$

$I_B_(_E_O_S_) = \frac{I_C_(_E_O_S_)}{\beta}$

$V_I_(_E_O_S_) = I_B_(_E_O_S_)* R_B + V_B_E$

In the first equation, the "0.3" is defined as the Vce saturation voltage, which is available on the datasheet for whatever transistor you might select. As you can see from the last equation, Rb adjusts which voltage you'd like your transistor to go into the saturation region.

• ###### TransistorAsSwitch.PNG
File size:
5.1 KB
Views:
352
Last edited: Jul 16, 2010
8. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
Another way.

Zener voltage (or LED drop) should be ½Vcc + 1V.

9. ### ELECTRONERD Senior Member

May 26, 2009
1,146
16
I like the LED edition, as it indicates when it's in saturation or cutoff.

10. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
Cam,

I got the parts last night & built the circuit today.

It didn't work to be short. It puts out about 3 volts. You were exactly right, the top BE has about .7 v. The input control for the top transistor was 5v, with a 1 volt drop across the 510 ohm resistor. So the base was at 4v and the BE drop was .7 so the output voltage was about 3.3v.

Any suggestions?

Thanks
Tony

11. ### Audioguru New Member

Dec 20, 2007
9,411
896
You cannot use NPN transistors at the top, you need PNP transistors.
You show TIP120 darlington transistors that have a saturated Vce of 1V to 2V.

Make the circuit like this:

File size:
12.3 KB
Views:
115
12. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
AudioGuru,

Thanks. I was thinking it would take a more complicated circuit such as yours. But I'm looking at it, and it'll be more expensive to populate all these components than just eat the \$2.50 for two relays. I'm buying parts by the 100's, and all the individual pieces plus assembly doesn't compete.

I do appreciate the guidance. It was a worthwhile effort, but I'll just stick with the relays for now.

Thanks again
Tony

13. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
I may have missed it, what is your motor current?

14. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
Up to 250 mA.

15. ### JoeJester AAC Fanatic!

Apr 26, 2005
3,401
1,218
12 V at 250 mA. Ok. What is the stall current?

16. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
Let me clarify. In normal operation the motor draws around 100 mA. I have a series power resistor with the motor to avoid damage (gear motor). At stall, the motor draws 250 mA but for a very short time before I sense the stall & turn it off (1/4 second).

17. ### JoeJester AAC Fanatic!

Apr 26, 2005
3,401
1,218
ok ... thanks.

You can scale down that H-Bridge with components closer to the .25 A ... like 2N4401 (NPN) and 2N4402 (PNP). They should be good to 600 mA max as you are preventing the stall current from getting out of control.

18. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
Audioguru, or any analog guru...

I finally wired up this circuit. And of course it's not working quite right.

For the transistors, I chose some similar values. Note I get everything through digikey, so I match to what they have (which is usually everything...). For the NPN, I got a MMBT2222A. The PNP is a MMBT2907A. Transistors are SOT23, all my resistors are 0805 package.

Circuit powers up and outputs are right. Only problem is that the 33 ohm resistor starts smoking. It has 10 volts across it, so I can see why! Basically the NPN and PNP transistors are dropping .7v, leaving just over 10v to go across that resistor.

Here's my thinking, correct me if I'm wrong. Transistors have a gain of 100. The load is in the 100-200 mA. So if I run 2-4 mA through the control side (33 ohm), that should saturate the transistors. 10 volts / .004 amps = 2.5 k ohm.

I'll probably order a couple of sizes, maybe 3.3k, 2.7, 2.2k. Heck, I've got some of the 1k ohm resistors that should work just fine. It'll waste a little power (10 mA vs 3-5 mA), but I can tune that later. I can use the 1k for today until I get other values.

Thoughts? It's almost midnight and my mind might be mis-firing.
Thanks
Tony

19. ### JoeJester AAC Fanatic!

Apr 26, 2005
3,401
1,218
is the motor connected or are the connections shorted? if the connections are shorted, you certainly can have 10 V across the 33 ohm resistor. You would be better suited if you replaced the 33 ohm resistor in series with the motor with a fuse of 250 mA or higher if the stall current is 250 mA.

Check and make sure your motor connections aren't shorting together.

With the 33 ohm resistor in the circuit, your losing about 2.5 volts to drive the motor. Replacing that with a fuse your voltage loss will be less and the motor will get more than 11 volts at it's terminals.

20. ### TexasTony Thread Starter Active Member

Jul 15, 2010
41
0
Hey Joe...
I'm sure the motor's not shorted. The motor is turning as expected. Current is about expectation (100mA when not stalled).

I'm not sure why you would think the motor is shorted. Can you explain how you got to that idea? I don't see where the motor's current would go through the 33 ohm resistor. Rather it is just there to turn on the high-side transistor, allowing enough current to keep it biased & saturated. If it's not saturated, then I'd probably burn up the transistors...

Even after sleeping on it, I'm convinced that the 33 ohm is too low. Granted, not enough sleep, but I still need the job...

Funny to see you website. I used to do EMC testing for about a decade... funny work that is!

Thanks
Tony