Notifications
Clear all

Shut down PrusaLink with physical button  

  RSS
sreinert86
(@sreinert86)
Active Member
Shut down PrusaLink with physical button

Hey Everybody,

since a few days I'm a happy owner of a MK3S+ and playing around with my Raspberry Pi 3B+ I had laying around. First with Octoprint, after that with PrusaLink. And for me, PrusaLink is the way to go 🙂

The lack of a fine way to properly shutdown the Pi bothered me a bit, because I'm not a fan of just hard-cutting the power off.
Today at my first start I needed to re-initialize the printer and I have the feeling this is the reason of the improper shutdown.

So I started to investigate, how to add a physical "shut down" button to the setup. My way to success:

- Connect to the Pi via SSH and do

sudo apt-get update
sudo apt-get upgrade

after that, I added to the config file:

/boot/firmware/config.txt

the following line at the bottom:

dtoverlay=gpio-shutdown,gpio_pin=5,active_low=1,gpio_pull=up

Save and reboot.

after that, as soon the pins GPIO5 and Ground (6th pins of GPIO counted from the USB-Ports side, Pin 23 and Pin 30) are connected, the system will shut down and can be disconnected from Power safely.
My procedure is that I finish my prints, I shutdown the PrusaLink and wait until the hotend cooled down a bit and then I turn of the power for the printer and the Pi.

Next step will be that I get myself a nice little button and integrate that into a RasPi case.

I hope I can help somebody having the same thoughts 🙂

Best regards,

Simon

Posted : 26/07/2024 7:31 pm
sreinert86
(@sreinert86)
Active Member
Topic starter answered:
RE: Shut down PrusaLink with physical button

Hi again 🙂

Finalized today my Raspberry-Button-Build and I'm super happy how flawless this works!

Posted : 27/07/2024 10:55 am
_KaszpiR_
(@_kaszpir_)
Honorable Member
RE: Shut down PrusaLink with physical button

Thanks for the write-up.

I've been using this https://github.com/nvtkaszpir/rpi-power-button with my pi 3, pi4, pi zero w, pi zero w 2 for few years (frankly speaking before gpio-shutdown was in dtoverlay but the current github repo is completely different to the original code, but the functionality is as it always was). Also very easy to hack to execute other commands after some changes.
It's old but works, the only reason I recommend it is that I had too many times a moment of accidental button touch which immediately initiated the shutdown.
With my script it takes 2 seconds of deliberate button press to initiate shutdown.

With the dtoverlay it can be acheived by setting 'debounce' to 2000ms, instead of default 100ms.

 

Hope it helps someone.

See my GitHub and printables.com for some 3d stuff that you may like.

Posted : 27/07/2024 8:23 pm
sreinert86
(@sreinert86)
Active Member
Topic starter answered:
RE: Shut down PrusaLink with physical button

Hey,

oh! Thank you very much - I wasn't aware of the debounce command in dtoverlay - this comes in super handy!

Just for the record, I adjusted now my line in config.txt to:

dtoverlay=gpio-shutdown,gpio_pin=5,active_low=1,gpio_pull=up,debounce=2000

And I reinstalled PrusaLink completely because it did not record any telemetry data anymore since the initial crash which caused this whole button project from the beginning. I do not know if its the crash or the sudo apt-get update & upgrade I did - so I left it "out of the box" and just added this line to the config.

Works like a charm again! 🙂

Posted : 29/07/2024 6:43 am
Share: