Relay Driver - Check My Math

Started by kurtlives, July 19, 2010, 08:04:01 PM

Previous topic - Next topic

kurtlives

Referencing this article http://www.jaycar.com.au/images_uploaded/relaydrv.pdf

I have a 5V DC relay and 5V DC source. My relay has a DC resistance of 130R.
Therefore current is 0.038A.

I am using a 2N5088 transistor, min hFE is quoted as 300.
0.038A/300 = 0.000127 A

Going by the article we double this value so the transistor does saturate.
So our current is now 0.000254A.

Finally to find that base resistor I divide the 5V by the current we just found. And I get a resistance of ~ 20K.


Correct?
Thanks...
My DIY site:
www.pdfelectronics.com

R.G.

Quote from: kurtlives on July 19, 2010, 08:04:01 PM
I have a 5V DC relay and 5V DC source. My relay has a DC resistance of 130R.
Therefore current is 0.038A.

I am using a 2N5088 transistor, min hFE is quoted as 300.
0.038A/300 = 0.000127 A

Going by the article we double this value so the transistor does saturate.
So our current is now 0.000254A.

Correct?
You've been through the math properly, I guess. But no, I would not try to pull 38ma through a 2N5088 with 0.2mA of base current.

It might work. But the 2N5088 is an amplifier specialized transistor, not a switching specialized one. The difference is in the saturation performance. And in the fact that current gain is low at small currents and again falls off at large ones relative to the nominal target current of the device.

I personally would put at least a milliamp into the base to try to saturate it. Better yet, I'd use a 2N3904 (violating Keen's Second Law) for a relay driver.

Looking here: http://www.onsemi.com/pub_link/Collateral/2N5088-D.PDF the maximum current for the 2N5088 is 50ma, quite close to the 38ma you're trying to make it take. Working up to the specified max is OK if the situation is well defined, I guess. But I get nervous. Notice that on page 2, under "collector-emitter saturation voltage", they quote the voltage as 0.5V, but they also specify this at a collector current of 10ma and a base current of 1ma. They're forcing it to a gain of 10 for this test to get the collector saturation voltage down. They again talk about saturation, figure 9, "ON" voltages, but this is also at a forced gain of 10 to get saturation down.

Shoot, it'll probably work, but juice up the base drive. Give it at least 1ma, better yet 4.

Compare to the 2N3904: http://www.fairchildsemi.com/ds/2N/2N3904.pdf.
Max continuous collector current 200ma; Vce sat at a gain of 10 specified to 0.2V at 10ma Ic and 0.3V at 50ma Ic. Much better switching, and much the same base drive needed to get it. And they give you typical curves of Vcesat versus collector current and Vbe versus collector current at gain=10.

If you can use 3904's, use them. If you're just trying to see if it'll work, the 5088 probably will. But for long term sturdiness, I'd use the 3904.

Switching circuits are one of the places where the dictum that any small signal NPN will do starts to fail.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

kurtlives

Thanks R.G.

I just picked the 5088 because that is a common BJT transistor that has many uses. Considered the 2N3904, probably should have used that, I have more.

I will use the 2N3904 then. I will rework the math later for the base resistor.

What should I use as my min hFE, I see it differs on the current pulled?
My DIY site:
www.pdfelectronics.com

kurtlives

Hey R.G., did a bit of snooping on transistors as switches, learned a few things.

Looks like the 2N3904 has a min hFE of 100. With the 5V and 130R coil resistance, I work out the base resistor should be around 6K6. That work?
My DIY site:
www.pdfelectronics.com

Gurner

As a Brit...seeing Maths written as 'Math' is just plain wrong!

It's short for Mathematics - did none of you notice that you're all missing an 's'?!

One of you must know a teacher - if so, for the sake of English, please let him know (he can then update colleagues) - they've obviously all overlooked this  :icon_mrgreen:

(and while I'm on the word 'route' is meant to rhyme with toot & not tout)

There, I have exorcised the demons :icon_evil:  "this forum is cleeeean"   ;D

R.G.

Quote from: Gurner on July 20, 2010, 05:07:38 PM
As a Brit...seeing Maths written as 'Math' is just plain wrong!
It's short for Mathematics - did none of you notice that you're all missing an 's'?!
Several times in my life I've noticed that I'm missing my "s".  :icon_lol: Sometimes I walked it off, worked it off, and occasionally just laughed it off. Still missing it at times. I sometimes lose my "s" in a bet - er, wager.

I was surprised upon my first stay in a hotel in England - Winchester - when the gentleman at the desk asked me if I wanted to be knocked up in the morning. Fortunately, I was able to overcome my Southern (bad even for the USA) english (doesn't deserve a capital "E" the way we do it) teaching and suppress my surprise.

The IBM technical library at Hursley Park had three dictionaries of US to UK English to help in the translations. As they say, two countries divided by a common language.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

.Mike

Quote from: Gurner on July 20, 2010, 05:07:38 PM
As a Brit...seeing Maths written as 'Math' is just plain wrong!

It's short for Mathematics - did none of you notice that you're all missing an 's'?!

The Online Etymology Dictionary records the earliest year for which there is a surviving written record of that word. It has "math" listed as the American English shortening of "mathematics," from 1890. It has the British preference "maths" from 1911. Looks like we beat you by 21 years. ;)

http://www.etymonline.com/index.php?search=math

Mike
If you're not doing it for yourself, it's not DIY. ;)

My effects site: Just one more build... | My website: America's Debate.

phector2004

Just out of curiosity, where exactly would a relay stand in this field? I've seen them before in robotics projects and the like, but I can't picture them in audio applications...

Is it for an effect switch with a non-latching switch? Do you have multiple output jacks with a relay, such that inserting a cable into one "picks" that one as the output for the signal to go to?

Really gets me scratching my head...  ???

JKowalski

#8
You could also just use a MOSFET switch for the relay, real low on resistance... Easily switched


Quote from: phector2004 on July 20, 2010, 11:03:13 PM
Just out of curiosity, where exactly would a relay stand in this field? I've seen them before in robotics projects and the like, but I can't picture them in audio applications...

Is it for an effect switch with a non-latching switch? Do you have multiple output jacks with a relay, such that inserting a cable into one "picks" that one as the output for the signal to go to?

Really gets me scratching my head...  ???

People use them for replicating "true bypass" in a voltage controlled way for switching units (like programmed pedal switchers or w/e) Basically remote controlled DPDT switches.

They are also useful as speaker protection in cases where amps have large turn on transients...




kurtlives

Quote from: phector2004 on July 20, 2010, 11:03:13 PM
Just out of curiosity, where exactly would a relay stand in this field? I've seen them before in robotics projects and the like, but I can't picture them in audio applications...

Is it for an effect switch with a non-latching switch? Do you have multiple output jacks with a relay, such that inserting a cable into one "picks" that one as the output for the signal to go to?

Really gets me scratching my head...  ???
You can use them anywhere you can use a mechanical switch (well that's a generalization).

I am using two relays to turn on and off the Overdrive and Reverb on an amp I have designed and now building.


6K6 seem right there?
My DIY site:
www.pdfelectronics.com

R.G.

Quote from: kurtlives on July 20, 2010, 04:20:00 PM
Looks like the 2N3904 has a min hFE of 100. With the 5V and 130R coil resistance, I work out the base resistor should be around 6K6. That work?
You're missing something. The stated hFE is not terribly useful when you're doing saturated switching with single bipolars. Notice the term "saturated to a gain of ten"
That means that whatever the load current is, you put 1/10 of the load current into the base.

When you drive a bipolar, you put a certain DC current into the base. Let's say that's 100uA. Let's further assume a 9V supply and a 1K load resistor. What's the collector current and voltage? It depends on the DC current gain of the transistor if there is no emitter resistor.

If the transistor's gain is 100, then you're putting in 100uA (0.1ma) and the transistor allows 100 times that to flow - 10ma. 10ma through 1K is 10V, but the power supply is only 9V, so the collector tries to pull in 10ma and fails. The entire 9V supply, less the transistor saturation losses, appears across the 1K load resistor and the voltage across it is almost the full power supply.

What happens if the transistor gain is only 50? In that case the transistor tries to let 50*0.1ma = 5ma flow, and succeeds because 5ma*1K in the collector is only 5V, and that leaves 4V out of the 9V supply for the transistor. So the collector-emitter voltage is the remaining 4V.

From the preceding two thought experiments, we could imagine that with a 1K load, any transistor gain over 90 will be saturated (that is, can't get any lower Vce)  and any transistor with a gain of under 90 will not be saturated.

What happens when we have a transistor with a gain of 100, power supply of 9V, load of 1K, and base current of 0.1ma? Yep, example 1, it's saturated. But in this case, the collector load is a pot, connected as a variable resistor. And we turn it down from 1K to 900 ohms. At 900 ohms, the transistor wants to pull 100*0.1ma = 10ma, and 9V/900 ohms is 10ma. It's ...just...barely... saturated. As we turn the collector load resistor down the current in the collector remains the same 10ma as it's forced to by the base current and current gain, but the resistor no longer drops the full supply voltage and the collector voltage rises. The transistor is said to have been pulled out of saturation.

This is a big deal because we do not in general want switches to dissipate power. We want them to be either off, with voltage and no current, or on with current but no voltage. We can't get fully to zero volts with bipolars, but we can get the collector-emitter voltage down to insignificant', under maybe 0.5V, sometimes down to 0.1V.

As the collector voltage rises, the current remains the same, so the power in the switching transistor rises, because P=V*I. As  you pull a switch transistor out of saturation, two things happen. The voltage across the load goes down, and the transistor gets hot. Granted, this is not a huge deal with 9V battery powered stuff because you can't often kill a bipolar with a 9V battery. Usually. But the problem is, as you pull out of saturation, you no longer have control of what is happening with the load. It's dependent on the transistor gain, which is hugely unreliable, variable, and in general flakey.

If you're going to switch, make #^&*$#@ sure it stays switched. Never, ever design a switching circuit with just barely enough base drive. That's asking for problems.

In your case, you're pulling 38ma in the collector. The base-emitter voltage is 0.7V nominal (we'll check the datasheet for the actual number later) and so the base current is the signal voltage minus 0.7V divided by the base resistor. Let's design for a gain of between 10 where we are SURE its saturated and 50 which will be kinda OK if we're not designing for a long term reliability. Minimum gain of 100 is for the active region. At 50, the base resistor is ... um, what exactly IS that base drive voltage??

CMOS logic does a pretty good pull up to the power supply at low currents. TTL does not. Switches are good. What's driving your base??

Let's say it's a switch or CMOS, so the base drive voltage is 8.7V or more. So the base resistor is R = (8.7-0.7)/(0.038/50) = 10.5K. If we want a gain of 10 saturated, that's 2.1K. Something in that range will be OK, going from a saturated gain of 10 upwards.

Looked at another way, yeah, the 6.8K will work. It will work for base drive voltages down to (0.038/100)*6.8K = 2.6V. Good.

You're OK at 6.8K.

Whew!
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

kurtlives

Thanks for the insight RG, interesting read there.

What I am going is connected that base resistor right to my 5V+ and the other end to well the base.

I am breaking the connection between the emitter and ground to turn the switch on and off.
My DIY site:
www.pdfelectronics.com

pjwhite

Another reason to apply more current than you need to the base of a switching transistor:  Temperature.  A cold transistor has a lower HFe than one at normal room temperature, and you want your circuit to switch properly under all conditions.

R.G.

Quote from: kurtlives on July 21, 2010, 11:02:20 AM
What I am going is connected that base resistor right to my 5V+ and the other end to well the base.
I am breaking the connection between the emitter and ground to turn the switch on and off.
If you're doing that, why not just ditch the transistor and use the switch to switch the relay?
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

amptramp

Don't assume there is any great accuracy in the relay coil resistance, either.  I recall one relay in an aircraft design that I was working on where the coil resistance was +/- 20% and it had to be used over a wide temperature range.  The resistance of copper wire has a 3880 ppm variation with temperature, so the rating at room temperature was not the final story.  It turned out that the coil resistance varied from 170 ohms to 410 ohms with tolerance and temperture and you have to size the transistor driver for the minimum resistance and maximum voltage.  You would think coils are wound to an exact value but like guitar pickups, some of them are just wound until they fill the coil form.

kurtlives

Quote from: R.G. on July 21, 2010, 11:34:50 AM
Quote from: kurtlives on July 21, 2010, 11:02:20 AM
What I am going is connected that base resistor right to my 5V+ and the other end to well the base.
I am breaking the connection between the emitter and ground to turn the switch on and off.
If you're doing that, why not just ditch the transistor and use the switch to switch the relay?
I thought the transistor driver circuit would be safer in the sense of making sure the relays don't fail and not come on. I have done this relay circuit many times before sans transistors. Just something I wanted to try.
My DIY site:
www.pdfelectronics.com

JKowalski

Quote from: kurtlives on July 21, 2010, 11:42:38 AM
Quote from: R.G. on July 21, 2010, 11:34:50 AM
Quote from: kurtlives on July 21, 2010, 11:02:20 AM
What I am going is connected that base resistor right to my 5V+ and the other end to well the base.
I am breaking the connection between the emitter and ground to turn the switch on and off.
If you're doing that, why not just ditch the transistor and use the switch to switch the relay?
I thought the transistor driver circuit would be safer in the sense of making sure the relays don't fail and not come on. I have done this relay circuit many times before sans transistors. Just something I wanted to try.

Having the transistor control the relay would just add another possibility of failure, not reinforce the circuit, I would think. If the switch dies, then the transistors not gonna help it work no matter what. If the transistor died... well it'd probably short and I guess you wouldn't notice that... but still. It's not gonna add anything to the circuit.