1
\$\begingroup\$

Okay, I'm at my wits end with this one. Having tried a dozen or so free/semi-free circuit simulators, I can't find any that include latching relays. This surprises me as they're one of the most common components I use.

Am I missing something obvious like another naming convention, or is there a decent simulator out there that does include them that I just haven't found yet?

I'm giving thought to coding one for Falstad's simulator, but can't do this in the office as I don't have the software...


The functionality I need is a single momentary switch latching the relay on, then latching it off again on the next press. I imagine I'm missing something fairly obvious in making this happen, so will keep playing, but felt it couldn't hurt to ask for an extra prod in the right direction please?

\$\endgroup\$
13
  • 1
    \$\begingroup\$ It should be fairly straightforward to bodge one, with a relay with an extra set of contacts to do the holding function, package it in a subcircuit. \$\endgroup\$
    – Neil_UK
    Jun 26, 2019 at 11:02
  • 3
    \$\begingroup\$ Add a D type flip flop to the relay driver circuit and tie the D input to logic 1. Use the clock input for latching the relay and the reset input for unlatching it. \$\endgroup\$
    – Andy aka
    Jun 26, 2019 at 11:03
  • 1
    \$\begingroup\$ Simulating a latching relay properly would require integrating mechanical simulation with circuit simulation. I can appreciate that you use latching relays frequently, but most circuit simulations don't need to simulate mechanical elements so there is little incentive to include it in a circuit simulator. You could try to translate the mechanical behavior to electrical equivalents and make your own model. \$\endgroup\$ Jun 26, 2019 at 11:40
  • \$\begingroup\$ @Neil_UK I'm open to bodging one if it's simple (I need about 9 in this model, so lots of components becomes a problem), but I've yet to work out the logic. Can you elaborate a little more how I could use extra contacts to simulate the latch? \$\endgroup\$
    – J. Carter
    Jun 26, 2019 at 12:16
  • \$\begingroup\$ @Andyaka Thanks for the tip! This seems to get me so close to what I need, with the exception of requiring two switches to control it. The functionality I need is a single momentary switch latching the relay on, then latching it off again on the next press. I imagine I'm missing something fairly obvious in making this happen, so will keep playing, but felt it couldn't hurt to ask for an extra prod in the right direction please? \$\endgroup\$
    – J. Carter
    Jun 26, 2019 at 12:18

3 Answers 3

4
\$\begingroup\$

@Andyaka Thanks for the tip! This seems to get me so close to what I need, with the exception of requiring two switches to control it. The functionality I need is a single momentary switch latching the relay on, then latching it off again on the next press. I imagine I'm missing something fairly obvious in making this happen, so will keep playing, but felt it couldn't hurt to ask for an extra prod in the right direction please?

OK, to make this work from a single switch, tie the D input to the inverted output of the D type flip-flop (Q bar) instead of tying it to logic 1. Now, each time the switch is pressed (i.e. a single press puts clock high and then returns it low when released), the output toggles state and remains latched until the next transition on clock: -

enter image description here

If you were to build it in hardware then a good trick is to incorporate contact debounce like this: -

enter image description here

Taken from this answer from 2013.

\$\endgroup\$
7
  • \$\begingroup\$ That's absolutely perfect! Wow! I think I could have played with this for weeks without getting something that neat in execution! Thanks so much! \$\endgroup\$
    – J. Carter
    Jun 26, 2019 at 13:39
  • \$\begingroup\$ Small note for anyone finding this as a potential solution to the problem, it works really well in some circuit simulators (Falstad, for instance) for a single latching relay, but doesn't work in others (e.g. Everycircuit/Multisim), and exposes what I think is a bug in Falstad in that if you try to control the clock with a relay (or another D flip flop) it will register a signal even when the relay/flip flop is open. So close :/ \$\endgroup\$
    – J. Carter
    Jun 27, 2019 at 13:20
  • \$\begingroup\$ Of course it will work in all simulators. It’s a standard technique. If you couldn’t get it to work then that might be an implementation problem. \$\endgroup\$
    – Andy aka
    Jun 28, 2019 at 15:52
  • \$\begingroup\$ As noted, it does work, but fails to read anything but direct inputs in Falstad (the only simulator I've found a D flip-flop that registers the Q bar -> D connection) making it ineffective as a solution. Here's the simplest way I can demonstrate this... ibb.co/m6brxhf The input is registered despite that the relay is open and no connection is made. \$\endgroup\$
    – J. Carter
    Jul 1, 2019 at 9:43
  • \$\begingroup\$ The link doesn't show anything relevant in my browser and your words above don't make sense to me. \$\endgroup\$
    – Andy aka
    Jul 1, 2019 at 11:05
1
\$\begingroup\$

As an alternate solution, lots of people suggested creating a sub-circuit to 'latch' the relay. There was a lot of head-scratching in this, and it's far from neat/uses a lot of resources (in Falstad, at least), but in case it's of use to anyone finding this thread, here's a latching relay setup.

It requires two double pole relays; the first for logic, and the second to use one pole as part of the logic and the other as the actual toggle. So in terms of treating this as a single 'latching relay', the labelled Switch is your input signal (and can be replaced with a single pole relay if this needs to be electrically triggered), and the secondary pole of the labelled Output is what is actually toggled backwards and forwards with each press of the switch.

Latching Relay with Non-latching Relays

\$\endgroup\$
3
  • \$\begingroup\$ This circuit won’t work in reality because it relies on putting two relay coils in series for it to work. A proper simulation tool that had decent models for parts would also fail this circuit. I might suggest that you change the decision to accept your own answer because it’s clearly the poorer answer for you and anyone reading it. \$\endgroup\$
    – Andy aka
    Jun 28, 2019 at 15:56
  • \$\begingroup\$ @Andyaka I can't see how - your answer doesn't work in the simulators I have access to, whereas this answer works in all of them. The idea here is not to create a working latching relay, but to provide the functionality in the simulator (since no one has been able to suggest a simulator that includes latching relays). The D flip-flop does not work. This does. \$\endgroup\$
    – J. Carter
    Jul 1, 2019 at 9:46
  • \$\begingroup\$ Then you are incorrectly implementing the flip flop circuit or breaking a rule such as not having a pull-up or pull-down resistor. Nobody will use this composite relay circuit for the reason I have mentioned and, for other reasons, they will use a flip-flop. \$\endgroup\$
    – Andy aka
    Jul 1, 2019 at 15:10
0
\$\begingroup\$

The functionality I need is a single momentary switch latching the relay on, then latching it off again on the next press.

There are ICs that provide this functionality. For example, U6032B.

It has three debounced inputs: ON, OFF and TOGGLE (one can be used for momentary switch) and a relay driver with Z-diode.

U6032B datasheet has an example circuit under "Figure 2-5 ON/OFF Function" section.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.