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

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

  • sudo halt DOES NOT trigger the 10 flashes. `sudo poweroff`` does. – Milliways Feb 14 '16 at 5:05
  • @Milliways I use sudo halt and I've always had 10 flashes. I'll add a gif to my answer. – Patrick Cook Feb 14 '16 at 5:06
  • @Milliways pesky 2 MB limit... I'll post a link to a YouTube video then... – Patrick Cook Feb 14 '16 at 5:26
  • @Milliways I've added a link to a video. It was done on a 2B running Raspbian Wheezy. – Patrick Cook Feb 14 '16 at 5:30
  • Don't bother - I won't look at it anyway. (I never use YouTube). I used to use sudo halt but the 10 flashes on sudo poweroff was pointed out to me and I had never seen it. I did some tests and found there were 10 countable flashes. I can't find the exact discussion but there is a related discussion on raspberrypi.stackexchange.com/questions/42183/… When I test there is sometimes some activity on sudo halt but not the 10 flashes. – Milliways Feb 14 '16 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.