I'm trying to utilize a Pi on a high altitude balloon where I just stick the pi in and go, when I get it back though to shut it down...is there a safe way without access to monitor, keyboard, etc?

It seems when I turn on Pi, let it run, and THEN plug in an ethernet cable, it won't connect oto the network properly

  • 1
    Near duplicate of raspberrypi.stackexchange.com/questions/4719/…
    – goldilocks
    Apr 10, 2013 at 20:22
  • 1
    I think you might want to look to a solution for your "won't connect to the network" issue. That's annoying, and if you fix that, your shutdown problem is done for as well
    – Nanne
    Apr 11, 2013 at 7:00

4 Answers 4


If there is anything at all attached to the usb ports, you can use a udev rule such that unplugging the device will trigger a clean shutdown. I've already written a summary of the process, so I won't repeat it here. You could also do this with regard to an ethernet cable.


You could run a script, perhaps in Python or C that checks the status of a GPIO pin and then connect up a push button to that GPIO pin. Then when the button is pressed, the script could trigger the shutdown.


Assuming you know roughly how long the pi needs to run (battery capacity etc), just have a process that sleeps for X seconds and then shuts it down.


I like the button on the GPIO option to force a shutdown but I would not actually install a button for the flight I would leave the pins disconnected and jumper them once on the ground -- no chance to accidentally press the button while in flight.

I assume you are using the Pi for data collection which mean you probably don't want to lose data even if the power is lost during the flight.

I would look into setting up your system in a way that minimizes the chance of data loss if power is lost -- that way you don't need to worry too much if it is shutdown properly.

See this question for some ideas: https://serverfault.com/questions/356507/safe-ext4-configuration-for-systems-running-unattended

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.