1

1. Description

To boot and shutdown my pi I have been using a button shorting GPIO 3 an GND. However after shutting down the pi, the fan shim and HDD keep on running. To solve this I've edited the bootloader configuration to contain WAKE_ON_GPIO=0 and POWER_OFF_ON_HALT=1. This of course caused my pi to stop booting when pressing the button. A possible solution to boot the pi is to short GLOBAL_EN and GND but it's not possible to safely shutdown this way.

What I would like to have, is a (simple) solution safely shutting down and booting the pi by pressing only one button. And while the pi is shutdown not to output any power to the usb ports, GPIO pins and Ethernet port. Does anyone know one?

Some clarification: The thing I'm trying to solve is being able to boot the pi when in low power mode without pulling the plug. With a simple solution I mean the simplest solution possible. I was hoping there to be a setting I could use. In the case there not being one, I was hoping there to be a HAT that could detect the pi being powered on, bringing a GPIO pin down to shut it down when it's on and bringing global_en down when it's not

2. Lessons learned while researching

2.1. Booting the rpi

  • The pi can be booted by bringing the GPIO 3 pin down (Documentation)

2.2. Shutdown

  • The rpi can be safely shutdown by writing a py script and triggering it when a GPIO pin is brought down
  • Downside: When shut down the usb devices, ethernet port and hat is still powered

2.3. Powering down USB devices,...

  • On shutdown the usb devices can be powered down by editing the bootloader config. (Documentation)
  • Downside: the rpi cannot be booted anymore by bringing the GPIO 3 pin down

2.4. Alternative way of booting the rpi

2.5. Extra

  • The rpi still outputs 5v when shutdown, WAKE_ON_GPIO=0 and POWER_OFF_ON_HALT=1
Seamus
  • 23,558
  • 5
  • 42
  • 83

3 Answers3

2

RPi 4B 5V Power Bus

AFAIK, there is no command, dtoverlay, or bootloader configuration that will power off the 5V output on the RPi 4. Using WAKE_ON_GPIO=0 and POWER_OFF_ON_HALT=1 in the bootloader configuration will place the RPi 4 in a low power mode upon halt shutdown or poweroff. In this low power mode the RPi's power consumption is reduced to approximately 40mA (200mW), but the 5V bus remains powered.

This seems to be the minimum power consumption when power is connected to the USB-C connector. As the RPi hardware and firmware are currently configured, achieving a lower power consumption requires "pulling the plug" - i.e. removing the input power.

Turning the fan OFF:

If your fan is connected to one of the 5V pins on the GPIO header, it will continue to draw current through the RPi - even if the RPi is put in "low power mode". But you have 3 options to remove power from your fan in low power mode:

  1. Connect your fan directly to the 3V3 bus (e.g. direct to pin 1 or pin 17 on the GPIO header),

  2. Use the gpio-fan overlay (e.g. dtoverlay=gpio-fan,temp=42000,gpiopin=17) with an external switch (NPN transistor). See /boot/overlays/README for details`.

  3. Use any GPIO output pin (properly configured) with an external switch (NPN transistor) under control of your software.

The common salient point for all three options is that the 3V3 bus is shut down when the RPi 4 goes into low power mode.

Re: Single Button to Toggle RPi ON & OFF

You asked for a "simple" solution, and by that I assume you mean a solution that does not involve any external hardware. I am not aware of any way to accomplish this that doesn't involve additional hardware.

Seamus
  • 23,558
  • 5
  • 42
  • 83
0

I have used gpio-shutdown to implement a shutdown button. See https://raspberrypi.stackexchange.com/a/77918/8697

The ONLY was to reboot if you have POWER_OFF_ON_HALT=1 is to cycle power or pull the GLOBAL_EN pin LOW.

The GLOBAL_EN pin is connected to the MxL7704 power management chip, and pulling this low should be similar to cycling power. See https://raspberrypi.stackexchange.com/a/100234/8697

Milliways
  • 62,573
  • 32
  • 113
  • 225
0

What about powering down the USB/Ethernet-chip when shutting down the Pi? I have not tested it, but found this post https://stackoverflow.com/a/23530711/22552693 where it says it can be powered down at least on Pi3s and earlier. There is some more to read about this here https://core-electronics.com.au/guides/disable-features-raspberry-pi/#USB

It could be done by a script that initiates with a regular shutdown. Something like this https://forums.raspberrypi.com/viewtopic.php?t=331117#p2021981

Alex
  • 1
  • 1