Need help getting a GPIO LOW after shutdown

Hello and thanks for reading.

I need a bit help to finish my OctoPrint installation.

My setup is an Ender 3v2, a rpi 4b and a cheap 4 module relay. i have installed a bunch of dc converters to get from 24v to 12 for the fans and 5 for the rpi.
All works flawless, Octoprint controls the relays for lighting etc.
One free relay module is used to cut power to the complete system.

i just need to find a solution to keep a GPIO HIGH untill after the shutdown, and even prefer a short delay.

The way the system behaves now is; as soon as i choose Shutdown from the Octoprint menu, the rpi shuts down and opens the relay that powers the PSU(complete system). So far so good. Both devices are powered off. Im not sure if that GPIO is LOW after a complete shutdown, afraid the rpi actually needs more time to complete a safe shutdown after it changed the GPIO state to LOW.

If some of you know about a plugin that solves this, i would be very thankfull.

My skills with the rpi are LOW, i went for the Arduino route some years ago and not sure how and if i can implement some code the same way.


When you perform a shutdown on the pi, it kills all processes first before losing the file systems and the CPU. Whatever process was controlling the GPIO pin gets shut down, the GPIO pin reverts to it's unprogramed state. If you are using a relay to control the pi, it disconnects power while the file systems are still open, with the same probability of corrupting the filesystems as just pulling power.

1 Like

Maybe the Pi's PowerOff Overlay Pin meets your requirements.

Thats what i was afraid of. Gpioโ€™s to its original state during, and not after, the shutdown.

The powerOff overlay was indeed mentioned before in a thread of someone else where i asked a bit the same. I just couldn't and cant understand how to control that option. Do i need to edit code for this method? Or with a plugin?

This is pure pi stuff, take a look to /boot/overlays/README, section gpio-poweroff, on your Pi installation. Overlays have to be enabled in Pi's config.txt like this:
hint: active_low is not an inverted active, it has an strange behavior during reboot. The suggestion from developers was using a transistor to invert active if needed, also the link to dt-blob.bin was not clear.

1 Like

The Pi 4 seem also to disable the USB power after shutdown, at least my Pi4 did it.
Maybe you can reuse this behavoir.

1 Like

Many thanks. im on my way of understanding the procedure to edit the config file. thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.