Edited by brousant at Sun Mar 15, 2015 06:50 |
You can connect a single cell (3.7V) Li-Ion battery to the Banana Pi as described on http://hardware-libre.fr/2014/11 ... y-power-monitoring/
In Bananian, I am running this really simple script from rc.local:
if grep -q 0 /sys/class/power_supply/ac/present
echo "ac is not present, shutting down..."
shutdown -h now
Now, when the AC input is down, the BPi, continuing on battery power, performs a shutdown. And when the AC input comes back, it restarts.
I also reconnected the AC input while the shutdown was still in progress. I was pleased to see that in this case as well, the BPi came back on without a problem.
This pretty much satisfies my requirements for Banana Pi UPS functionality, which are mostly that the SD card is protected from corruption by sudden power loss, to an extent that the Banana Pi is not able to start up anymore when power comes back (this is reported to be a problem with the Raspberry Pi and I assume it is not different with the Banana Pi).
I think the major drawbacks of this solution are
- requires soldering to the BPi, since a battery connector is not mounted by default
- does not provide uninterrupted power supply to a SATA drive (the SATA drive power comes directly from the AC input)
With respect to the second drawback: with a conventional hard drive, this may not be that much of a problem; the data on can probably be sufficiently protected by running a journaling file system on it such as EFS4. With SSD's it would be a different story.