Maker Pro
Maker Pro

NPN and relay cct

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Hello all,

Hello forum, first post!

I am trying to find a solution to switch a relay on using 2 different sources.

I have a 12v relay which I'm energising the coil from a 12v switch on the coil, then I need to use a NPN (Bc107) to maintain the voltage on the coil when the switch is turned off (so the relay is still closed). The NPN is controlled from a 5V PIC pin. On the collector I have 12v but when I drive the base I only seem to have 4v passing.
Please help.

Jason.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,747
Joined
Nov 17, 2011
Messages
13,747
Hi Jason, welcome to electronicspoint.

A picture is worth a thousand words: please upload a schematic of your setup. This will make it easier for us to understand your request.

Harald
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Thank you for the friendly reply.

I original posted the first post on my phone and therefore was unable to provide a cct diagram. But as below you can see what I am trying to do. The end-game is that SW1 is my ignition switch, and I would like the Microcontroller to stay powered for a period of time after SW1 is off. This enables me to do Power Down Test and EEPROM writing.

If there is an easier way I would be open to any ideas. Currently I have managed to SW1 on, Drive BC107 to maintain the relay, but I am unable use BC107 to switch the RL1 on. I seem to be getting only 4V at the Collector of BC107. The relay is an 120Ohm Coil which I think that my NPN isn't rated high enough to energise the coil, am I right??

I have a few differnt transistors I can use, 2N3440, 2N3828, 2N3820 but cannot seem to get any of them working. I know it's me and my principles are not correct with the NPN but help would be great

Preferable I would live to stop the drive to BC107 and 3 seconds later I would like RL1 to switch off.

If anyone can help me I would apprieacte it.

I'm having issues trying to upload my .jpeg of the cct - I have tried to copy the image beelow? not sure if this will work

upload_2015-5-4_10-54-8.png


Jason
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,747
Joined
Nov 17, 2011
Messages
13,747
The short of it: No, won't work.

The long of it: The answer to your question is here. The signal "out" gors to the positive end of the relay coil. The supply voltage 5V can be replaced by your 12V supply. Note that you'll have to add a flyback diode across the relay coil to protect the transistor from voltage spikes.
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Harald. Thanks for the quick reply,

can I ask a few more question, the cct now works on a simulation fine, but can I confirm what's is best pratice for the resistor values.

upload_2015-5-4_11-25-49.png

Also would devise BC107 be ok for the NPN and 2N3820 be ok for the PNP.

The "diode" across the Coil I am aware about, just haven't got that far yet, would BZX79 be ok?

Thanks again for your help, you have made my Bank Holiday Monday worth staying in the garage.

Jason
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
I have also just noticed that my relay is getting very warm, do I need a current resistor on the drive to the coil?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,747
Joined
Nov 17, 2011
Messages
13,747
The resistor values are not critical. those 10ks should be fine.

The BC170 is o.k., too, but the 2N3820 is not a PNP but a MOSFET, a 2N3906 is an alternative. A MOSFET can be used, too. All in all the component selection is not critical as long as the components are suitable for the voltages (12V +tolerance) and currents the are employed (mainly the collector current of Q2 which needs to drive the relay coil).

The BZX79 is a zener diode. I suggest you use a simple switching or rectifier diode line 1N4148, 1N914, 1N4001 or similar.

You should not need a reisistor to limit current through the coil if the relay is rated for 12V coil voltage. In this case the coil resistance should be designed by the mfg. of the relay such that it withstands 12V "indefinitely" (unless otherwise stated in the relay's datasheet).
If the nominal coil voltage is less than 12V, yess, use a current limiting resistor.
 

davenn

Moderator
Sep 5, 2009
14,267
Joined
Sep 5, 2009
Messages
14,267
and you still haven't got a diode across the coil that Harald told you about earlier
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Harald / Davenn

Two words "THANK YOU" You have helped me alot, I have only simulated the cct but hopefully when I put it to the PCB (Breadboard first) it should work as simulated. I have attached an up-to date cct FYI.

upload_2015-5-4_15-18-12.png

If you could cast your eye over this I would be grateful. I have attached the Component details now which should clear things up for me.

The relay is from a Vehicle Application (Previous Job) where it was a 12V relay coil from Vehicle Battery, So I'm 100% sure this relay is spec'ed OK (NAIS CM1a-P-12VH35). I have changed the VIGN cct, So I can seperate which cct is driving the RL2... this is the only way I could think of doing it.. any suggestion if there is an easier way would be greaat.

Again, thank you so much you have been a real help.. I'm sure I will be back with more questions (and hopefully answers) soon.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,747
Joined
Nov 17, 2011
Messages
13,747
The circuit looks o.k., but has potential to save on components:

- safe variant (save for the µC):
  • remove R4, R5, Q4
  • tie the collector of Q3 to the collector of Q1
- a bit more isky variant (risky for the µC):
  • remove R4, R5, Q4 and Q3
  • tie the right side of R6 to the base of Q1
    The increased risk here is that any disturbance on the battery voltage may be fed back to the µC via R1. On the other hand, in this case you have 2*10kΩ in series and the µC wil not see very much of the distortion.
Harald
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Thanks for you reply. As the battery voltage is a vehicle battery it's potential a harsh environment.

The safe variant is alittle confusing, how would SW1 energise the relay?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,747
Joined
Nov 17, 2011
Messages
13,747
The safe variant is alittle confusing, how would SW1 energise the relay?
The collectors of Q1 and Q3 are connected, therefore Q2 and consequently the relay will be energized by Q1 OR Q3.
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Harald,

Thanks once again, I have simulated the suggestion and I now understand. Like to thank you again.

upload_2015-5-5_13-22-16.png
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Harald / Anyone who can help.

I know this is an old post of mine, but I'm in the position to build all my electronics after constant simulation and theory.

On building the above, I noticed
R3 becoming very hot and the relay not switching. After some diagnostics I concluded that D1 was at fault. When I removed D1 from the cct it all started to work.

Any idea why D1 is having this impact.

Jason.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
Jason, are you sure you had the diode connected with the correct polarity? When connected as shown in your schematic, it should have no effect on circuit operation, and only conducts when the relay is turned off, to short any voltage spike that might be generated.
(Or is the diode possibly short-circuit? Do a diode test or substitute another, taking care to ensure that it is connected with the right polarity.)
Regarding R3, the 10K resistor, if it is really 10K it should not be possible for it to get hot in this circuit. It should only have 0.6V across it, and even with the full 16V supply voltage across it only 1.6mA should pass, dissipating 26mW .
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Thanks Steve (don't want to call you old).

This was my initial thought, I actually removed the diode and changed polarity with a new diode thinking I did something silly but same results occurred. When the diode is removed R3 is fine and Q2 gets a little warm whilst holding it, gonna put a Thermo on it today to see how warm it is.

The diode is concerning me and I understand why its there, so is there anything else I can do apart from replace it again.

I have left the cct on all night and will let you know how it is when I go back into the garage.

Jason.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
Thanks Steve (don't want to call you old).

This was my initial thought, I actually removed the diode and changed polarity with a new diode thinking I did something silly but same results occurred. When the diode is removed R3 is fine and Q2 gets a little warm whilst holding it, gonna put a Thermo on it today to see how warm it is.

The diode is concerning me and I understand why its there, so is there anything else I can do apart from replace it again.

I have left the cct on all night and will let you know how it is when I go back into the garage.

Jason.

It's got me stumped, Jason. As shown in the circuit, it should be impossible for R3 to ever get hot. Even if you connect R3 directly across the 12V supply, it should never get hot, let alone when across the base/emitter junction of a transistor, where the voltage won't ever exceed about 0.7V.
And the diode???? Connected as shown, it should not conduct when Q2 is turned on and so should never get warm or affect circuit operation.
My conclusion is that the circuit must be different to the schematic. Double-check everything. Something must be different to the posted schematic.
Just out of interest, too, what is the relay coil resistance?
 

huttojb

May 3, 2015
52
Joined
May 3, 2015
Messages
52
Hey Steve,

Some feedback over the weekend. The coil is an 120ohm 12v coil.
I left the cct on for 13 hrs with no problem and only drawing approx 70mA.
I tested the diode I removed and it was s/c in both directions. I fitted a new diode and it worked.
Either I blew the diode during initial power up or I had a bad one.

Thanks again for your help.

Jason.
 

Old Steve

Jul 23, 2015
734
Joined
Jul 23, 2015
Messages
734
Hey Steve,

Some feedback over the weekend. The coil is an 120ohm 12v coil.
I left the cct on for 13 hrs with no problem and only drawing approx 70mA.
I tested the diode I removed and it was s/c in both directions. I fitted a new diode and it worked.
Either I blew the diode during initial power up or I had a bad one.

Thanks again for your help.

Jason.
Excellent, Jason. I'm glad it was a simple fix. I suspected that the diode might have been shorted, if it was in the right way around.
(I sorted out my problem, too, so now we're both happy.)
 
Top