Making a Latching Relay Return to a Specific State at Power Loss.... Ideas?

Started by Groovenut, November 22, 2016, 12:36:05 PM

Previous topic - Next topic

Groovenut

Hey all,

I stumbled upon this post by PRR http://www.diystompboxes.com/smfforum/index.php?topic=94191.msg811741#msg811741 and had a question for him regarding circuit modifications to ensure that the single coil latching relay would go to a specific state when the power was removed using a mechanical latching SPST instead of the flip-flop. IE black out true bypass.

Here's the circuit he posted



I am using a mechanical SPST with a 3k9 pullup resistor in place of the flip-flop seen in the picture so it can't be done by forcing the f-f to go to a specific state, only by forcing the driver or relay to do so. Also there will be the standard parallel polarity protection and power filtering on the V+.


Ideas?

Thanks in advance!
You've got to love obsolete technology.....

per_electric

Hi!

Don't know if this would be of any help to you, but I recently put this circuit together as a solution for a similar problem - namely being able to switch a circuit in and out with just one momentary switch, using a latching single coil relay and being sure of which state it would go to at power up.



The first two gates form a bi-stable flip-flop which always powers on in the same state. The outputs are split and fed either directly to the next gates or via Q1/Q2 and its associated components to form a time delay. This ensures that the gates IC2C/D momentarily outputs a high, which is then in turn fed to the H-bridge driving the relay. I'm sure it could be simplified, but it serves my purposes perfectly. If you find a gate with sufficient current output or a relay coil which doesn't need as much energy as mine does, you could probably do away with the H-bridge at the end. The impulse length is determined by the RC R18/C15 and R20/C16, respectively. Current drawn is mainly by the discharge resistors R19 and R21, about 3mA with the values in the schematic.

I'm sure the clever engingeers out there could make a contribution to this one and improve it quite a bit, as I'm merely a happy hobbyist myself  ;)

R.G.

As I was typing this, per_electric's post popped up. I haven't checked his circuit, but I have high expectations that it would work.

The thing about ensuring a consistent power up state with a latching relay is that you have to sense either power-down or power-up, and force the relay to the state you want it. Sensing power-down is a difficult (although possible) thing to do, as you not only have to sense it, you have to save enough energy somewhere to flip the relay.

It's much better to force the relay to go to the "bypass" state at power up, when you're sure the power will still be on to do the deed.

My favorite way to do a power-on something is to use CMOS Schmitt hex inverters and tie a pullup resistor and a capacitor to ground to one gate's input. The gate's output is guaranteed to be low in normal operation, but to be held high as power rises above the 3V or so that CMOS needs as a minimum. The capacitor holds the input down for a time determined by the pullup resistor and the capacitor, and at some point between 3V and a higher power supply, the capacitor will charge up enough to make the gate output flip from a solid high to a solid low, and the transition will be nice and sharp because of the Schmitt trigger nature of the input. That edge happens only on power-on.

I typically use the power-on edge to run a few half-monostables. The CMOS Cookbook explains these pretty well. An edge causes a capacitor-coupled next stage to be flipped on/off for a short time. A string of these things can cause cascaded timing intervals set by a single R-C per stage. To make your relay go "off", you probably want to force the control flipflop to go to "on", then "off" to guarantee state.

As an aside, a single hex inverter will usually have a couple of spare gates, and you could replace your transistor flipflop with two of the CMOS inverter sections as well. You'd still need the relay drivers for their current capability. So one 16 pin IC and a few resistors and caps could do it pretty easily.

These days, I can get a PIC 10Fxxx or 12Fxxx in an 8-pin package for about $0.75, so I'd probably program a PIC to do a single "set the relay off" operation, and likely have it do the entire control job as well as just power on, so one 8-pin package and maybe a couple of R and C would be enough. But you have to be able to program a PIC.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Groovenut

Thanks guys for the info.

So given how I am using the circuit, here is what I came up with. It's the simplest, effective circuit I could devise with discrete parts. It works well in the sim and on the bread board. Since I need the circuit to provide black out true bypass, I decided to wire the relay as bypass with the switch closed, as the only state that will cause an issue on black out is with the switch open.

C1 is the power filter cap, R2 is to simulate the effect circuit minimum current draw. On power up Q2 turns on pulling the gate of Q3 low and turning Q3 off. When power is disconnected, the voltage on the base of Q2 drops as the power filter cap is drained turning it off and turning Q3 on for a moment allowing the relay to reset to the bypass state.

Just 5 extra components. Maybe someone else can provide a simpler one.

You've got to love obsolete technology.....

ElectricDruid

Quote from: R.G. on November 22, 2016, 05:56:32 PM
These days, I can get a PIC 10Fxxx or 12Fxxx in an 8-pin package for about $0.75, so I'd probably program a PIC to do a single "set the relay off" operation, and likely have it do the entire control job as well as just power on, so one 8-pin package and maybe a couple of R and C would be enough. But you have to be able to program a PIC.

Roman Sowa of SynthDIY list fame also demonstrated a nice little snippet of PIC code which used the voltage across a diode fed to an ADC input to detect power-down. When the power drops, the voltage across the diode *doesn't* (at least initially) so the ADC reading actually goes *up*. You can then detect that rise and save the chip's state into on-chip EEPROM. His demonstration was latching buttons that remembered the state at power off, but the buttons were momentary and it was all done in software. Very clever. Something similar would work for a relay switching PIC.

HTH,
Tom

R.G.

That ought to work, all right. The trick will be having enough time to finish the EEPROM write cycle after the PIC power starts down and before it gets below the EEPROM write threshold.

Another way to do a similar trick but give yourself a bit more time is to use a resistor divider on the bulk supply before the PIC regulator and sense when the bulk supply drops. Then you have the run-down time of the bulk supply added to the power supply range on the PIC.

For really long "clean up" tasks, this can be extended to a diode-fed big capacitor for the PIC to hold enough juice to keep the PIC alive while it does whatever is needed.

For really critical tasks requiring storing whatever had to be remembered, one could adapt the code to the practice of storing each item as you go in the code, so that at most you'd lose the last one with no special circuitry needed, and minimize the writing down to one last write. This is more applicable to large states needing saving.

But if the task doesn't require remembering where you were, just setting it up correctly the first time, it's probably better to do it at power up.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.