0

I've been playing around with my Pi on a battery recently. I have the Pi set up so that I can SSH into it. Using the standard commands(sudo shutdown -h now) to shutdown work at bringing the Pi down, but because I am across SSH, I have no idea when it is good to pull the plug. The Pi then reboots, as it's receiving power. At which point I can log back in over SSH and start over.

Ideally, I would like it if my Pi stopped pulling power after the halt, as my battery automatically shuts off after 10 seconds of no power drawn. But, If I could just figure out when it would be safe to manually pull the plug, I would be happy.

TL:DR How do I determine when I can pull the power from a Pi not connected to a screen? Is there a way for it to not draw power after shutting down?

1
  • 2
    On a sidenote; sudo halt does the same and is a lot faster to type.
    – Gerben
    Commented May 3, 2014 at 19:03

2 Answers 2

2

It depends somewhat on your distro and how you've configured the Pi (some software may include commands that get run on shutdown).
If you can temporarily attach a monitor, time it a few times and then add a few seconds to the longest time you observe. If you can't attach a monitor, but if you can see the LEDs, you can wait until only the red one is lit, and then a few seconds more. If you can't see the LEDs, 45 seconds from when your SSH session is disconnected is probably plenty.

2
  • Second that. Just wait 3 seconds after all leds have stopped blinking, and only the red one is still on.
    – Gerben
    Commented May 3, 2014 at 19:01
  • I'm using a Pi specific UPS and that waits 40-ish seconds after pulling a dedicated GPIO pin low before killing the power to the Pi so I suspect that 45 seconds is a good figure to use.
    – SlySven
    Commented Dec 18, 2015 at 0:36
1

The correct shutdown and power-off command is

sudo shutdown -hP now

The Pi will continue to draw power (I don't remember how much, perhaps 125mA) even after power-down.

If you are powering from a lipo you'll need to disconnect the battery, otherwise it will drain the cells and the battery will be useless.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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