×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Help with transistor relay switch
3

Help with transistor relay switch

Help with transistor relay switch

(OP)
I need a circuit for a simple transistor switch for an automotive hobby application, designed so that when the base of a switching transistor is grounded, a relay that is connected to +12v on one side, and the collector of the transistor (I guess), on the other side, will be closed.  The emitter will be connected to ground.

One catch is that the base will be connected to a wire that sends varying resistances, from about 500 ohms, to 2k ohms, and I don't want that functionality interfered with, so I guess the input to the transistor switch (base) should have a high impedance, maybe 50k ohms or so.

Any help, including other ideas, will be greatly appreciated.

Thanks in advance,

Mitch
 

RE: Help with transistor relay switch

I need the following data:
1.) The input will be voltage sensitive. Input impedance
  more than 100kOhm. If the input voltage higher than
  1/2 of battery VTG, the relay is open if lower, then   closed . If the relay is open, it will use less than 1 mA. Is this OK?

2.) Do you need a few pieces or for production?

3.) What is the relay supposed to switch ? (Ac,Dc, V,A ?)


<nbucska@pcperipherals DOT com> subj: eng-tips
read FAQ240-1032

RE: Help with transistor relay switch

(OP)
Hi, thanks again for the assistance.

1) The wire that will be grounded sits at about 10v, and when closed to ground through different resistor values, only sinks between 1 and 2 ma.  I guess I'll just have to test it to see if an addition of 1 ma of current will affect the operation of the circuit. When closed, the relay uses about 120 ma.

2) I'm only making one.

3) The relay operates a horn.

Maybe I should explain - I'm adding switch controls to a steering wheel.  There is only one wire available to carry the signals through what BMW calls a slip ring.  When pressed, each switch connects a different resistor value to ground.  I have to share the horn wire to do this.  The horn wire will be completely shorted to ground, when it's honked.  Obviously you can't use the switches and horn at the same time.

The switched resistances connect to a module by Peripheral Electronics, that interprets them based on the switch pressed, then generates an IR signal to control a radio.  It's a really neat module, basically a programmable universal remote, for the car.

Obviously, my knowledge of electronics is very basic.

Thanks again,

Mitch

RE: Help with transistor relay switch

You need two transistors e.g.  MPS2222A and one diode 1N4001 from Radio shack and 3 resistors . The transistors T1 and T2 have emitter,collector and base, The diode
anode and cathode ( marked with a black band )and the resistors have two wires I mark  1 and 2 arbitrarily.
The resistors are around 2K,5K and 10K (+/- 20% is ok.
i.e. 8K-12K etc.)

Input --- 5K.1
5K.2 --- T1.b
+2V---T1.c---Relay.1---D.c
T1.e --- 2K.1
2K.2 --- 10K.1 ---T2.b
10K.2 --- GND
T2.e---GND
T2.c---D.a --- relay.2

<nbucska@pcperipherals DOT com> subj: eng-tips
read FAQ240-1032

RE: Help with transistor relay switch

(OP)
I forgot to mention that the horn relay is already connected to +12v, and the side that I have in the steering wheel is the other side of the coil, which gets grounded to sound the horn.  I don't know if this matters.  I'll try to breadboard the circuit this weekend.
Thanks again,
Mitch

RE: Help with transistor relay switch

(OP)
I built the circuit today, and it works, but not the way I expected.  When I ground the input, nothing happens.  But when I connect it to 12v or even a lower voltage like 6v (I'm using two 6v batteries to test), the relay closes.

I need it to close when the input is grounded.  Did I wire it wrong?

Thanks again for the help.

Mitch

RE: Help with transistor relay switch

oops, I did.
In the 3rd line of the netlist +2 V should be +12V
but looks like you corrected it.

It is ok. that one side of the relay is at +12,(relay.1)
the other is switched to GND (relay.2). The circuit
is connected in addition -- parallel -- to  the switch
so either can turn on the horn.


You will need one more transistor : T3.

Replace the 2K with 20K  
Disconnect T2.c from the D.a ---relay.2 ;; Free T2's coll.
New connections:
+12 -- 2K.1     
2K.2 --T2.c -- T3.b
T3.e --GND
T3.c -- D.a -- relay.2

Sorry for the inconvenience.


<nbucska@pcperipherals DOT com> subj: eng-tips
read FAQ240-1032

RE: Help with transistor relay switch

You can do it a lot simpler with just one transistor if you use a PNP type. Like a 2N2907.

Connect emitter of transistor to relay coil (the one that isn't connected to +12 V).

Connect collector of transistor to GND.

Connect your input signal to base of transistor. No series resistor needed (or wanted).

Add a free-wheeling diode across the relay coil (if you don't have one there already.


The transistor works as an impedance reducer (aka emitter follower) so that your 500 - 2000 ohms internal resistance is reduced by the current gain of transistor. It will be in the 100 - 200 range. This means that the relay coil will see a resistor in the ten ohms range connected between free coil and GND when your switch is closed.

The input resistance of this "circuit" is relay coil resistance times transistor current gain. It will probably be about ten kohms, which I hope is sufficiently high and doesn't influence the way the rest of the circuit works.

If the relay needs full voltage to pull in or if it consumes a lot of current (more than a few hundred mA), you may need an intermediate stage. But I do not think that it will be necessary.

Another way of doing it would be to use a simple CMOS gate from the 4000 family. It has a very high input impedance and it will probably need some transient protection on inputs as well as supply lines. Put a transistor after the gate and get the logic right. It can work directly off the 12 V rail - but beware of quite large voltage fluktuations. You will probably need a dropping resistor and a zener to be more safe than sorry.

RE: Help with transistor relay switch

SK:
Guilty in not getting the logic right.

CMOS gate with the caveats is OK.

One PNP won't do it: the relay's coil is i00 ohm and
the input can't tolerate beta*100 ohm load.
10K is not enough.

PNP with beta>>500 is not so common, Darlington's
 Vsat may be too much. ( I don't know the relay)

The base resistor is to reduce the effect of power glitches like the transient protection You recommend.

" There are many ways to skin the cat..."

<nbucska@pcperipherals DOT com> subj: eng-tips
read FAQ240-1032

RE: Help with transistor relay switch

(OP)
Thanks, guys.  Skogsgurra, I tried exactly that a couple hours ago, except I used 5k in series with the base, and 33k from base to 12v.  I have no idea if this is necessary.  

It worked on the table, but not in the car.  I think what you mentioned about reducing the resistance by the gain of the transistor, is what made the Peripheral Electronics module, fail. The car battery died, so I can't test it for a while.

Also, the horn would honk briefly when I turned the ignition on, and when I turned it off.  Maybe I need some kind of delay.  This is getting a little more complicated than I thought it would.  

I'll look into the CMOS gate.  If there are any similar circuits around, please point me in the right direction.

Thanks,
Mitch


RE: Help with transistor relay switch

(OP)
I think I can do this now.  I'll use a NOR gate, so that when the input is grounded, the output will turn on an NPN transistor.

I haven't been able to find out what resistance to ground a CMOS gate's input needs, in order to trigger.  Hopefully it's much less than 500 ohms, or this won't work.  Can someone confirm this?

So far, this has been an interesting education.

Thanks,
Mitch

RE: Help with transistor relay switch

Much less than or much more than 500 ohms.

The input impedance is close to infinite (many megohms - gigaohms) so the impedance of the controlling signal doesn't matter at all.

RE: Help with transistor relay switch

I had about the same requirment in a jet engine test stand.  One engine sourced and the other sunk.  I prefer the PNP method but a couple changes. Would add about 5 diodes in series with the base (or a 4.7V zener),in addition to a 20K resistor, to add a little offset voltage and some resistance from the base to emitter. I would seriously consider adding a cap also of about 1 uf because of spikes you will be getting from the horn or relay.  Frankly no one is driving a horn just from a switch contact. Emitter goes to +12V, collector to relay, other side of relay to ground.  It would likely destroy itself if you just put a transistor in there from a spike.

RE: Help with transistor relay switch

(OP)
Since the relay is already connected to +12v somewhere in the car, I connected the other side of the relay to the emitter of the PNP transistor, and the collector to ground.  I'll try a zener diode in series with a 20k resistor between the base and the wire that senses resistance from the Peripheral Electronics module, and we'll see what happens.  I have a 5.1v zener here.

I'll try this tomorrow. Since Radio doesn't sell 4000 series CMOS, I'll mail order them if this doesn't work.

Does the cap go across the relay?  Also, the horn honking briefly when the ignition is turned on and off, is still a concern.  Maybe the zener will help.  Is the 33k resistor between +12v and the base, still necessary?

Thanks,
Mitch

RE: Help with transistor relay switch

(OP)
I tried the zener diode in series with the base, and it still doesn't work.  I did make one mistake - the lowest resistance is 200 ohms, not 500, so the circuit should not respond unless it sees a ground, or something very close.  Also, the circuit is triggered on power up, so the horn honks each time the ignition is turned on.

I'll order some CMOS 4000 series integrated circuits from DigiKey, this week.

Mitch

RE: Help with transistor relay switch

You should check the other input ( with the switched resistors ) if it doesn't ground then when you turn on or off the power. If it does, you need a delay.

<nbucska@pcperipherals DOT com> subj: eng-tips
read FAQ240-1032

RE: Help with transistor relay switch

(OP)
I'll do that when the ic's arrive.  How would I incorporate a delay?

If this circuit doesn't work, I know I can use a Basic Stamp to accomplish this.  The input will go to one I/O pin and I can use the RCTIME function to read the resistance (indirectly, but it will work), and six I/O's for output - one for the horn, and several for the Peripheral Electronics module, each grounding a different resistor value.  This certaily is overkill, but it does offer the advantage of being able to make one button accomplish multiple functions by pressing twice quickly, holding it in, etc.  I'm at home with software!

Thanks,
Mitch

RE: Help with transistor relay switch

First, the horn honking.  Many vehicle key switches turn off unnecessary circuits when the engine is started.  This means that the 12V you are monitoring goes to zero.  Although the horn switch isn't closed, there is a ground path through the relay to the now powered off 12V circuits.  You can solve this by powering your new relay by the same switched 12V.

Second, back to fundimentals.  When E of a PNP is connected to the relay, basically the same voltage at the base appears at the E.  There is at least a 0.7V drop and you need to have enough current gain.  In that case I wouldn't have a resistor any larger than 1K and NO zeners.  Most 12V relays will operate on 9V and that may be all you can get with this circuit.

Third, I wouldn't be at all surprised that the transistor may have allready been damaged by a spike and you are not getting the results you suspect.

Another solution is to use an LM339, tie all the sections together in paralell, reference one of the inputs to that 5V zener and the other to the monitoring line through a 47K resistor, and use the output to pull the relay to ground.

RE: Help with transistor relay switch

(OP)
I can try the LM339 tomorrow, since they're available at Radio Shack.  I'm a software guy, not an EE, so I'm a little slow with this stuff.  Please let me know if this is correct:

LM339 inputs are + and -.  I guess you connect the + to 12v through the zener, and - to the switches that ground resistors from 200 to 2800 ohms, through the 47k resistor.

The output will ground the relay, and I'll use a 1N4001 across the coil, for protection.  

What I'm not sure I understand, is how the input works.  I need it to ignore any resistor shorted to ground on the input line, and only ground the relay line on the output, if the input is shorted directly to ground.  The input must have a high impedance so as not to affect the resistances on the input.  Does this make sense, and if so, is that how the circuit will work?

Thanks,
Mitch
 

RE: Help with transistor relay switch

The LM339 is used as a comparator.  The zener is used as a 5V reference source.  Ground one side, band side through a 5-47K resistor to 12V.  This gives you a regerence voltage you connect to one of the inputs.  When one of the inputs is only a couple milivolts higher or lower than the other, the output changes state. Want the opposite state, switch the + and - inputs.  The output is open collector.  If you parallel all the sections, this will give you more than enough current sinking for the relay.  Just make sure you have all the + inputs connected. Get one reversed and the relay always turns on.  A 47K in series with the sense input will provide enough protection from spikes.

RE: Help with transistor relay switch

(OP)
I'll try this later today.  I want to be clear on a couple things - the zener goes from ground to one input, and a 5-47k resistor goes from the same input to 12v.

The sense input goes through a 47k resistor.  I still don't see why the relay won't close if this sense input is grounded through a 200 ohm resistor, because that will provide a voltage differential.  I only want it to close on a direct ground of the sense input.  But I'll try.  Sorry for the beginner questions, and thanks for the help.

Mitch

RE: Help with transistor relay switch

MichSt:
The 5 V may be too much. You need a reference voltage significantly less than what you get with any other switch.

This circuit doesn't eliminate the horn turning on at
power on/off.

<nbucska@pcperipherals DOT com> subj: eng-tips
read FAQ240-1032

RE: Help with transistor relay switch

What 200 ohm resistor! You are combining too many solutions into one circuit.  

RE: Help with transistor relay switch

(OP)
Here are the resistor values that are grounded from each switch:

220 ohms
600
1300
1600
2800
direct ground (horn)

I can change the 220 and 600 ohm resistors to some higher value.  The Peripheral Electronics module trains itself to associate resistor values that it reads with infrared commands, so the values are not critical.

If you don't think this will work, I'll just do it with the Basic Stamp, but I'd rather not have to do all that work.
Thanks,
Mitch


RE: Help with transistor relay switch

Sorry, these things go on so long and with other posts the origional question gets lost.  The basic comparator circuit will work.  You may have to put a voltage divider pot on the zener to get the appropriate trip voltage.  Is any current applied to these resistors to create a voltage that you monitor or will you have to supply that too?

RE: Help with transistor relay switch

(OP)
Hi, no problem.  Thanks again for the help.

There is a very small current on the input to the Peripheral Electronics module, a few milliamps, at around 10 volts, so I don't have to supply the voltage.  The switch assembly simply switches each resistor to ground, and the horn switch grounds the wire completely.

Will the pot go between the zener and the input, or will I replace the 47k resistor from the input to 12v, with a pot?  Remember, I'm not an EE like you guys, so please keep it simple.

Also, should I change the 220 and 600 ohm resistors to higher values?

Thanks,

Mitch


RE: Help with transistor relay switch

The lowest resistance before the short is 220 ohms.  That 10V could be a fixed current source or just a resistance.  If you figure about 2ma for a start, your reference voltage should be about 0.44 volts. You have to get below that so 0.2V would be a good value to start with. From the 4.7V zener, have a 10K resistor going to a 470 ohm to ground for a voltage divider.  That would give you 0.21V which should be low enough.  Much below 0.2V, I would be concerned about noise.  The 47K goes to the switch sense and it would be a good idea to have a .1uf disk capacitor at the input of the op amp to prevent RF from false triggering the relay.    

RE: Help with transistor relay switch

(OP)
I'll try this later today or tomorrow.  I can always change the 220 to something higher, if it doesn't work.
Thanks again,
Mitch

RE: Help with transistor relay switch

(OP)
It worked!  I calibrated it on the bench with a 150 ohm resistor on the input using the 10k variable pot, and it worked fine in the car.  Steering wheel switches worked perfectly, and the 200 ohm switch did not close the horn relay.

Now the last problem - the horn honks when the ignition is started, and also when it's turned off, because the switch does ground the + ignition line at a point when the key is rotated.  After playing around for a little while, I also found that if the circuit's + is not connected at all, the horn is on constantly when the car is started.  So I think I need a switch that will not allow the relay to close if there is no +12v.  

I'm considering using an NPN transistor with the emitter connected to ground, and the collector to the relay (the side that will be grounded to close the relay).  The base will go to the output of the gates through a resistor (not sure what value, but probably not critical).  If it's done this way, I assume that only one of the gates is necessary because the transistor will handle the current, but since they're all already connected, I'll leave the circuit the way it is.

Is there a better way, like using one of the gates to do this on the input, instead of a transistor on the output?  If so, please let me know how.

Thanks,
Mitch

RE: Help with transistor relay switch

(OP)
On second thought, I think it would be a PNP, with emitter to the relay wire, and collector to ground.

Mitch

RE: Help with transistor relay switch

As I said in a previous post, the problem is the 10V is switched off when the vehicle is being started.  If you move the relay power to the switched 12V buss there won't be a problem.  To put any time delay in would require you to find that switched power anyway.  You could try a 47K from the 10V of the sample line (not at the op amp pin)to your 12V.  That would add another 0.03ma and mightlift tthe voltage high enough so the horn doesn't blow. This added current would not effect the sense currents that much.

RE: Help with transistor relay switch

(OP)
I can't change the 12v connection to the horn relay.  Even with the added transistor, the same thing happens because the circuit is still powered with 12v through the horn relay.  The easiest way at this point, I think, is to add a small 12v relay on the output, to isolate the relay coil.  I'd rather use something that's solid state, but I'm sure this will work.

Thanks again,
Mitch

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources