0

I have a raspberry pi 4 and 2 5v power sources.

1 of the power source is always on and i would like it to power my pi.

The other one i will be connecting to a 5v to 3v converter and connect it to a gpio so it could turn the pi on and off whenever theres power.

I think i have the turn off figured out by writing a script that listens to the gpio and have it shutdown when the voltage drops.

But how do i have it turn on when the power kicks back in? Is that even possible?

Please try to explain things as layman as possible as i am very new to these kind of stuff. Thanks!

Patrick
  • 9
  • 1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Oct 26 '21 at 07:51
  • Milliways already told you about `gpio-shutdown`. Now comes the ugly part: the Pi 4 can either [stay powered](https://raspberrypi.stackexchange.com/questions/104944/rpi-4-consumes-2-5w-when-shut-down) after a shutdown but be able to restart, or it can reduce the power consumption considerably (be essentially off), but it won't be [able to restart](https://raspberrypi.stackexchange.com/q/108333/33476) without a power cycle. – Dmitry Grigoryev Oct 26 '21 at 08:51

1 Answers1

0

You don't have to write ANY code to shutdown the Pi - the gpio-shutdown functionality is already in the kernel.

You CERTAINLY don't need a second power source.

NOTE this will NOT turn power off - the only way to do that is to turn the power off although there are devices which implement power control using external hardware.

Also note that when shutdown there is still power on the 5V & 3.3V pins.

NOTE Connecting 3.3V from an external source to a GPIO without some protection is inadvisable.

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • I'm sorry if I wrote my question poorly, but the reason why I need 2 power sources is because #1 is constantly giving power to PI (even when shut down), and #2 is to turn the pi on and off. Like when #2 has power, the pi would turn on, and when #2 loses power, it would run a couple of scripts then shut down, while #1 is still giving it power till it turns back on. Is this possible? – Patrick Oct 26 '21 at 02:29
  • @Patrick DO NOT ask Questions in Comments - edit your post, but this is as clear as mud. – Milliways Oct 26 '21 at 02:49
  • Im sorry, I was just trying to clarify that I do need the 2nd power source because it would be my on and off switch pretty much. – Patrick Oct 26 '21 at 02:55