Battery backup 12v 5a

I do EXACTLY this in a product I’ve been selling for years…
A diode to protect against reverse polarity, and to stop the filter caps discharging back into the power source…

Before the regulators, I tee off an input for an analog input for real-time input voltage monitoring… then the program can monitor and warn of voltage levels during operation…
If the detected supply voltage goes critical, it save all the operating values into EEPROM, and those are restored when power is restored.

A 470uF electrolytic provides enough time to save quite a bit of EEPROM… currently, I save about 3K and have plenty of time to spare.

(Remember you can’t do any of this when using delay() because the processor might be twiddling it’s thumbs when the power drops. You only have a few milliseconds to save the EEPROM before the board goes dark)

1 Like

That's very interesting! I like the idea of saving to EEPROM! For my application, I have no need to save anything, but just to be notified of loss of power. So if I forget the motor and just want the esp32 to notify me, I should be able to use a properly sized capacitor, and no need for a battery.

How would I know that main power is lost in that case? You mentioned voltage monitoring, so I can check for voltage drop and if that occurs then send a notification, hopefully in time before the capacitor is out of current? Any good links to give me more info on this?

Thanks again!

So it works just like the L298N then, it's Dual channel? I'll look for it. Thank you!

1 Like

Not really any links…

I take that protection diode straight into the voltage regulators.
Before the regulators (the diode’s cathode), I put a voltage divider 47K/10k on a 5V analog input - which gives me approx 25V monitoring range… allowing headroom, spikes and charging voltages on a nominal 12V supply.

That divider goes simply in to any analog input pin via 2K2, and monitored in the main loop().

I set three action thresholds (these are for 12V SLA batteries). the input is rolling-averaged over about 15 seconds - to identify sustained high or low voltage - e.g. battery is under short load, voltage drooping - let the user know!

High if over 14V
OK if over 11.7V
Low if below 11.3V

Crash Stop (save to EEPROM and halt) if below 10.8V* immediately)

*this voltage is to stop chemical damage to the SLA cells.

1 Like

It is two 1/2 bridges, enough for 1 reversing motor.

Ok thanks. So I'll do something similar and will check voltage drop from the main power to know that main power was lost and now I'm on battery. Then I'll send a notification to my phone.

I'll have to look into this a little more. I will also have to decide on a final approach now that I have more info.

I might ask more related questions when I get a chance to work on my project, or I might ask for validation of my final solution, so you haven't heard the last of me!!

@lastchancename , @gilshultz , @Wawa , thank you for your time and input.... BTW, what happened to Karma, I can't seem to find that option?

That is what we're here for and we like to hear how your project does.

I don't think that is necessarily right. The actuators only operate for an instant and may be assisted by a capacitor anyway. The smallest motor cycle battery should be more than enough. If you are somehow using using the actuator under continuous load, you may come to grief.

Are you referring to the amp consumption? I measured it - it pulled around 5 amps, but it did that very very briefly.

Yes. And you would be right to say "very very"..

BTW, remember the power loss —> EEPROM with a capacitor will run the CPU only for a moment… nothing like enough juice to send a text, dp owed the modem or anything else.

That’s why I have both circuits in place.
If the power is cut to the board, at least it saves its status, and possibly why’ it’s shutting down.

The charger and battery are there to avoid power loss in the first place.
e.g. if I pull the DC connector directly off the board, there’s no warning but I save the event and time etc.
When DC is restored, the box can do whatever it wants to recover - including send a message that power’s back on.

If you want to monitor the mains supply, that’s a different question. An optocoupler or relay across the mains - into a digital input can tell you when the mains comes and goes.

I also do that on some units, but it’s the battery option that lets the unit send texts even when the mains is off.