Critique my transistor switch design.

Started by william, September 27, 2005, 06:39:46 AM

Previous topic - Next topic

william

I just prototyped a transistor switch using 2N3904 transistors and would like someone to look it over and suggest any improvments or cautions.  It's the first time I've tried something like this and thus am unsure about somethings.  My prototype didn't include the relay I plan to use.



I will be remote switching a solo switch in the effect loop of my amp.  I hate running a pair of cables from the effect send, to the front of a pedal on stage, then back to the effect return.  These cables carry audio, and thus I wish to keep them as short as possible.  The solo switch looks like this,



The switch that bypasses P2 would be the relay.

bioroids

Mmm I dont see too much variation in the voltage at D when switching. Can you post the current flowing thru the led in each case?

I think you'll need a little resistor in series with the led (this would be in parallel with the relay) so you dont risk burning it. That way the D voltage will go down to zero. Be aware that you need a relay that switches with this voltages.

Are you gonna use this with batteries?

Just some thoughts

Luck!

Miguel
Eramos tan pobres!

brett

Hi.
First I should say that I've got little experience in this.  But I feel that I know a good circuit when I see one.

I wonder why you didn't simply use one MOSFET where Q2 is?  Feeding 3V (or more) to the gate via a switch turns it on.  They have lower "on" resistance than BJTs and are more rugged devices (once installed and safe from static).

But looking at your circuit:  No major problems, tho I'm surprised that you don't destroy the LED when Q2 is on.  Is it a 6V or a 9V relay?  If it's 6V, it'll suffer some stress from excess voltage, and if it's 9V it might not be completely reliable in turning on.  Might be worth checking your voltage.

Is there some reason why 2 transistors are needed?  It seems to add unnecessary complexity and turns the circuit into an "open switch is on" type, which I find fundamentally unattractive (though that really only shows how dim I am!).

it's an interesting concept: good luck
Brett Robinson
Let a hundred flowers bloom, let a hundred schools of thought contend. (Mao Zedong)

R.G.

Bio and Brett's comments are correct. In fact, there are a few other ramifications.

- The relay won't work until you burn out the LED. An LED is a constant (kind of) voltage thing. When it's off the voltage across it is less than its threshold voltage of about 2V. When it's on, the voltage goes to that threshold voltage and ... stays. Only the current varies. It's like an ordinary silicon diode with a forward voltage of about 2V instead of 0.7V.

- You can't burn out the LED. What you have is a transistor trying to put the full 9V(8.5 actually) across the LED and failing because it's driven limply by the 110K of base resistance. That means the driver transistor is getting only (8.5V-0.5V)/110K = 72uA of base current when it's driven, so any load that needs more than that will pull the transistor out of saturation and into the linear region. If the NPN has a current gain of 200, then the max current it will pull on the collector will be 72uA*200 = 14.4ma. And this is why your LED didn't die - the transistor was feeding it a constant 14.4ma.

Here's what you need to do to make this work.
1. Put a resistor in series with the LED. This lets the transistor pull the LED to ground without it dying on the way. The resistor is calculated based on the LED voltage being about 2.0V and needing a current less than 20ma. No, you don't need a fancy internet calculator to figure LED current, and in fact using one of those damages your ability to think about it on your own. Realize that an LED needs two volts of the power supply, leaving Vsupply-2 for the resistor. Then ohm's law tells you that the resistor is R = (vsupply-VLED)/(desired current), and you pick the desired current to get the brightness you need.
2. Get some more base drive to the driver transistor. How much? Here's the design procedure:
(a) How much current does the relay need? Look at the coil resistance. The coil resistance will be specified, and it tells you that if the coil is 560 ohms ( a not-unreasonable value for a 9V relay) then the current is going to be Vsupply/Rcoil, ignoring for the moment the driver transistor saturation voltage. Let's say that it is 8.5V/560 = 15.1ma. You have to pull that much current through the relay or IT WON'T SWITCH! Cool. Got that relay nailed down, right?

Nope. You're running from a battery. The relay actually needs a specific current to switch. So if your battery sags to 7.5V, will the relay still work? Hmmm... OK, 7.5V and 560 ohms is 13.3ma. Is that enough? Check the relay datasheet. And what happens to the transistor with a fresh battery? with a 9.5V battery, the relay current is 9.5/560 = 16.9ma.
(b) The transistor is driving the LED too. The LED is pulling whatever you decided, typically 10 to 20ma. Let's say you set it to 10.
(c) The transistor has to saturate to well under a volt pulling 16.9+10 = 26.9ma through its collector. The transistor datasheets will tell you what its best saturation voltage is at that current, but let's say for example it's 0.3V, which is suitably small. You have to provide enough base current to get it there. Let's say for example that you can reach 0.3V with a collector current of 30ma at a current gain of 100. (saturation current gains are lower than the active mode current gains) So you need 30ma/100 = 300uA of base current to do this. The way to get this is to make R3 be the resistor that limits current and R4 be 0. Now when you want the driver transistor on, R3 supplies its base current. That's 300ma, the Vbe of the driver is 0.7V, so you need R3's value to be (7.5v-0.7V)/300uA at low battery, or 22.7K. Make R3 22K. That means that at high supply voltages you get more base current, about 9.5-0.5/22K = 409uA, but that's OK.
(d) Now you have to turn that driver transistor off. You do that by shunting its base to less than 0.4V. Your first transistor does that nicely, as would a hard metal switch. Let's say you're using the transistor circuit as shown. This transistor has a collector voltage that stays down at the Vbe of the driver transistor when the driver is driving, and pulls the driver base to ground when you want it off. It only needs to saturate 409uA worst case to under 0.4V. Let's assume it has that same 100 gain at 409uA (which it may not - gotta check the data sheet) so you only need 409/100 = 4uA of base current to do this. However, 4ua is awfully small for other reasons. Let's put that up at 500uA just to keep the impedance on the switching lines low for noise immunity. It will *certainly* do that. In fact the 10K you have there now will let in a minimum of 700uA at low battery, so you're fine as is.

3. You're going to have a hard time finding a 9V relay. The relay makers all make 9V relays. The distributors just don't stock them. Unless you're very, very lucky, you'll have a choice of 5V and 12V relays. A 9V battery will just barely sometimes pull in a 12V relay if the battery is fresh. A 9V battery that's sagged to 8V will not. So you will have to either bump up to 12V supply for this, or use 5V relays - which have lower coil resistances and need more current to pull them in. So you'll have to go back through that design procedure with relays that you can actually get your hands on, not devices made out of pure unobtainium.

4. If you do run from batteries, the relays eat a fair amount of current. Relays work best from power supplies instead of batteries. There are workarounds, like latching relays, but that's more complex.

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.

william

I'll be using a 12v dc transformer to power things, and 5v relays for the switching.  I was planning on using a voltage regulator to get the 12v to 9v, and then a voltage divider to get the 9v down to 5 for the relays.  When I get home from work I'll figure out the things RG has suggested.  I did think of using only one trasistor, but I'm basing this off an amp switch that does what I'm looking to do.  I'm not sure myself why two transistors are used.  I've asked a few people with little success.

toneman

2 sum it up.
A) U need a resistor in series with the LED.
B) U can run a 5V relay on 9V by using a limiting Resistor.
C)  U might put a 10K pull-down R @ the Base of Q1.

U could probably use just 1 tranny(2N2222) if it's a small reedrelay.
Then, a + on B of Q1, over-rides pulldown, turns on Q1, lights LED, relay on.

staytriggered
tone
  • SUPPORTER
TONE to the BONE says:  If youTHINK you got a GOOD deal:  you DID!