10

Use case: On power loss, the pi is to gracefully close all I/O (already kept to a minimum) and shut down, to be manually rebooted later.

A supercapacitor works (I think; not sure of voltage near the end) but reboots the Pi (not sure why exactly).

A LiPo battery + charger + boost converter work fine, but are overkill. Too many components that could fail, and I need seconds, not hours of runtime.

[edit] The solution linked to by bobstro, and this one, allow the supplied voltage to drop to or below 4V. There are claims that even 3.3V can be OK (here, too), but the specs, I recall, state min. 4.75V. Is lower really safe for the storage? Could change a lot if it was.

kaay
  • 251
  • 1
  • 2
  • 9

1 Answers1

5

The answer to the question is to build one of the 2 solutions:

  1. One based on a LiPo/Li-Ion battery - gives much more time than needed, but the parts (chargers, etc) are common and cheap, and can be replaced easily. I gather that a boost to 5V is purely optional and the Pi can work well at 3.3V.

  2. One based on supercaps. Good solutions are here (claims 111 seconds on a pair of 25F caps in series) and here. This one would be good too, if the voltage loss alarm were on the input rather than the battery. This option is much more expensive. Might be good to skip the boost converter altogether, efficient ones are expensive (can afford inefficiency with batteries).

To deal with the Pi turning on/off at low voltage, either use a voltage divider on the DC/DC converter's ENABLE pin (usually has hysteresis), or - even better - ignore it and protect the filesystem from consequences by making it read-only with a separate partition for data storage, mounted only when at the end of the system boot.

Also, though this lies beyond the question's parameters, but has turned out to be the best for me, SIGTERM, SIGKILL and unmount leave the Pi in a state where power loss is safe to the filesystem, with no need for a proper shutdown, cutting costs as we now need only a couple seconds rather than 15.

kaay
  • 251
  • 1
  • 2
  • 9