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
3
  • 2
    Does this answer your question? Raspberry Pi 3 model B "dtoverlay=gpio-shutdown"
    – Milliways
    Commented Jun 2, 2021 at 0:06
  • I've added a link in your question that shows what a "fan shim" is. In the future, it would be helpful to make your question as clear as possible when referring to such things. I've got a different take on your question now & will revise my answer if you'll acknowledge you're still interested in an answer. While you're pondering that, you might also edit your question to indicate if power consumption is of any consequence to you.
    – Seamus
    Commented Jun 16, 2021 at 22:21
  • After 2.5 years, I'll assume the OP has lost interest :)
    – Seamus
    Commented Jan 21 at 0:22

3 Answers 3

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.

4
  • Thanks for your answer! Maybe I should have been more clear. I'm using a fan shim, it's being controlled by GPIO 18 which is low in low power mode. 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 was a setting I could use. Now in this case 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 . Commented Jun 2, 2021 at 14:53
  • @PieterHuybrechts: fan shim... No one seems to define that term. I'll guess it's a fan that with an interface that allows you to drive it with a 3V3 GPIO? Why do you think that makes a difference? Your comment seems very much at variance with your question! If all you want to do is boot from low power mode without pulling the plug, you can easily do that with a momentary pushbutton wired between the GLOBAL_EN via and GND. Could you try to clarify this please?
    – Seamus
    Commented Jun 2, 2021 at 19:36
  • I've given my question another thought and there seems to be to much unnecessary information in it. The basic question is: how to boot and safely shutdown a rpi when: - WAKE_ON_GPIO=0 and POWER_OFF_ON_HALT=1 - Preferably using only one button (Maybe there is a hat which knows when to pull down a GPIO pin or GLOBAL_EN). Commented Jun 7, 2021 at 17:37
  • @PieterHuybrechts: For me, your question remains ambiguous. I would tend to agree with your opinion: "there seems to be to much unnecessary information in it". For example, this part of your question: The thing I'm trying to solve is being able to boot the pi when in low power mode without pulling the plug. That's easy: run sudo halt from bash, and connect a pushbutton between GLOBAL_EN and GND. But you seem to want to be able to shut down by pushing this button also. I'll say it again: This requires external hardware. So you need to decide what it is you want.
    – Seamus
    Commented Jun 8, 2021 at 23:08
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

1
  • You reminded me once that it was the low-to-high transition on GLOBAL_EN that caused the RPi to re-start from the "low power" mode (i.e. bootloader config contains POWER_OFF_ON_HALT=1 and WAKE_ON_GPIO=0 followed by halt or shutdown). AFAIK, that's still true. From this "low power mode", pulling GLOBAL_EN low - and keeping it low - reduces power consumption a wee bit more, but will never cause the RPi to restart. Releasing GLOBAL_EN to the control of its internal pullup results in the low-to-high transition that leads to the re-start.
    – Seamus
    Commented Jun 16, 2021 at 22:42
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

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.