0

I would like to control power of a Raspberry Pi 4 using another Raspberry Pi 4. Each Raspberry Pi is powered by its own official Raspberry power supply, to make sure each one gets enough power.

It should be possible to force a shutdown and power up the slave-Pi4 afterwards again. This has to work even when the slave-Pi OS is frozen.

Reason is: I'm building a Continuous Integration pipeline, where the master prepares an OS image for the slave-Pi to boot via network/PXE. In case the provided image is broken and fails to boot, the master should still be able to reset the slave to try a new image.

enter image description here

Is it possible to do this using GPIO pins? Which pins should be connected?

  • 1
    **There is no "power on/off command".** You need to control the power between the supply and the Pi (or between the 5V adapter and mains) using transistors or a relay (probably a relay between the adapter and the wall is easiest). – goldilocks Jan 26 '22 at 15:02
  • 1
    What is CI? Where is the image the slave Pi is booting from? – joan Jan 26 '22 at 17:30
  • @joan added to the question - CI=Continous Integration, slave is booting via PXE/network – Wolkenarchitekt Jan 27 '22 at 11:32
  • You could use a relay connected from the master GPIO to the slave power supply. This could hard power cycle the slave. Are you sure this is the best way of solving the problem though?! https://en.wikipedia.org/wiki/XY_problem How about PoE supplies for both Pis that you have control of on the switch? – Mark Jan 27 '22 at 23:57

1 Answers1

2

You cannot do this with the standard 40-pin header. Per this link, there is a RUN pin on all Raspberry Pi 2, 3, 3+, 4, and Zero/Zero W boards that will restart them.

It is labelled RUN, and bringing it to GND will cause a reboot an RPi board. Note that it causes a hard reboot, with no opportunity for shutdown.

I am not certain, but specifically I think pulling RUN low will cause a halt/lockup, then releasing it to float allows it to reboot. But you should test this out to be sure. I'm also not sure if you must let it float or if it's OK to pull to HIGH. Again, you should test, and then built your circuit accordingly.

Note again this pin is not on the 40-pin header, and where you can find it varies by board model. Here is a picture of it on the RPi 2. Here it is on the RPi 3 (along with code and wiring that you may wish to investigate because it does what you want). It's not called out in the picture, but here you can see it on a Zero in the upper right hand corner. Here it is on a 4, next to a global_en pin that might also interest you.

Jeremy Impson
  • 158
  • 1
  • 1
  • 6