Making normal relay into latching on and off SOLVED

Can I make a normal SPST relay into a latching one? Have a light bar to mount on my Jeep and I want to turn it on and off with two buttons, one on, one off. Can't figure out how to do it with two buttons and a relay but it seems like this should be possible.

by blairem
November 16, 2016

2 Answers

Answer by mrobbins

Here's a way to make a normal relay act like a latching one just by adding one transistor (and a few miscellaneous) resistors and capacitors and a diode):

Click it, run the time domain simulation, and you'll see that it all works in simulation (CircuitLab is kind of amazing)!

Make sure RLY1 is big enough to handle your lamp bar, and M1 is big enough to handle the relay coil.

How does it work?

When you press the "ON" button, it manually energizes the relay coil. When that happens, the OUTPUT goes high (gets connected to VBAT through the relay). That high voltage signal goes through R1 and charges up C1 until the voltage there is high enough to keep M1 on permanently -- which is what keeps the relay coil energized.

Then, when you press the "OFF" button, it discharges capacitor C1 (technically it discharges it to about $V_{BAT}*\frac{R_2}{R_1+R_2}$), but that's close to zero, or at least close enough to turn off M1. When the voltage there gets low enough, M1 turns off, which causes the relay coil to turn off too. At that point, the feedback from OUTPUT and R1 stops -- so the whole thing stays off.

D1 is there to protect M1 from the inductive spike when the relay coil gets switched off quickly. C1 is not strictly necessary as M1's gate-source capacitance may be enough, but it makes it conceptually easier to understand, (and possibly more noise resistant too). R1 and R2 are arbitrary, as long as not too much current flows through $R_1 + R_2$ and the switch while the OFF button is being pressed, and and as long as $R_1 \gg R_2$.

@SJohnsson is right though: a toggle switch is much cheaper and simpler :P

ACCEPTED +2 votes
by mrobbins
November 16, 2016

amazing. exactly what i was looking for! thanks

by blairem
November 16, 2016

That simulation is ridic cool

by blairem
November 16, 2016

Answer by SJohnsson

Why not just use a toggle switch instead of two buttons?

No relay, nothing complicated to break. Simple and cheap.

P.S. remember to use a fuse

+1 vote
by SJohnsson
November 16, 2016

Have two extra push buttons on the dashboard already. If i try to put a toggle switch in it's going to look a lot more DIY. And not in a good way lol.

by blairem
November 16, 2016

Your Answer

You must log in or create an account (free!) to answer a question.

Log in Create an account


Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

Search Questions & Answers


Ask a Question

Anyone can ask a question.

Did you already search (see above) to see if a similar question has already been answered? If you can't find the answer, you may ask a question.


About This Site

CircuitLab's Q&A site is a FREE questions and answers forum for electronics and electrical engineering students, hobbyists, and professionals.

We encourage you to use our built-in schematic & simulation software to add more detail to your questions and answers.

Acceptable Questions:

  • Concept or theory questions
  • Practical engineering questions
  • “Homework” questions
  • Software/hardware intersection
  • Best practices
  • Design choices & component selection
  • Troubleshooting

Unacceptable Questions:

  • Non-English language content
  • Non-question discussion
  • Non-electronics questions
  • Vendor-specific topics
  • Pure software questions
  • CircuitLab software support

Please respect that there are both seasoned experts and total newbies here: please be nice, be constructive, and be specific!

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.