I have a Raspberry Pie 2 that I want to use to light LEDs behind my monitor if I should be sleeping instead of staying on the Internet. For this I will use a autostarting python script, but I don't know how to handle the power off, as I don't want the LEDs to be lit if my PC is turned off. I thought about the following possible solutions and would like to hear what you think of them, or if you have any better ideas.

  • I could just power the RP over one USB port from the PC as I have a switchable power outlet, but then I would turn it off each time without propper power down.
  • I could add a big capacitor, and sense the power loss to use the remaining charge to power it down properly, like a little UPS, but this could be a little bit overengineered.
  • I could ping my PC, and if I cannot reach it it is off, so the LEDs will be also switched off. This setup could also be used to get this Pihole adblocker running.

What do you think?

  • Capacitors make a very poor UPS for reasons described here. If you need constant voltage, necessary capacitance becomes prohibitively large, tens or hundreds of Farads. Commented Feb 12, 2021 at 12:55
  • I found a UPS example here, this should be working. But I think I will go with the pinging, then I have the least amount of soldering. The RP only uses a few Watts, so it is no problem if I let it run all the time... Commented Feb 13, 2021 at 14:52
  • Note that UPS uses 2x50F caps to power a Pi 1, and the input power supply is 5V/20A, not a wall wart. For a Pi 4 with a USB HDD, you'd need 20 such caps, and I wouldn't bet a 20A supply can provide the inrush current for them. Commented Feb 15, 2021 at 6:58

1 Answer 1


Have a terminal open to the Pi from your computer, when you go to shut the computer down issue the halt command to the Pi as root there . Once both are shutdown cut the power with a switch on a power bar both are plugged into. If not the pi will still be getting power, they only fully shutdown when the power is not longer available.

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.