Hello,
I intend to power a mega board (with enet shield) with a ups made of a 12V SLA battery, a charger maintainer and a 12->7.5V to the barrel connector.
Assume after a long mains failure, the battery volage decrease to a point where the board voltage becomes below the spec, say fr a Vbat=11.3V. Suppose I detect the condition using the a/d
At this point, can I still run a simple code which waits for the voltage to become high enough, say Vbat>=12.3V; knowing that either this code will rune correctly OR the machine will reset using internal hardware resources
OR, must I have a special hardware to maintain the board in reset state if voltage below some value?
You need an external electronic circuit or relay which completly disconnects the power from the battery when the voltage goes low enough.
Holding the board in reset when the voltage also goes low is possible, and will stop the program running, but then ultimatly this will drive the battery down to 0V, which is not at all good for the battery.
And you can't do that with 5V applied to the 5V pin on the Mega?
I don't follow; at 11.3V there would still be plenty of headroom for a buck converter to get a reliable 5V out. Provided the battery actually still has the capacity left to power the Arduino, that is.
So what is it exactly that you're trying to accomplish and what problem will it solve? I'm seriously confused here. If your battery is essentially dead, there won't be much sense (or possibility) to do any checks anyway, would there?
@anon35827816 : didnt think to power through the 5V And GND pins. Indeed it should allow saving the power wasted by the 5V reg. Thanks!
As for the ~11V limit, it seems that around this point Vba(t) starts fast descent. At
07:00 Vbat was 11.12V ant at ~14:00 server responded no more
What i need to do is find optimal solution such that, in the rare occasions of prolonged mains failure, either the processor executes my code or it does nothing
@Sernet - didn't think of avoiding emptying the battery. Thanks!
I still don't get it. In case of ptolonged mains failure, the controller will stop executing anyway as soon as the battery runs flat...
Otherwise, how aboit setecting mains power and if it is out for too long, make the controller respond to it?
Finally, it's really wasy to measure battery voltage with a voltage divider on one of yiur adc pins.
Sure, but:
1: That's what brownout detection is for. Just set the correct fuse in the microcontroller.
2: The brownout doesn't happen anywhere near the 11.3V you mentioned in your first post.
Stuff doesn't add up...are you thinking this through properly?
@srnet: sure and ill need to power stuff wo brownout, it seems anuvoidable to disconnect the supply on its way down. Btw i also have a 8V-20V to 12V for stuff needing 12V
Connect the power to the Arduino through the contacts of a relay.
Have a push button that energises the relay.
You push the button, the relay switches, so the Arduino starts up and a transistor connected to the Arduino is used to also provide power to the relay, so the Arduino stays powered.
Every so often, read the battery voltage, if its low, turn off the transistor that is powering the relay.
The relay turns off, Arduino looses power, no current draw at all from the battery.
To turn the Arduino on again you have to push the button .....