My approach would be to power the Arduinos from a battery that is continuously trickle-charged from the mains. If the mains fails the battery will just carry on until it runs flat. No switches are required.
You could arrange for the Arduino to monitor the battery charge voltage and raise an alarm if it fails.
Yes , I would do the battery option too as it covers mains supply failure too.
can i use these to trickle-charge a 5V-ish battery?
I have never seen a 5V-ish battery. A lead-acid battery will probably be 6v or 12v. 4 x NiMh cells would give 4.8v and 5 of them would be 6v. 2 x LiPo cells would be 7.4v.
I don't know if it would be safe to charge 4 NIMh cells with a 5v supply. I suggest you see what the Battery University has to say about it.
For this sort of application I think I would prefer the robustness of a lead-acid battery if the weight is not a problem.
One way I can think of doing auto-switching of power at 5V goes like this:
two schottky diodes to provide a ~4.5V rail if either supply is working. This powers a comparator
and an inverter. The comparator drives the inverter and one p-MOSFET, the output of the inverter
drives a second p-MOSFET.
The MOSFETs switch each of the power rails to the load 5V rail. Add some hysteresis to the
comparator circuit (basically two voltage dividers from the supples) to ensure it doesn't continually
You want the switching to be reasonably quick, so no large valued gate resistors, keep them 1k
or so at most. At 4A load the decoupling caps in the load will discharge on a timescale of less
than a millisecond...