2
\$\begingroup\$

I'm having a head scratcher:

schematic

simulate this circuit – Schematic created using CircuitLab

In my mind this should work flawlessly. The 5v/GND through R1 to the base of Q1 is controlled by a microcontroller (but for testing I am literally connecting to a 5v source or GND by hand)

Applying 5v... The Relay closes, great... but upon applying GND to the base the relay remains closed, meaning there is still a current flow. Only upon disconnecting GND from the Emitter of Q1 does the relay open again.

What am I doing wrong? I thought my theory was sound.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Try a resistor from emitter to base? And dumb question but are you sure the relay isn't one that requires energising to change its state, rather than NC / NO? But yes, it's curious! Have you taken voltage readings at the base / collector / emitter? PSU don't forget a reverse biased diode to protect the transistor from spikes relay generates on turn-off!! That probably killed your transistor. \$\endgroup\$
    – Jodes
    Commented May 6, 2017 at 20:12
  • 1
    \$\begingroup\$ It's not impossible you damaged the transistor in early experiments. For starters add a fly-back diode (google) to your relay for protection. \$\endgroup\$
    – Asmyldof
    Commented May 6, 2017 at 20:16
  • 1
    \$\begingroup\$ You should use fly back diode across your relay. And you may use a resistor across emitter and base to discharge the intrinsic capacitance of base-emitter junction. \$\endgroup\$
    – abhiarora
    Commented May 6, 2017 at 20:19
  • 2
    \$\begingroup\$ @abhiarora And you may use a resistor across emitter and base to discharge the intrinsic capacitance of base-emitter junction No, that is nonsense, a microcontroller output will pull the base to ground via that base resistor. Also, NPN transistors do switch off even when the base is floating (not connected). There is no need to discharge the intrinsic capacitance of base-emitter junction, it will discharge by itself withing a couple of micro seconds. What you describe is needed for MOS transistors but not Bipolars. \$\endgroup\$ Commented May 6, 2017 at 21:14
  • 3
    \$\begingroup\$ And what the others say: flyback diode. Use a 9 V battery to make that relay switch, do this in the dark, you'll see small sparks. These killed your transistor !!! A flyback diode prevents this. \$\endgroup\$ Commented May 6, 2017 at 21:15

4 Answers 4

1
\$\begingroup\$

Try connecting the base directly to the emitter.

If that doesn't open the relay, then either you got the pinout wrong or the transistor is faulty.

If it does open the relay, then there's a problem with your ground.

Update:

As others have pointed, you should put a flyback diode accross the relay.

This will prevent the relay coil from creating a spike of overvoltage on the collector when the transistor is turned off fast.

If the transistor is faulty, that might be what killed it.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Not having that flyback diode may well have destroyed the transistor, too. \$\endgroup\$
    – Hearth
    Commented May 6, 2017 at 20:21
  • 1
    \$\begingroup\$ The relay "module" I have: ebay.co.uk/itm/… I'd be surprised if there isnt a flyback diode wired in to the PCB already. The relay is NO and NC when energised, I can swap that round but this scenario is fine as its supposed to be controlling a contact closure on a smoke machine (XLR input). I did try putting a 10K resistor from BASE to GND, isnt this the same as BASE to EMITTER? \$\endgroup\$ Commented May 6, 2017 at 21:59
  • \$\begingroup\$ Seems like there are several components on that relay PCB that are not included in your schematic; You only drew the relay itself. If you want any informed answers, I think you need to complete the schematic, make the map match the terrain. \$\endgroup\$
    – Dampmaskin
    Commented May 6, 2017 at 22:13
  • \$\begingroup\$ Yeah thats fair enough. Update: I've tested the transistor from COLLECTOR to EMITTER with a multimeter, removing the relay entirely... Works as expected. HIGH = ON LOW/DISCONNECTED = OFF. So the relay is causing issue. Trouble is I have glued it in to an enclosure now, trying to decipher it will be a challenge. I can tell you however I have the GND and Relay Trigger pin on the PCB wired together as its active LOW on the Relay. Do they need to be discrete? \$\endgroup\$ Commented May 6, 2017 at 22:24
  • 1
    \$\begingroup\$ The Ebay listing states that they "can be controlled directly by Microcontroller". If the relay circuit is not current driven, your transistor setup doesn't make much sense, so try removing it altogether. Unless the 12V on the IN pin has damaged the relay circuit, you can test setting the IN pin on the relay module to 5V, and then to 0V, see what happens. \$\endgroup\$
    – Dampmaskin
    Commented May 6, 2017 at 22:36
0
\$\begingroup\$

So I've taken the relay out of the case (was glued in). Ive managed to fry either the diode or PNP by mistakenly putting 12v and GND the wrong way round so I cant experiment any more... Any way here is an updated schematic with the relay module intact. So can anyone explain why the relay remained closed even after putting the BASE of the NPN to GND?

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
4
  • \$\begingroup\$ This should be an edit to your question. The answers box is for answering the question, not asking another one. In any case in that circuit the moment you turn Q2 on, Q1 will go bang as you will develop -12V Vbe. \$\endgroup\$ Commented May 7, 2017 at 12:41
  • \$\begingroup\$ My apologies. I shouldve updated my original drawing then? No transistors have gone bang. All that happens is the relay remains closed after energising q2 even after connecting q2 base to 0v \$\endgroup\$ Commented May 7, 2017 at 13:41
  • \$\begingroup\$ When the base of Q2 is at ground potential, Q2 does not conduct. Therefore, no current is flowing. If the relay opens when you remove the power, either Q2 is faulty, or the drawing cannot possibly be an accurate reflection of the circuit. Also, are you really sure that Q1 has no base resistor? What happens to Q1 when it has 12V at the emitter and ~0V at the base? \$\endgroup\$
    – Dampmaskin
    Commented May 8, 2017 at 22:13
  • \$\begingroup\$ Q1 Base has a 2.2k resistor. Youre right i forgot it. Ive got it working by connecting that Resistor exclusivley to the collector of q2. The gnd on d2 d3 and the coil is now direct to GND and this works. I can understand the relay holding charge but surely this will drain fairly quickly? \$\endgroup\$ Commented May 9, 2017 at 15:30
0
\$\begingroup\$
Applying 5v... The Relay closes, great... but upon applying GND to the base the relay remains closed

This is to be expected when you try to get away without a flyback catch diode across the relay. The flyback voltage pulse does bad things to the transistor, probably causing avalanche breakdown in this case.

Go back and do it right. Add a diode in reverse across the relay. If the relay current is low enough, then a small signal diode like a 1N4148 would be fine. Otherwise, use a Schottky, especially if you eventually intend to apply pulses to the base of the transistor, or quickly attempt to turn the relay back on when the flyback current could be circulating.

\$\endgroup\$
0
\$\begingroup\$

In reality there is some leakage R in the transistor ("Early" effect) thus at turn off, the inductor current develops a large +ve spike from a "low side" NPN switch turned off. ( and negative spike if PNP "high side" was used.)

If coil L was 200mH and Ic was 10mA and R leakage=1M then current decay time constant is T=L/R 0.2mH/1M =0.2us = then Vpk=LdI/dt 0.2H* 10mA /0.2us = 4kV.

But since above Vce(max) is a zener-like breakdown it would absorb the spike but the high dV/dt causes EMI, so a reverse diode clamp is connected to the collector to supply to drain the current with it's much lower ESR in a longer duration defined by T=L/R(coil) where the diode Rs or ESR is similar to the transistor if both have the same power rating can be neglected as the coil resistance might be around 1k (depending on 12V relay) while transistor and diode ESR <<10 Ohms @10mA.

The area enclosed of the coil current to ground and the diode current loop to Vcc and gnd both become loop antenna for EMI radiation so close coupling of these tracks is important to remember in future for noise issues with decoupling cap nearby on Vcc.

For the advanced reader, I included the above details and below simulation with the diode switched open during the trace and included an internal 100V zener for the Vce breakdown voltage.

Upon close examination below, one can see the std. glass clamp diode exists, next to relay.

enter image description here

Although my 5V clock was 1kHz to show the rise time and decay time are the same limited by the L/R ratio of the relay coil, one would expect with **no load* the relay would last 1e6 to 1e7 operations max( Ref OMRON) and would fail after 1e3 to 1e4 seconds and with a reactive load fail in minutes at this rate with severe arcing on contacts. buzzzzz

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.