I am working with a raspberry Pi and need to protect it from AC power failures. I already have a circuit and code that detects AC power loss and shuts the Pi down in an orderly fashion using a small UPS-like device. Although the Pi is shutdown, the UPS keeps the power to it up for a couple hours.
The good news is: if the power in the UPS runs out, the PI will automatically restart when AC power returns because the Pi "sees" the power come back on and it automatically restarts when that happens.
The bad news is: when the AC power goes out and then some time later, before the UPS runs out, the AC power comes back on. In that case, the Pi itself never lost power so it does not restart.
The Pi has a reset signal with a pullup to 3.2v. If the pi is shut down but still has power, it can be restarted by lowering the reset pin for .5 seconds.
So, the solution to this problem is a circuit that holds a Raspberry Pi 3.2v reset line low for .5 seconds when the AC power comes back up and then goes high (or open) for the duration of the power on cycle. (This re-power circuit will get power outside the UPS so it will have +5v when power is on and 0v when power is lost.) In order to avoid sudden off/on cycles, the power on circuit should hold off going low for a few seconds.
Here is what the reset signal needs to look like:
CONDITION -- SIGNAL STATE
AC Power ON -- 3.2v or high resistance
AC power goes OFF -- floating
AC Power ON -- continues to float or goes to 3.2v for 5-10 seconds
AFTER 5-10 Seconds -- goes low for .5 seconds
AFTER .5 seconds -- 3.2v or high resistance as long as power is on
What kind of a circuit can do that?
The good news is: if the power in the UPS runs out, the PI will automatically restart when AC power returns because the Pi "sees" the power come back on and it automatically restarts when that happens.
The bad news is: when the AC power goes out and then some time later, before the UPS runs out, the AC power comes back on. In that case, the Pi itself never lost power so it does not restart.
The Pi has a reset signal with a pullup to 3.2v. If the pi is shut down but still has power, it can be restarted by lowering the reset pin for .5 seconds.
So, the solution to this problem is a circuit that holds a Raspberry Pi 3.2v reset line low for .5 seconds when the AC power comes back up and then goes high (or open) for the duration of the power on cycle. (This re-power circuit will get power outside the UPS so it will have +5v when power is on and 0v when power is lost.) In order to avoid sudden off/on cycles, the power on circuit should hold off going low for a few seconds.
Here is what the reset signal needs to look like:
CONDITION -- SIGNAL STATE
AC Power ON -- 3.2v or high resistance
AC power goes OFF -- floating
AC Power ON -- continues to float or goes to 3.2v for 5-10 seconds
AFTER 5-10 Seconds -- goes low for .5 seconds
AFTER .5 seconds -- 3.2v or high resistance as long as power is on
What kind of a circuit can do that?
Last edited: