Single-coil latching relay. Pulse duration

But for future reference for circuits that don't use the ATTiny85, can we possibly come to any agreement on how the inductive spike of a single-coil latching relay should be dealt with?

Back-to-back zeners is a very appealing solution, provided they would respond rapidly enough, which I think is not obvious.

Even an H-bridge is going to produce these spikes. As far as I can tell, the spike is transferred to the supply rails through the body diodes of two of the mosfets (the ones that didn't just turn off). You would be raising both Vcc and ground. Does that cause any problems?

If not, then maybe just install external diodes that parallel the protection diodes in the 85 - from ground to each pin, and from each pin to Vcc. And maybe use shottky diodes to protect the protection diodes.

What else? Somebody mentioned TVS. What about inserting series capacitors into the lines. Would that eliminate the spikes because the current trails off automatically?

It seems there should be a school-approved solution for this. Or maybe people who know what they're doing just always use a two-coil relay.

Does anyone have a single-coil latching relay and a scope?

It would be nice to put a scope on those relay connections and observe both current and voltages during operation...

1 Like

"A scope! A scope! My kingdom for a scope!!!!!"

(C) 1485 Richard III, who was recently dug up and reinterred.

"Seek and ye shall find" (Matthew 7:7)
(Who says we aren't educational in all fields... :rofl: :grinning: :smiley:)

A very elementary UNO based scope for quick and dirty analysis.
I have made one and its surprising how well a base analog input can work.

Tom.... :smiley: :+1: :coffee: :australia:

I don't think that would be sufficient for the sort of things we want to look at here...

I have a scope... Gonna try this later today

I think we all have been assuming that the relay coil terminals connect directly across the coil but that may not be true with this relay. This is a latching relay that requires polarity reversal to trigger the two states, so who knows what kind of electronics might be is inside.
Maybe it's actually a two coil relay with some diodes/transistors inside that steers the current to the appropriate coil.

Measured relay pulse on ATtiny84 output pin with oscilloscope:

  • Max: 5.12V β†’ :white_check_mark: below VCC + 0.5V limit
  • Min: –0.4V β†’ :white_check_mark: above GND – 0.5V limit
  • Datasheet (ATtiny24/44/84): I/O pin range = –0.5V to VCC + 0.5V
  • So both overshoot and undershoot are within absolute max, but there’s very little margin

Installing SA8.0CA bidirectional TVS diode across relay coil to clamp both directions. Will test again and report back.

1 Like

Some remarks:

The datasheet of the ATtiny24/44/84 shows it does have diodes on the I/O pins. Possibly they can withstand the same current as it's MOSFETs. (Datasheets of some other ATMEL microcontrollers specify 1mA.)

The proposed 8V TVS won't activate as long as these diodes are working.

If needed, the simplest protection is using 4 (schottky) diodes or (mis)using a rectifier bridge, made for at least the expected coil current.

The latching mechanism is most likely magnetic. The producer tested his product for the minimum pulse length, measurements came back with values between 1.5 and 3ms (if I read the datasheet right). I can't decipher a maximum pulse length, but if you intend to keep it activated you wouldn't need a latching type.

Am I reading correctly that the horizontal scale is set to 2ms per division? If so, I suspect you might see higher spikes at faster settings. But they would still be clipped by the protection diodes.

I wonder what current into or out of the GPIO pin would look like.

Yeah; stick a 1ohm resistor (or similar) between the IO pin and the relay, and use the scope to measure the voltage across that (simultaneously, if your scope has two channels.)

Or if you have a battery powered scope, which is not referenced to ground, you can measure directly across the resistor with a single probe. But you want to see both positive and negative currents.

Relay Coil Current Measurement (ATtiny84 GPIO Stress Test)

A 1.15 Ξ© sense resistor was placed in series with one coil pin, and the voltage across it was captured on a Rigol DS1054Z oscilloscope.

Voltage readings from scope:

  • Max: +70.0 mV
  • Min: –176.0 mV
  • Vpp: 246.0 mV

Current calculated using Ohm’s Law (I = V / R):

  • Max current: +70.0 mV / 1.15 Ξ© β‰ˆ +60.9 mA
  • Min current: –176.0 mV / 1.15 Ξ© β‰ˆ –153.0 mA
  • Peak-to-peak swing: 213.9 mA

:warning: This was the worst spike I managed to capture β€” not all pulses were this extreme. Many fell within the ATtiny84’s Β±40 mA limits, but occasionally this larger spike would appear.

I'm now waiting for a Littelfuse SA8.0CA bidirectional TVS diode to clamp these spikes. I'll post updated results once installed.