I am building a battery backup for my dashcam, I need to turn off battery when the car is parked for a long period. Instead of having a manual on/off switch I want to control the battery using a latching relay.

So I need to disconnect the battery, when a momentary button is pressed. This battery circuit should be closed only if the power is restored, or turned off and turned on again.

Basically the relay should stay unlatched when the momentary button is pressed and released, when pressed again no action should happen, (this is to avoid acting as a normal switch) unless the ignition power is turned off and turned back on.

enter image description here

I want to satisfy below cases.

when the power is on and switch not pressed:

  • camera turns on automatically.
  • battery backup is ready, charging happens.
  • if the switch was on open state, reset back to closed state.

when the power is on and switch pressed:

  • disconnect battery, no charging.
  • camera still runs, until power is off.
  • no action when button is pressed again.

When power is off and switch not pressed:

  • if switch was open no action.
  • if switch was closed camera runs from battery, until power is back on.

when power is off and switch pressed:

  • if switch was open no action.
  • if switch was closed, disconnect battery, pressed again no action.

I do not have much knowledge about relay or electronics, any help is appreciated.

  • \$\begingroup\$ Please describe the overall effect you are trying to achieve. As your question is currently phrased, it is difficult to tell what you want the button and relay to do. \$\endgroup\$
    – vir
    Commented Feb 16 at 18:05
  • \$\begingroup\$ your description is unclear ... you say when the button is pressed, but you do not say anything about releasing the button \$\endgroup\$
    – jsotola
    Commented Feb 16 at 18:05
  • \$\begingroup\$ I'm not sure how "instead of having a manual switch" correlates with "when a momentary button is pressed". Also you talk about "the battery" and also "when power is restored". What power does the second phrase refer to? Block diagram, please! \$\endgroup\$
    – Dave Tweed
    Commented Feb 16 at 18:22
  • \$\begingroup\$ I may, or may not understand your requirements. However, if ignition is on, and button is pressed, should dashcam go off? If yes, would the only way to restore dashcam power be to turn ignition off and on again? My guess for what you want is that if ignition is on, then off button has no effect. But please verify. \$\endgroup\$ Commented Feb 17 at 1:10
  • \$\begingroup\$ This is my (new) understanding: 1. The only way to turn the dashcam power on is to turn the ignition from off to on. This will always turn the dashcam power on. 2. The only way to turn the dashcam power off is to press the button. This will always turn the dashcam power off. Is this understanding correct? \$\endgroup\$ Commented Feb 17 at 3:56

1 Answer 1


I can give you some pointers about how to employ a momentary switch for latching. The first uses just a relay. The natural state of the relay is coil un-energized, and in that state the path between IN and OUT is enabled:


simulate this circuit – Schematic created using CircuitLab

When SW2 is pressed, a current path for the coil is established, and the relay activates. One set of contacts opens, cutting off the output. The other set of contacts close, and being in parallel with SW2, they take over the duty of passing coil current, so SW2 can now be released, and the coil will remain activated, or latched on.

When power is removed (ignition switch SW1 is opened), coil current is cut off again, and the latched state is reset. The disadvantage with this setup is that the coil is energized when the load is off, and so will consume power during this "load off" state.

If you wish to reverse that behaviour, so that the coil is off when the load is off, then the only solutions I can think of require one or more transistors. Here's a single transistor version:


simulate this circuit

This employs positive feedback provided by a set of contacts of the relay itself. C1 ensures the transistor is on and the relay coil is energised, when power is first applied, by closing the ignition switch. This state is maintained and reinforced by +12V feedback. When the "off" button SW2 is closed, M1's gate rapidly falls in potential, eventually switching off the transistor and relay coil. This state is reinforced and maintained by feedback becoming 0V, but if power is removed and then restored, C1 will be discharged, and the latch is reset.

  • \$\begingroup\$ I am so sorry, but I'm totally confused, could explain bit more like where is In and Out in the second circuit? Also How this transistor work in relation to this application? Finally to confirm that is DPDT relay right? \$\endgroup\$ Commented Feb 18 at 16:03
  • \$\begingroup\$ @AlexRobbin I neglected to write IN and OUT on that circuit, which I'll correct right now. It's just the unused switch contacts on the DPDT relay. \$\endgroup\$ Commented Feb 18 at 16:08
  • \$\begingroup\$ @AlexRobbin The transistor circuit closes IN/OUT immediately, powering the coil only when the power is applied to the circuit via the ignition key. When the "off" button is pressed, the relay is switched off, breaking the IN/OUT path. The advantage to this design is that the circuit consumes very little power in that "off" state, unlike the first circuit, in which an activated relay (consuming power in the coil) corresponds to when the IN/OUT path is broken. \$\endgroup\$ Commented Feb 18 at 16:12
  • 1
    \$\begingroup\$ @AlexRobbin to be honest, I'm not finished thinking about this. It kept me up last night, trying to imagine how I could implement the low-power "off" state without the transistor. Give me time... \$\endgroup\$ Commented Feb 18 at 16:18
  • \$\begingroup\$ @AlexRobbin Is a no-relay solution acceptable? \$\endgroup\$ Commented Mar 20 at 2:03

Your Answer

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

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