To my /boot/config.txt on Raspberry Pi Model B I added:


Right now nothing happens when i shorten GPIO#3 with ground.

What else needs to be done to make this overlay work: software- and/or hardware-wise?

  • 2
    What Raspbian version are you using? On Rasbpian 2017.08.16 and above, the command you linked should work AFAICS (also, the options you specified are the defaults, so just dtoverlay=gpio-shutdown should behave the same. – Matthijs Kooijman Apr 30 '18 at 10:21

The "documentation" for gpio-shutdown is

Name:   gpio-shutdown
Info:   Initiates a shutdown when GPIO pin changes. The given GPIO pin
        is configured as an input key that generates KEY_POWER events.
        This event is handled by systemd-logind by initiating a
        shutdown. Systemd versions older than 225 need an udev rule
        enable listening to the input device:

                ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
                        SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
                        ATTRS{keys}=="116", TAG+="power-switch"

        This overlay only handles shutdown. After shutdown, the system
        can be powered up again by driving GPIO3 low. The default
        configuration uses GPIO3 with a pullup, so if you connect a
        button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
        you get a shutdown and power-up button.
Load:   dtoverlay=gpio-shutdown,<param>=<val>
Params: gpio_pin                GPIO pin to trigger on (default 3)

        active_low              When this is 1 (active low), a falling
                                edge generates a key down event and a
                                rising edge generates a key up event.
                                When this is 0 (active high), this is
                                reversed. The default is 1 (active low).

        gpio_pull               Desired pull-up/down state (off, down, up)
                                Default is "up".

                                Note that the default pin (GPIO3) has an
                                external pullup.

        debounce                Specify the debounce interval in milliseconds
                                (default 100)

I have used gpio-shutdown to implement a shutdown button (although I use GPIO5 - pin 29 as I use the default for I²C).

The "documentation" does not explain what happens in another pin is used - it does state "This overlay only handles shutdown".

Pin 5 USED to perform a restart on older Pi - See Will pulling pin 5 low will make the pi boot up again but this does not seem to work.

Update Pin 5 WILL restart; gpio-poweroff had disabled it.

Name:   gpio-poweroff
Info:   Drives a GPIO high or low on poweroff (including halt). Enabling this
        overlay will prevent the ability to boot by driving GPIO3 low.

Indeed there seems to be little point in modern 40 pin Pi - which have a dedicated Run input which can be used to restart the Pi.

PS If you are using the default ,active_low=1,gpio_pull=up seems unnecessary as there is an external pullup, and active_low is the default.

  • 1
    About the default parameters, the line dtoverlay=gpio-shutdown,gpio_pin=3 is enough? – madneon Jan 18 '18 at 10:34
  • 1
    Strictly you do not need ,gpio_pin=3 which is the default (but a poor choice as it is used for I²C). – Milliways Jan 18 '18 at 10:56
  • 1
    I chose GPIO3 because it also "wakes" the Raspberry Pi 3B, so one pin could work both ways: to turn on and off.. IF it works ;) – madneon Jan 18 '18 at 20:01

Go to this link and search for 'gpio-shutdown', it will give you steps to implement the gpio shutdown: https://www.stderr.nl/Blog/Hardware/RaspberryPi/PowerButton.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.