Microcontroller-driven latching relay

For the single-coil relay, if I do something like this, are the protection diodes still necessary?

View attachment 1174462

The MCU IO pins (ATTINY13_PB2 and PB3 in the schematic above) will be kept low. To change relay state, one MCU pin will go high temporarily, to give the relay coil a path to ground. After the current pulse to change relay state, the NPNs' bases will once again both be low, making the transistors look like an open circuit. So won't the flyback voltage go through the 0R resistors to the +5v supply?

In the 5v case, I would actually omit the 0R resistors. I put those there as a placeholder, thinking that I can actually use a 3v relay, and a 3v3 supply, and those resistors can drop the voltage a bit from 3v3 to 3v0.
Seems like there's a small (but fatal) error: R4 & R5 can't be 0 ohm unless you want to short the supply. You'd have to raise them to some value, say 240 ohm for 20mA. In the off state, that 20mA will pass through 480 ohm, generating +15V above GND, my guess. 10V across the relay coil, but you'd have to figure out whether the transistors are OK with that.
 
Member
Joined 2008
Paid Member
If you use a cheap NPN transistor such as a 2N3904 and protect it with a cheap diode like the 1N4148 it works, as people have been doing forever, whether a single pull in relay or a latch relay. Latching just requires more parts. Attaching a schematic of a four input relay board with XLR and RCA connections for a preamp for you to see how it is typically done.

Unless I'm not reading that schematic correctly, I believe the relays in that schematic are non-latching. There are two types of latching relays (at least in my application), single-coil and double-coil.

The single-coil non-latching and two-coil latching are "easy" to implement with the single transistor, single flyback diode protection scheme (per coil). These relay types are designed to have current flow in only one direction through the coil(s).

But I don't think a single transistor and single protection diode scheme can be used for the single-coil latching relay type. This relay is designed to have current flow in either direction, depending on whether the relay is to be set or reset.


+1 for ULN2003.
It already includes protection diodes.

Can you show how that would be used with the single coil latching relay type?
 
Expensive? 5 for £3 on Ebay?
Can you show how that would be used with the single coil latching relay type?
My bad.
I thought from first post you were already driving relay direct from mcu pins and were looking for a buffer.

Your schematic in post #8 - replace the resistors with more transistors and you have a H bridge which is the usual way of reversing current: It's a transistorised DPDT switch. Also, use protection diodes.

Heed the advice in relay data sheet to spec 4.5V coil for 5V transistor switching.
 
Member
Joined 2008
Paid Member
russc said:
I thought from first post you were already driving relay direct from mcu pins and were looking for a buffer.

Yes, that is true. And it appears to be a somewhat widespread practice (at least in the guitar effect pedal world). But per this discussion (and others I linked in my original post), it's clearly not a robust design.

But my goal was to try and figure out exactly what that ideal/robust design looks like.

russc said:
Your schematic in post #8 - replace the resistors with more transistors and you have a H bridge which is the usual way of reversing current: It's a transistorised DPDT switch. Also, use protection diodes.

Yup, that's more or less what I've figured. It looks like, for latching relays: single-coil requires four transistors; but a double-coil only requires two transistors. In short, it appears that the double-coil latching relay has the simpler implementation.

I was just trying to see if I was overlooking something, and if in fact there is a simple way to (robustly) drive a single-coil latching relay from an MCU ("simple" meaning same number of components or fewer compared to the double-coil latching relay).

For completeness, I will add that another simple way I've seen to drive the single-coil latching relay is with an electrolytic capacitor in series with the coil. Bi-directional current pulses are possible from capacitor charging/discharging. See here for an example.
 
Interesting ic, but not a hafbridge/fullbridge output, so relay will get less voltage through resistor ,and relay must be more sensitive (higher ohms,less current,more expensive) . Otherwise , resistor must be lower ohms and this increases load on ic outputs. But because all this is just short pulse , usable solution.
I used different approach, for input switcher in amplifier . Simple button , two coils latching relay, two resistors, two capacitors. Trick was to select capacitors capacity , for relay switch just once for single button press. One contact group switched which coil will operate at next button press, other group switched the signal relay coil. Used a 5V latching dual coil relay and 12V power supply, with 5V this was not possible. I will post schematic ,if i will find it in my papers from those old times.