-1

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?

1 Answers1

0

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.