(Nothing to do with KiCadHowTo… it was just a quick way to get this on the web….)
It can't be (too) hard??
And yet it gets discussed endlessly… the right "wheel" not yet invented, it seems…
"It" being a UPS (uninterruptable power supply) for Arduinos, etc.
Modular commercial answers DO exist, e.g. the following at about $32 November 11, to which you would have to add the price of a suitable battery…
However, making your own can be more fun!….
I sketch my very rough idea below. What's there is meant to spark discussion, not to be "the answer". The discussion is at….
… and elements of it will be transferred here in due course.
FORGET EVERYTHING IN GREEN FOR NOW…. including the horizontal rectangle over the horizontal wire to "Vunreg"
Below here: Two sections:
Plan A, in 3 parts- 1: The simple plan, 2: The fancy plan 3: Design considerations, including shortcomings.
In both "plan A" variations, "A" is some circuitry which controls how much current flows from Vwallwart to what is "below" A.
The simple plan
The simple plan uses just what you see in black above.
While the "household" AC voltage is available, a low DC voltage will be supplied via "Vwallwart". Element "A" keeps the current flowing low enough that no harm comes to the battery ("B"), but enough current flows to serve the needs of the Arduino, which has it's voltage regulator "fed" from Vunreg. While the household AC is present, the battery gradually charges. I hope that by careful design, it is possible to rely on the increasing internal resistance of the battery to "choke off" the charging current, or at least reduce it to something which can be tolerated indefinitely.
When the household AC fails, Vunreg will be supplied from the battery, for as long as the battery's capacity allowed.
I envisioned using a 12v lead-acid battery and providing about 15 volts from the wall wart (transformer converting "household" AC to low voltage DC)
It might be that a simple lead-acid battery trickle charger could provide all that you need for the wall wart PLUS "A"? Depending, of course, on how much current your Arduino and associated circuits draw. If that is too high, the trickle charger is going to be "confused" beyond proper functioning.
The fancy plan
As above, with one or two embelishments…
The green rectangles are resistors. The horizontal one was to do with an idea I have abandoned… ignore it!
I'd like to find a way for the Arduino to monitor the battery voltage. I believe that allows you to infer the charge state? A simple voltage divider won't work… so more than the vertical resistors and wire D will be needed. But SOME way to determine the voltage in wire "C", in an Arduino-friendly form must be possible? If nothing else, how about a voltage to frequency converter??
The point of watching the voltage in wire "C" would be to generate a signal in wire "E" which would cause element "A" to further increase its resistance as the battery nears full charge. As I envision things, this feedback mechanism would be Arduino moderated. If I knew more about analog electricity, I would do it with discrete components, so that everything in the Arduino would be free for more interesting things!
Maybe the idea watching the voltage in wire C, when you can't guarantee an unchanging current out over Vunreg is as flawed as the idea of using the voltage divider to bring the voltage down to something Arduino- friendly? If so, how CAN we measure the battery charge state? Current into battery? And how do we measure that?
Design considerations and shortcomings
Shortcoming 1: As described above… but perhaps not insurmountably… the system would not fail nicely. After the household AC was lost, the Arduino would operate for a time, but the voltage would gradually slip below the minimum, the system would die gradually, "brown out" from poor to useless. Perhaps not good. AND, after such an event, when the household AC was restored, the discharged battery might draw so much current that Vunreg wasn't satisfactory for a while. But! Would either ALWAYS matter? Are there "fixes"?
Design consideration 1: What battery technology are you going to use? Some (LiPO?) are very fussy while charging, and the voltage applied has to be very carefully regulated. I'm happy to work with the shortcomings of lead-acid in the belief (erroneous?) that they are more easy going, despite their other flaws. I don't think I'd use a "car battery"… but there are sealed units, as used in burglar alarms.
(Read the discussion of plan A first.)
"F" is a current limiter, as "A" before… but maybe as it will only be supplying the battery, not confused by also supplying the Arduino, it can be simpler.
Diode "G" may not be necessary, depending on how "F" is done.
A capacitor like "J" should be present in the "Plan A" version too. In fact, it merely supplements one that is almost certainly present in the Arduino's Vunreg-to-Vreg circuit, anyway… but it is worth having. It will maintain Vunreg during "switch over" from household electricity operation to battery operation.