2

I have a RPI2B controlling a mobile CCTV setup. System runs on 12V (solar panels + batteries) with a low voltage disconnect (LVD) and PI powered by a buck step-down converter. RPI drives a relay via a MCP23017 port expander + transistor etc on a custom board. The relay toggles +12V source for the buck from either the LVD or directly from the battery. A simplified diagram of the circuit is shown below.

circuit diagram

When PI powers up, a python program starts which toggles the relay setting the +12V source to the battery (directly). If the battery voltage drops below a certain voltage, the LVD cuts out which is picked up by RPI via the GPIO IN. Pi does some magic and then shuts down. As one of the last things before power off the relay goes off and toggles the +12V source to LVD so PI loses power. This allows for the PI to startup automagically once the battery recharges and LVD turns on.

When shutting down I don't explicitly turn off the relay. It goes off by itself almost at the very end of the shutdown. Unfortunately while testing I can see that the ACT LED on the PI continues to flash for about second after the relay disconnects. This leaves me with about a second of power shortage.??

Q1. At what point exactly in the shutdown process is it safe to lose power?

Q2. Can I use a capacitor (as shown in the diag.) to 'hold' the power for a second or so. If so, how do I calculate the value? I looked at some equations related to capacitor energy etc, but its little bit over my head atm.

1 Answers1

1

That ACT flash you are seeing is most likely one of the last ten flashes it does to tell the user that it is done powering down.

If you want to see this for yourself, plug the Pi into something other than a battery, run sudo halt or whatever your favorite shutdown command is, and stare at that ACT light. After it is done erratically blinking for a while, it will flash 10 times, each flash the same as the last. This is to signal that the shutdown process has finished.

Even though it is the ACT light, the Pi is not writing/reading the sd card.

To directly answer Q1: The point at which the first of these ten flashes starts. That is when it is safe to lose power.

As for Q2, I don't think I have enough knowledge in the hardware department to answer that, but I don't think it will be necessary, assuming that last flash you see is one of these 10.

EX (On Raspbian Wheezy):

https://youtu.be/WY3Ze1MOHts

Patrick Cook
  • 6,365
  • 8
  • 38
  • 63