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!

2
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Oct 26, 2021 at 7:51
  • Milliways already told you about gpio-shutdown. Now comes the ugly part: the Pi 4 can either stay powered 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 without a power cycle. Oct 26, 2021 at 8:51

1 Answer 1

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.

3
  • 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, 2021 at 2:29
  • @Patrick DO NOT ask Questions in Comments - edit your post, but this is as clear as mud.
    – Milliways
    Oct 26, 2021 at 2: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, 2021 at 2:55

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.