Robustly Switching a Relay Over a Distance

Discussion in 'The Projects Forum' started by chris.parrish, Sep 4, 2015.

  1. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    I am looking to switch a relay using a microcontroller (5V digital output) over a distance of 50-100ft via 24AWG cable. Normally, I'd use a simple, cheap transistor as a switch like this:
    RelaySwitching.jpeg
    But since the controller is so far away, and the cable isn't shielded (stranded CAT-5), my concern is the possibility of accidentally firing the relay due to transients, noise, RF, whatever. I've added the pull down resistor with this thought, but it just seems that the transistor approach is susceptible to turning on at such a low current. Something that switches on closer to 2-3V (or higher) would make me happier, but of course the switching device needs to conduct at least 150mA from the relay coil at input voltage (so saturation may be desirable).

    I'm in no way tied to a BJT. I guess part of the goal is to reasonably minimize parts and cost, but I especially want to only switching the relay with a solid signal from the controller -- no spurious activation of the relay.

    Other info:
    • I have 12V available at the micro controller side -- so it is possible to amplify the input signal to higher voltage.
    • The relay is only ever on for at most 1s at a time and is off for 10+ minutes after so there would be minimal heating and ample time to cool if the switching device isn't running in saturation.
    • Relay is 12V automotive type. Figure approx 80 ohms for coil resistance (approx 150mA). I'm not sure whether relay coils experience an inrush current, though.
     
  2. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,128
    266
    Just use the same circuit and remote the relay coil, connect it using the long wires- with the back EMF diode at the coil end of the cable.
    200' of 24 AWG will be about 5 ohms, you will loose about .75 V, should be fine.
     
  3. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    Thanks for such a quick reply. To make sure I understand, you're suggesting:
    • By "remote the relay coil," you mean keep the BJT switching circuit, but move it near the micro controller. Then run the relay coil circuit through the cat-5 to the switching circuit and back.
    • Your 200' number is based on 100' to micro controller and 100' return path (approx 5 ohms). Therefore, 150mA relay coil would drop approx 0.75V along that cabling.
    • Don't move the back EMF so that it stays nearer the relay coil.
    Is this correct?
     
  4. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    Thanks for such a quick reply. To make sure I understand, you're suggesting:
    • By "remote the relay coil," you mean keep the BJT switching circuit, but move it near the micro controller. Then run the relay coil circuit through the cat-5 to the switching circuit and back.
    • Your 200' number is based on 100' to micro controller and 100' return path (approx 5 ohms). Therefore, 150mA relay coil would drop approx 0.75V along that cabling.
    • Don't move the back EMF so that it stays nearer the relay coil.
    Is this correct?
     
  5. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    Oops. Sorry for double post.
     
  6. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,518
    1,247
    Your list is correct is correct - relay and diode far away, everything else close in. Three thoughts:

    1. You now are moving 150 mA through a 200' loop instead of 20 mA, and the di/dt is much greater because of the turn-off inductive kick. This will radiate more noise. Probably not a problem, but something to be aware of. Run twisted pair if you can.

    2. To increase the turn-on potential of a bipolar transistor in an application like yours, add 1 or 2 signal diodes in series with the base. With two 1N914's in series, the turn on voltage now is around 1.8 V instead of 0.6 V. Note that there now is a much softer knee between off and on because of three diode conduction curves in series.

    3. Delete zener D2 across the relay coil and use just power diode D1. The zener lets the back-emf produced at turn-off rise to a higher voltage before clamping , and this lets the relay turn off faster. But this trick also increases voltage stress on the driving transistor and both radiated and conducted noise. Most of the time, normal relay turn-off times are not a problem. After all, it's a relay; if you want speed, this ain't it.

    ak
     
  7. crutschow

    Expert

    Mar 14, 2008
    12,993
    3,229
    I would move the suppression diode(s) close to the transistor.
    That way it will suppress any inductive spike from the long wire as well as the relay coil.

    It's commonly (and incorrectly) suggested that the diode be placed close to the relay coil, but it's actually better to place it close to the switch in most cases so that the kickback from all the circuit inductance in the loop is suppressed.
     
    Last edited: Sep 4, 2015
  8. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    Good point. I was planning to use 2 of the Cat5 wires for power and two for ground as the micro controller is powered over this cable and I only need 4 signal lines (now 3 and one for relay coil). So I guess I could set up the relay coil and one of the ground wires as a twisted pair set in the cable (not sure what impact the 2nd ground wire would have but I would guess that one twisted pair would at least reduce noise somewhat).

    Now that I'm moving the transistor nearer the micro, I shouldn't think I'd need to worry about accidental switching of the transistor -- especially with a pull down resistor at the base. Am I wrong?

    That said, I'll want to remember that trick for the future. I hadn't thought of that.

    I had read some app notes about relay switching that suggested the Zener would help in protecting the relay contacts (bounce, arcing, or some such thing). I hadn't considered the effect on the transistor though. I do know that it was recommended to select a Zener clamp value close to the relay coil voltage (11-12.5V in my case).

    Wouldn't that keep the transistor from seeing too much voltage?

    Thanks again for all your insights.
     
  9. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    Really? I guess that makes sense, now that I think about it, though.
     
  10. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    Um, wait, no. Ok at first I thought I saw your point. But now I'm not sure.

    Since the inductive spike is produced by the coil, wouldn't it be better to take it out at the source and not even have the transients pass along the long cable to begin with?
     
  11. crutschow

    Expert

    Mar 14, 2008
    12,993
    3,229
    You need to understand the source of the "transient".
    The transient is caused when you try to stop current flowing through an inductor, since the inductance will try to keep the flowing until the inductive energy is dissipated. It will generate whatever voltage it needs to do that, thus if there is no suppression circuit, this voltage can become very high and damage components or even break down the wire insulation resistance.
    The diode provides a path for this current, which thus limits the transient to the forward drop of the diode (≈0.7V for a silicon diode).
    So the transient is not produced by the "coil" per se, it is produced by the inductance of the coil and any other inductance in series with the coil (in this case the inductance of the long wire), thus you want to locate the diode where it can suppress the spike from all the inductance, not just the coil inductance.
    That point is near the switch, not the coil.
     
  12. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,518
    1,247
    Putting a zener across the contacts and putting one across the coil are two completely different things. A zener for DC or bidirectional tranzorb for AC will indeed clamp contact arcs under some conditions. But by definition that is completely isolated from the coil circuit by the construction of the relay not counting some applications where the relay switches it's own coil as part of a latch circuit). Different diodes for different applications.

    ak
     
  13. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    AK, I can't find the app note anymore but I vaguely remember the argument going something like "collapsing the field in the coil more rapidly, allows the contact to snap open more cleanly and/or with less bounce and thus minimize arcing."

    Just something I found wandering the internet that I was going to try and see if I could see any real benefit or if it was all theory. I've never really done one like this yet.

    My worry about this design is what happens when the voltage drops below the zener's clamping voltage? How does the coil finish collapsing and where does it's energy go next. Aaah, I may just scrap the zener and go back to pure flyback diode.

    Thanks for your quick, helpful answers. Learned a bunch.
     
  14. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    Super clear answer. I hadn't considered the inductance of the cable. Thanks.
     
  15. tcmtech

    Well-Known Member

    Nov 4, 2013
    2,034
    1,632
    FWIW I run about 350 feet between my furnace and my boiler system and I have no trouble running normal 24 volt DC power relays at that distance through one twisted pair set of a cat5 line.

    The only protection I have ever used was simply a snubber diode on each end of the cable.

    No need to over engineer a simple circuit.
     
  16. crutschow

    Expert

    Mar 14, 2008
    12,993
    3,229
    The answer is that the inductance generates whatever voltage it needs to keep the current flowing.
    Thus the voltage will stay at the clamp voltage until the inductive current stops, i.e. when the voltage drops below the clamp voltage it's because all the inductive energy has dissipated and the current has stopped.
     
  17. chris.parrish

    Thread Starter New Member

    Aug 3, 2015
    12
    0
    This is new territory for me, so that's great to know. Thanks.

    Never thought of putting one on either end. Hmm.

    Ha. Gee, wonder if I've ever been told that before. ;)
     
  18. crutschow

    Expert

    Mar 14, 2008
    12,993
    3,229
    I see no advantage to doing that but it won't hurt.
     
Loading...