Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect
 
Notifiche
Cancella tutti

Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect  

  RSS
Marks1979
(@marks1979)
New Member
Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

What is the prodical for shutting down the Prusa link (pi)? Do we just shut off I/O switch on the printer when down printing? Or do we need to log in and shut down?

Postato : 15/03/2022 9:45 pm
Tojik
(@tojik)
Utenti Moderator
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

Hi, there is a tiny chance of losing data when using the power switch. There already is a thread for this. Anyway, as anything we can think of right now is too complicated with a negligible impact on the data integrity, we choose not to do anything for the time being. You can send

ssh pi@<ip> sudo shutdown now

If feeling particularly pedantic. But there is also no clear indication for the RPi being done shutting down, so using this isn't very pleasant either.

The whole losing data on power off thing as I understand it now (probably not the full picture) is caused by the SD cards themselves. The ext4 filesystem generally used for RPi images has journaling, so it is able to recover from this, losing only the data in cache, so anything uploaded or changed right before the shutoff, never corrupting the system itself.

That's the reason why there has been the idea of using industrial grade SD cards, as those don't do any risky operations that make it possible to lose any random block of data completely. We decided to go one step milder just saying "Use SD cards from reputable brands. Kingston, Samsung, SanDisk and so on." We have no capacity to check which brands make cards that are prone to this. Any evidence we came across so far was anecdotal.

Sorry I don't have any set and forget solutions right now, but hope this helps somewhat.

Postato : 16/03/2022 7:38 am
Marks1979
(@marks1979)
New Member
Topic starter answered:
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

Apologies for starting a new thread.... Thank you for the quick answer. 

Postato : 16/03/2022 3:51 pm
Fleischman78
(@fleischman78)
New Member
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

But all the Operative Systems running in Raspberry has a switch off button or switch (RaspberryOS, all Linux, Octoprint, Recalbox, Retropie...) And the GUIs has also "shutdown system". 

Why Prusa don't put one in the PrusaLink interface?It will be much more secure not to loss data. 

Also, I think It would be very interesting the possibility to activatate one GPIO to put a physical switch soldering on it, to switch off easy from the printer.

(Sorry about my poor English, I'm Spanish).

Postato : 18/03/2022 6:30 pm
Dema_Design e hanno apprezzato
BenS
 BenS
(@bens)
New Member
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

I've gotten the one-button safe shutdown working on another of my Pi Zero W units - it's just a one-line addition to a config file, in Raspian anyway ( https://gist.github.com/lbussy/9e81cbcc617952f1250e353bd42e7775) and then a normally-open pushbutton connecting pin 3 with ground (so it shouldn't interfere with the Prusa Einsy pins).

I haven't looked yet to see if there's a similar Device Overlay in the OS underlying Prusa Link but the above method shows it's at least possible...?

Postato : 28/04/2022 1:51 pm
Tojik
(@tojik)
Utenti Moderator
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

Yup, we use the raspi os, so this or something similar should work, I just don't see the majority of people using a web based shutdown button. The physical button looks like it could work better

Postato : 28/04/2022 9:00 pm
Dema_Design
(@dema_design)
Utenti
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

sorry for the intrusion 😜 , but I quote what Fleischman78 says.

A shutdown button in the web interface is a must, it is also useful for shutting down when not at home

Postato : 10/05/2022 3:54 pm
Tojik
(@tojik)
Utenti Moderator
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

Yes, it would be nice to be able to shut the MK3 down remotely, but we can't. We can switch its Z motors off and turn the LCD brightness to 0, might be a half-baked stand-by mode at best.

Does the majority of Windows users use safely remove hardware? I believe not. Is it really worth it to log into local Link and push the button before you switch your printer off? Every time? How about a 20 printer farm? You would be switching it off for an hour.

The button in the local web interface is definitely not the right solution to the problem. So I'll either make one that works for everyone, or accept the risk and see if it becomes a real problem to focus on later. Definitely tell us if your SD card becomes corrupt, ideally with the SD card details, so we can tell others which ones to avoid. Thank you for understanding

Postato : 10/05/2022 4:26 pm
hli
 hli
(@hli)
Trusted Member
RE:

What I build for my RPi running Octoprint (which is integrated into the frontpanel):

  • added step-down converter to power the RPi from 24V
  • added a rechargeable battery together with a step-up converter to power the RPi
  • added automated power-switchover from the 24V to the battery supply (when the 24V turns off)
  • send a shutdown signal to the RPi when the 24V power gets turned off
  • a small timer to turn off power from the battery about 30 seconds after the loss of 24V
  • last but not least: a charger for the LiPo battery

That way I can just power off the MK3S, and the RPi will safely shut down. And in addition, it will survive about two or 3 seconds of power loss (thats the time before the shutdowen gets signalled to the RPi).

Postato : 10/05/2022 4:38 pm
PrussianTomasUSA e Tojik hanno apprezzato
Dema_Design
(@dema_design)
Utenti
RE:

Sorry I explained myself wrong, I was only interested in turning off the raspberry from prusalink. If desired, the printer can be switched off via a wifi relay, perhaps with an ip address that can be reached externally from the internet, but this does not interest me. As far as a farm is concerned, a button on prusa connect could be useful that sends a command to all printers to turn off the raspberry (obviously I don't know if it is feasible). While to turn them back on or turn off the printers you just need to have them all connected to a single socket with switch. This would be my idea if I had a farm 😅

Postato : 10/05/2022 4:54 pm
Tojik
(@tojik)
Utenti Moderator
RE:

Yup, further along the thought train, you'd be checkmarking the printers to turn off and managing user permissions, so some people can turn off rpis on some printers. For data integrity of gcodes. You don't store the models themselves on them anyways, and the rest is / will be easy and cheap enough to replace.

And if you're doing a complicated custom setup, you can make the button yourself with the snap of your fingers. in fact, here's one untested now

from flask import Flask, request
import os

app = Flask(__name__)

@app.route("/shutdown")
def shut_down():
    if request["x-api-key"] == os.environ['SHUTDOWN_KEY']:
        os.system("sudo shutdown now")
        return "Shutting down"

I'd much rather do anything else than argue about a button at this point

Postato : 10/05/2022 5:12 pm
gman e Dema_Design hanno apprezzato
Tojik
(@tojik)
Utenti Moderator
RE:

Sorry, it's late. We're nearing another release, so I'm supposed to be making features and stability testing, but I'm arguing on the forum. In the future, this might become a thing to address, but right now, it's about making it usable. We don't want to miss the forest for the trees. Don't want to focus on this one thing and make it perfect while others are waiting just to be able to daily drive the thing

Postato : 10/05/2022 5:26 pm
gman e Dema_Design hanno apprezzato
Dema_Design
(@dema_design)
Utenti
RISPONDI: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

Ok thanks for sharing it, maybe I'll try to implement it myself. 😬 

However, this is certainly not an indispensable thing.

In my small way I hope to contribute to some better ideas that are worth implementing

Thank you so much

Postato : 10/05/2022 7:50 pm
Tojik hanno apprezzato
lucas.l
(@lucas-l)
Utenti
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

i had to reflash 2 pi´s already because of corrupted filesystem after power switch off.... i think this is a serious problem

 

Postato : 09/11/2022 3:18 pm
atilla
 atilla
(@atilla)
Ospite
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

i have an idea!? ... desolder 5V pin from pi zero ... and plug an phone charger ... now the pi is 24h online ... prusa make an on/off switch and we can start via gcode? or an relais the printer ... only an idea.... on octoprint now you can add tasmota and plu your printer to an tasmota relais...

Postato : 09/11/2022 4:28 pm
Tojik
(@tojik)
Utenti Moderator
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

The workaround would be to connect vie USB, that way you don't lose power to the pi. On 0.7.0 RC1 it switches to it automatically (assuming the rpi port is off) Just don't supply power to the pi while it's still in the einsy slot.

Postato : 09/11/2022 7:16 pm
Dema_Design
(@dema_design)
Utenti
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

I have always used the raspberry via usb and I think it would be more convenient to have the shutdown / restart button like on octoprint, klipper etc.

Postato : 09/11/2022 8:11 pm
lucas.l
(@lucas-l)
Utenti
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

thats not a great trade off. For me there is a 100% chance to corrupt the file system with the 0.7.0RC1. in the old version it happens once out of 100 times. but with 0.7.0RC1 i tried cutting power 5 times and had to reflash each time. I also try to let the printer sit for some hours in idle before cutting power.

This is pretty annoying and not usable like this.

Postato : 11/11/2022 8:39 am
Cicicok
(@cicicok)
Active Member
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

Actually the solution is pretty simple, set Raspbian as read-only. Configure your PrusaLink instsce, the log into Raspberry CLI and using raspi-config acrivate read only overlay. Now you can safely pull the plug. The only disadvantage is, that after reboot you will lose any model uploaded to Raspberry as well configuration. But this is only a small sacrifice.

Postato : 04/11/2023 11:43 am
Tojik
(@tojik)
Utenti Moderator
RE: Proper way to shutdown MK3s/Ml3s+ with Prusalink/Connect

Yep, bud setting it up to happen automatically while keeping logging and stuff is a lot harder. In my testing, using an industrial micro SD card, it survived 5000 power losses while running an sd write benchmark.

If you happen to encounter any issues with this, please send me the make and model of the SD used, so we have an idea as to which cards are not ideal for this application. I might be able to test them in a simmilar way afterwards.

Postato : 04/11/2023 2:37 pm
Condividi: