Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help switching relay using PIC and PNP transistor.

Status
Not open for further replies.

fuzzzy

Full Member level 3
Joined
Oct 2, 2004
Messages
156
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,298
Location
ITALY
Activity points
1,650
pnp transistor relay

Hi,

I've a problem.

I use a pic to switch relay through ULN2003. uln2003 allow current flowing from negative side. I need to switch only one relay allowing current flowing from positive side. I thought to use a PNP transistor to do this.

In my schemathic i've problems: positive relay works good when other negative relays are switched off but when i switch on one of negative relays, positive one stops working.

What is in your opinion the best configuration to do this without problems?

This is my schemathic that doesn't work.
 

pnp relay

I do not see any reason why this would not work.
Check for shorts or a defective ULN2003. Make sure the COM pin is not shorted to anything. It should be connected to +12V, since the other outputs drive relays, so you need the internal diodes.

Also, check the +12V stays +12V after you turn on one "negative" relay. If +12V drops, then the pnp may switch off, depending on the values of R1,R2.

Good luck!
 

pic relay

What values for R1 and R2 do you suggest me? I think R2 should be bigger than R1
How much bigger?

Thanks a lot
 

pnp relay circuit

Can you clarify? The circuit you show looks fine to me. It should turn on the relay when O1 is in the on (shorted to ground) state.
.
What do you mean by "positive" and "negative" relay? By "negative relay" do you mean the relay that is turned on when the ULN2003 output is in the "on" state. If so, then I asume that you want to turn on another relay when its ULN2003 output is in the "off" (open circuit) state. If this is the case, then I suggest using an N-Channel MOSFET to drive the "positive" relay. Connect one terminal of the relay coil to +12V. Connect the other relay coil terminal to the MOSFET drain. Connect the MOSFET source to ground. Connect the MOSFET gate to the ULN2003 output. Connect a "pullup" resistor from the MOSFET gate to +12V (or any positive voltage that is greater than the Vgson threshold of the MOSFET).
Regards,
Jon
 

ic switch relay

Quite the contrary: R2 can be much smaller than R1.
I would suggest this:
R2≈1kΩ
R1≈10kΩ or bigger.
Reason being that you have to pump (or drain some current, depending on which hemisphere do you leave) to the base of this transistor as you want it to go into saturation - ON stage. On the other hand, R1 -10kΩ or more, will make sure that this transistor stays OFF by keeping Ube below 0.65V (in fact, pretty close to 0V) in the OFF stage.
Regards,
IanP
 

relay pnp

Not really sure why you need a transistor as well as the uln2003. The 2003 on its own will sink 500ma per output, so long as you do not exceed package dissapation. It must be a very big relay if it takes more than that. One side of relay to plus, other side to uln2003 output, pin 9 to plus for diode protection. I hope I have not misunderstood your question. As a futher note make sure that 0v from MCU uln is individually back to a common point, or you may have switching transients upsetting the MCU.
 

driving pnp transistor

Thanks for your time.

So, I try to explain my necessity: I use a pic to drive some relays through uln2003 in a traditional way(coil connected to 12V and uln2003) in the same board I need some PIC's pins( almost 2) to supply 12V devices as relay(i called it positive relay) or digital thermometre. so I need to connect it directly to ground and allow or cut positive supply.

In my schematic I used R2=2,2KOHM and R1=10KOHM but it doesn't work when I switch on other traditional relays. There are 3 uln2003 on this board and when i switch ON any normal configuration relay. Positive relay doesn't work.

I cant understand why. Do you think there will be different configuration working better?

how cai i solve this problem?
 

transistorized relay circuits

Is your 12 V supply cappable of supplying enough coil current to drive multiple relays? Check the 12 V supply when you try to turn on multiple relays, and see if it is sagging under load.
 

pnp diode pic

I think I understand now. What you could do is use NPN transistors instead of uln2003. Resistor from MCU pin (4K7 is good starting point) to base. Relay can be either in the collector side (one side relay to +) or emitter side (one side relay to 0v). Dont forget to put diodes across coils K(band) to most positive side. You may need pullup resistors from each pin to +. This of course depends if the MCU you are using has internal ones, if not, between 1k to 47K probably ok.
 

pnp relay pic

and what about using an optocoupler?
 

transistor relay negative

Hi fuzzzy,

What type of relays are you using and how are they mounted? On a PCB?

/Rambo
 

use a pnp as switch

Just check this link with manufacturers spec:

**broken link removed**

They have circuit example how to drive a pnp+relay circuit with resistor
values and 2N4901.
Don't forget to use the diode across the relay coil and additional another
one across the pnp with cathode connected to +12V. That will protect
the transistor from voltage spikes, I found by experience that second
diode is needed too.

Tornado
 

connect relay to pnp

Hi,
Thanks for you help

I tryed the configuration on datasheet you suggested me, that's the same i used before, i changed resistor's vaues as datasheet but it works fine only when relays connected directly on uln2003 are switched off. when i switch on any other relay it stops working.
 

relay switching using pnp transistor

please check the value of R1 and R2,

they should not be too large,

their value must be in range of few ks.

there is no any problem except that you

should connect a protecting diode between

relay's coil.

best regards


fuzzzy said:
Hi,

I've a problem.

I use a pic to switch relay through ULN2003. uln2003 allow current flowing from negative side. I need to switch only one relay allowing current flowing from positive side. I thought to use a PNP transistor to do this.

In my schemathic i've problems: positive relay works good when other negative relays are switched off but when i switch on one of negative relays, positive one stops working.

What is in your opinion the best configuration to do this without problems?

This is my schemathic that doesn't work.

**broken link removed**
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top