Using Relays (Tips & Tricks)

In this article I will tell you how to get shorter relay switching times and how to minimize relay current consumption. The same exact things apply to solenoids and solenoid valves.

Usually if you want to control relay from microcontroller you would do something like this:

You need to use a transistor because either relay you want to control needs a higher voltage than your microcontroller can provide, or relay’s current demand is too high. Although some microcontrollers can give enough current to switch a relay, but most of them is incapable of doing that.
And the diode in parallel with relay coil (or solenoid coil) is needed to suppress the flyback voltage that occurs when transistor is switching-off and magnetic field stored in coil collapses. That flyback voltage can reach hundreds of volts, which can completely destroy the driving transistor.

Switch-off (release) speed

When you cutting power to relay, the energy stored in the coil will slowly dissipate through the diode. The problem with this is slow relay release time. This time could be crucial to some high-speed relays or to fast acting valves, like, for example, car fuel injectors, which should open and close really fast to inject specific amount of fuel into combustion chamber (maybe I will write about this someday).
To conquer this problem you can put a zener diode in series with flyback protection diode like so:

This will allow for flyback voltage to go higher, therefore helping to dissipate stored energy in coil much faster and dramatically decreasing relay release time. Zener diode voltage should be lower than transistor breakdown voltage, which you can find in that transistor’s datasheet.

The little test that I’ve made with this relay

shows much smaller release time when using zener diode, than with single clamping diode.

Relay with clamping diode takes about 11.5 milliseconds to turn-off (release):

Channel 1 (yellow) shows state of relay control signal, and channel 2 (blue) goes low when relay is ON.

With additional 12V zener diode it’s only 3.5 milliseconds, which is 8ms less than with just a clamping diode alone.

And without clamping diode at all it’s roughly 2.5 milliseconds. Which is not that different from 3.5 ms with 12V zener diode.

So as you can see, zener diode in series with ordinary clamping diode significantly speeds up relay release. All relays and solenoids behave the same, but release time will vary.

PICK/HOLD Power Consumption

Once relay is picked it doesn’t need that much current to hold it’s contacts. Usually relay needs only about 50% of pick voltage to hold it’s position. So relay needs higher current only at the beginning to pull contacts from one end to another. For example relay that I was testing earlier has 12VDC coil, but it can be easily pulled-in at 9V and reliably hold it’s contacts at about 4V.

I’m gonna tell you about two solutions to this problem. This solutions can save you battery life in battery-operated devices, or can save you money by selecting power supply with less output current, especially when you need to switch more than one relay simultaneously or some big single relay. In addition to that it will decrease release time, because coil will store less energy.

The first solution is this:

Capacitor in discharged state has very low impedance, it’s almost like a short and it will pass full current needed by relay to pick. Then, as capacitor will fully charge, it will completely stop passing any current, and all the current will flow through the resistor connected in parallel with the capacitor, therefore lowering the relay current consumption.
So, basically, the capacitor provides initial “kick” needed by relay to pull-in, and then current will flow through the resistor.

I made a little experiment with the above relay, powering it from 9VDC with 200Ω resistor in series. That relay has 12VDC 155Ω coil, and it draws about 58mA working from 9V.
When connected in series with 200Ω resistor and still working from 9V this circuit draws only about 25mA instead of 58mA. So the coil works from about 4V, whilst 5V dropping on the resistor. And under 4V the relay holds close pretty reliable (at least for the experiment).
But 4V is not nearly enough to initially pull-in. So I found out that it needs at least 330uF capacitor in parallel with the resistor to work reliably.

As you can see, the results is pretty nice. 58mA @ 9V versus 25mA @ 9V.

But this solution has it’s own downsides – part of energy will dissipate through the resistor in form of heat, so when you have a really big relay, you would need a power resistor; and second one is that you would need a comparatively big capacitor for each relay.

And the second solution allows you to make the same thing, but without any extra parts, by using PWM once relay is picked:

When using microcontroller to switch relay on and off, you often have enough processor time or even hardware capability to generate PWM on one or on multiple MCU outputs.
This will allow you to “chop” relay current consumption without adding any additional parts to the circuit.
So, basically, if PWM would be 50% on and 50% off – then relay will consume only half of the current needed to pull-in. But for switching relay with this method you need to implement simple software algorithm, for example like this one:
2. DELAY 20ms
3. RELAY_OUTPUT_PWM = 50% (or whatever ratio you want to set)

There is another methods to lower relay power consumption exists, like using two transistors and two different power supply voltages, or using discrete logic and some external clock to make PWM, or even using additional set of contacts(if your relay has any) to implement pick and hold function without capacitor.

That’s it! Here you can download datasheet for BS-901, the relay I was playing with

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>