Relay Driving


Surely the most simple thing in the world.  Not really, if you get this wrong your relay and / or transistor may well suffer early life failure.

Well this clearly is wrong.  As the field in the core of the relay collapses a very high voltage transient will appear on the collector.  If you are lucky it might work for a while, but don't push your luck.  We need more components, quickly!

This is the most commonly seen solution.  A handy diode prevents the collector from going above the rail, so all will be well.
Sadly this is not the case.  A relay is not just an simple inductor; things move in a relay.  The rate at which the contacts open and close depends on the rate at which the magnetic field decays and builds up.  Adding the diode has no effect on the build up of the field, but has drastically slowed up its decay, exactly how much depends on the coil inductance and resistance.  If the coil has no resistance then the field decay rate is defined by e=L di/dt.  e is now the forward voltage of the diode and L might be several henries, hmm that is slow.  However relay coils do have resistance and typically the decay rate is better defined by the time constant L/R. With an L of say 1H (just for added confusion the inductance changes considerably as the contact armature moves) and a coil resistance of perhaps 500R we have a time constant of 2ms.  Typically the relay contacts will not open until the current falls to around 20% of its nominal value, this is defined as the "must release" point.  So for our mythical relay the contacts might stay closed for nearly 3ms after the transistor is switch off.  Compare this with a maximum release time of 5ms for a small PCB mounting relay.

This slow field decay leads to the contacts opening slowly.  In a DC circuit the they may arc badly and shorten the relay's life.  It is hard to say by how much as it depends on the application, but I have seen the operating life reduced by 75%.  The other problem is that as the field is collapsing slowly the contacts will not be held tightly closed until they are released.  This will slowly increase the contact resistance as the field collapses which may cause excessive heating if the relay is being run at its maximum rating. 

You may be wondering what the extra "Rp" is for.  It just improves noise immunity on the drive input and guarantees that the device remains off at high temperature if the input is open by sinking any collector leakage current to ground. 

Perfect at last.  Using a zener instead of a diode allows the field to collapse quickly, whilst limiting the maximum voltage on the collector to a safe value.  It also has the added advantage of protecting the transistor against any lurking transients. You might think that the inductance of the relay will prevent transients from reaching the collector, but no.  There is considerable capacitance between the windings of the relay, fast transients are directly coupled to the collector.

At this point some people are surely thinking "he's lost his mind, after all if a simple diode is so wrong, why does everyone use it?"  Well let's have a look at some real results from a field failure.  These measurements are taken from a small 24v relay. The timebase is 1ms per division, the smaller trace in the middle shows the state of the relay contacts at 5v per division and the large trace shows coil current at 2mA per division.

Firstly lets attempt to see what happen with no diode at all, it is a bit of a mess due to the nasty high voltages developed across the coil as the field collapses.  In all illustrations the falling edge is the current waveform and the rising edge the contacts opening.

As you can see the current collapses very quickly and the contacts have changed state about 1ms after power is removed. Now let's add the standard shunt diode.

Well that has certainly slowed things up.  The contacts now change state 2.5ms after the power is removed.  You can see the slower current decay clearly.  During this time the contact force is of course reducing.  Another rather unpleasant feature of using the standard shunt diode is now revealed.  As the armature starts to move away from the core the inductance falls. The energy stored in the core cannot suddenly vanish, so the current increases, further slowing the armature movement.  It is important to notice that there is still significant current flowing in the coil when the armature starts to move.  This particular relay drops out at about 20% of its nominal current, 1.6 divisions,  so the rate of movement is being appreciably affected by the coil current.

Nows let's see the zener in action.

Not quite as good as nothing at all of course, but the contacts change state 1.5ms after the power is removed.  Notice that the unpleasant increase in current as the armature starts to move is greatly reduced and occurs well below the drop out point, so the movement of the armature is not significantly affected by the coil current  This is a 36v zener on a 24v rail.  With higher voltage zeners things would look even better.

Finally, lets compare all the versions.

All three traces are overlayed with the relay contacts current at 100mA per division, the coil current at 2mA per division and the main timebase 1ms per division.  The blue trace is the raw relay, the green trace is 36v zener and the red trace is the standard diode.  The traces to the left are the relay coil current, the middle traces are the contact current and the right hand traces are the contact current on an expanded timebase of 50us per division.  In both the raw & zener traces the contact current has fallen to zero in about 175us but for the diode it takes nearly 250us.  This effect becomes worse on relays with a lower coil resistance and hence longer time constant.  The damage done to the contacts depends on the type of load and contact material.  A low current resistive load will cause little degradation, but a high current inductive load might well cause the contacts to pit badly or even weld together.  Incidentally, this problem can also occur when the relay is turned on if the coil current increases slowly.