PWM on a coil

I am currently working on a controller for lights and such in my garage. To handle the mains power, I got some DIN rail contractors with a 24v coil.

When powering the coil with my bench power supply, I can see one draw just over 600mA, but after making it pull the contactor, I could turn the voltage down to less than 1v without the contactor releasing again. And at 1v the current draw was also very low, so having it pulled for an extensive length of time should not give any heat problems.

However, when releasing a relay, it does give quite a kick back, how does it behave when driven by PWM? My idea was to just give it full power for 200mS then change to PWM.

If the relay coil is 24vdc, you put a diode across the coil such that the diode doesn’t conduct when dc is applied. When the power is removed and the field collapses, the kickback is suppressed by the diode. Probably an IN4007 diode.

I am aware of the need of a diode, my plan is to use a ti unl2803a, which already got it in. The thing I was thinking about is that it isn’t fully suppressed by the diodes, but only brings it down to a level where it does not harm the transistor. But what if it happens at 23000hz? That could be many years of use, every single second.

You don’t say what it is you’re trying to do, but whatever it is, I’m pretty sure that driving a mains relay at 23000Hz is not the way to achieve it. Look into triac control with PTPG maybe?


@peter, as I said, the coil is 24v, so the unl2803a should be fine for that? It is only the contacts in it that is mains rated.

The thing is that each coil draw over 600mA, I am going to have 4 of those, that is over 2.4A just for the coils, and that can only generate a significant amout of heat in the coils, and is just a waste of power. If I instead could PWM the voltage down, that current being drawn by the coils could get much lower. I am not planning on trying to PWM the mains side, just the coil to save energy and to not generate too much heat in the coils in side the relays.

@Mikey - Ok, I think I understand what you’re trying to do. I don’t see any fundamental flaws in your approach, so I think what I would do is just build up your 2803a / coil circuit and have a look at the waveform to first see what sort of voltage spike you might have to deal with for that topology. (Might be interesting to first build it with an equivalent transistor that doesn’t contain the clamping diode). I would think it would be less than with the relay drive. (By the way, the protection diode @mlseim points out goes across the coil, and is a good idea).

The spike is inherently caused by the large di/dt you get (V = L * di/dt) when you cut off current to the coil … (for the relay case dt is essentially 0, so V is large). One general strategy therefore to minimize any spikes would be to increase dt. This could perhaps be done with some wave shaping of the PWM signal out of the 2803a’s … i.e. you’re trying to make the waveform more trapezoidal in shape … think capacitors perhaps :). Since you’re really only concerned about the average voltage out of the 2803a to keep your contractor engaged, you should be able to do some significant filtering of that drive signal.

Anyway, just some initial thoughts. I’m thinking you should be able to make this work. (I’ll give it some more thought though to make sure I’m thinking about this right).

Another approach to holding a relay on at reduced coil power would be to use a latching relay. Then you would only power the coil for a short pulse (suitably suppressed) and remove power, but the contacts are help on by a permanent magnet. To release (turn off), you either apply a reverse pulse or pulse on a separate coil depending on the type of relay, to overcome the holding field of the permanent magnet. I think this would be preferable to driving the coil with PWM to hold it on. But only if such a relay is available in the DIN mounting you need.

I haven’t seen latching in this form, also the shape they got is also important, they must be able to fit into those din rail houses, not just on a din rail.

Oh oh oh, I get what you’re doing now, sorry.

For lights in your garage, why not use a solid state relay? You won’t have a coil.

@mlseim because solid state relays never totally cut the connection, and that will keep the power supply for leds charging and making the leds flicker when they should be off. To prevent that happening I then need to put another load on that will take what comes through, but that does not make sense in my head to do.

Perhaps this sort of thing?

Something like that could work, but leads to the next problem, how do make the imp know if it is open or closed, without using a second pin to detect that.

Also the price of that is the same of what two of the normal ones are. :frowning:

I would avoid feeding AC into a relay coil myself, and I think it is worth a latching relay to avoid it. But it does mean two outputs (set and reset), and as you say perhaps another input to verify the relay state on the second contact pair. I just remember what the current relay state is in code.

If this is all mains powered, including the 24v, does it really matter that the coil current is 600mA? If it is rated for continuous energising then heat dissipation should not be an issue. I normally use latching relays for battery powered applications. In your application I don’t think I would worry.

It is powered by mains, but using over 2.4A on just coils, would mean I had to get a power supply twice the physical size, just because of that. My plan was to use a single unit 1.5A power supply to power the entire thing. Also, PWM isn’t AC, it just turns DC on and off very fast.

I would also remember the state in code, but if it for some reason got reset, it would no longer know what state it was in, and as I said, I wanted to avoid having to use a second pin just for that.

But back to the current draw problem, they might be fine drawing over 600mA each, but this is something I plan on using for many years, and spending 600mA for each coil for years when active, where it could have been spending 50-100mA, that could end up being quite a difference. Specially if all I need to do is to figure out a good way to do it in the first time.

About remembering the state, surely your hardware needs to remember the state even if you use a normal relay - when you restart the device you need to set outputs for the desired relay state anyway. The normal relay would drop out then you have to work out if it is meant to be on or off. An advantage of the latching relay is that it does not drop out if your imp drops out, it stays in the same state while you recover the imp.

On the power consumption side, I would say that is why latching relays were invented. I am not trying to convince you, I don’t have shares in a latching relay company, I just think it might be the right tool for the job in your case.

Are there any bistable relays you can use? That’s the traditional solution to high coil consumption.

(as @DrJack just said)

What about using a dedicated ‘solenoid driver’ IC such as I quickly Googled:

Other similar devices are available !

That looks like just the thing! Didn’t even know something like that existed.