1

I'm building a battery powered device with a pi zero. The battery is a 3.7v LiPo w/ 2000mAh.

I want to be able to safely shutdown and restart the pi using a single switch or button. (preferably button because I'm using adafruit's pitft which has 4 buttons built in)

It's no problem to bind one of those buttons to run sudo halt, but my questions are these:

  • Is the power usage low enough that the battery would last for around a week halted?
  • In this thread, one user posted:

I did some measurings with the Zero.

When attaching power without card inserted the board first draws 27mA and

then after a couple of seconds it goes up to 56mA (waiting for usb boot?)

When holding board in reset by shorting the RUN pins it draws only 2.7-3mA(!)

When fully booted into raspbian lite with hdmi on it draws 99mA

after running 'tvservice -o' it draws 79mA

after sudo poweroff it draws 22mA

So, why does holding the reset decrease the power usage more than halting, and is this a safe/better way to leave my system?

  • Is there a "proper" way to do this that I'm missing? I've seen elaborate builds for safe power buttons, but they all seem rather gimmicky.
  • How are you planning to get the 5V the Pi needs from a 3.7V battery? – Steve Robillard Sep 25 '16 at 22:17
  • I have this regulator from adafruit. It works great. – Johnyburd Sep 25 '16 at 22:38
  • 1
    RPis provide no support for battery-powered applications. I suggest you look around to see if there's a suitable board which does, unless you really want to implement power management yourself. – Dmitry Grigoryev Sep 26 '16 at 8:39
1

Why does holding the reset descrease the power usage more than halting

This is an educated guess, and not based on any analysis of schematics, but: A hardware reset is equivalent to flipping the power on and off; it is intended to force components to restart as if just turned on. So holding the board in that state might easily mean there is no power to major components such as the SoC itself.

By contrast a halted state (note "halted" and "powered off" are actually the same thing on the Pi) simply means the system is no longer active and may have powered off some peripherals (I don't know about that either) -- but some part of the SoC is still on, doing nothing.

Is halted a viable state for a battery powered pi zero long-term?

You can do the math yourself since you already have the numbers, but obviously this depends on the battery and how long "long" is, but going with 2000 mAh for the former I doubt it very much.

The Pi is not an ultra low power device and battery operation was probably not given priority consideration in the design; making it so would have increased the cost, and making keeping the cost down in this case took precedence.

1

As goldilocks has noted "halted" and "powered off" are actually the same thing. (Although different things happen on the way through. I use sudo poweroff which causes the LED to flash 10 times before actually halting.) The SoC is still running, but only the Video Core appears to be active.

It used to be possible to HALT the ARM, but this no longer seems to be supported by the kernel. It may be possible to write a program to execute the HALT, but would need kernel privileges.

In contrast pulling the Reset line low physically resets the SoC, so nothing is running.

As soon as the Reset is released the Video Core starts running to perform the boot process.

It may be possible to utilise this, but you will have to provide a switch or other circuit to hold it Low.

  • So it won't damage anything to hold the reset switch for long periods of time (assuming it's properly shut down)? – Johnyburd Sep 26 '16 at 17:43
  • Whoops! Deleted my previous comment because I realized I've gotten into the habit of using halt -p...so without bothering to test I'll take your word for it that using plain halt doesn't blink the PWR led. – goldilocks Oct 1 '16 at 22:41

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.