Panic stop

Hi All,
I am having trouble with calibration and heads crashing, so it is logical that I came up with the following question:

What would it take to make a panic button that will stop whatever is happening and move the head away from the bed (or vise versa)
Ideally I would like a big red physical button next to the printer. I do not like the button on the webpage, not tactile enough for me.
Also, the button simply stops everything, but in the mean time my hot nozzle is still pressed into the bed or print.

The Green Bank Telescope (admittedly a rather bigger robot than we deal with) has two big red emergency stop buttons: one is a "soft stop" that shuts down all motion as fast as possible without risking damage to the telescope, and a "hard stop" that just slams all the brakes on full. The latter is for use if, say, someone is about to be crushed or shoved off a hundred-meter drop. Expect damage to the instrument.

For our printers, we need to decide what "emergency" means. Their motion systems are (mostly?) too wimpy to damage people, and they have no sharp power tool attachments or blindingly bright lasers. So I'd say the biggest emergency is "there's a short causing a fire". A distant second would be no risk to life or limb but some potential damage to the machine (head crash, hot part of the machine sitting on a part not meant to be hot). But the real question is, once the emergency has been recognized, is additional motion safe? If the emergency has occurred because the effector is not where it is supposed to be, is there anywhere safe you can ask it to move?

The safest emergency stop for a printer would be to cut all power. So a circuit breaker on the mains input seems like the easiest, possibly with a big red mushroom to make it easier to hit in a hurry. This will shut down all sources of heat, even if (say) the bed heater MOSFET has failed shorted. I'd be inclined to make a smoke alarm trigger this kind of stop.

Second-safest would shut down only the "high-voltage" circuit, the parts that typically run on 12/24 V (or maybe mains, for the bed heater). This would leave the MCU up to record what happened, and if it has some kind of display (LCD, web interface, panel) it could show errors and allow a restart from software. I believe this is what the "emergency stop" on Marlin/RepRapDiscount LCDs does. It's also what the big red "Emergency Stop" button on the Duet's web interface does. Of course, while shutting the 12/24V circuit down kills the heat input to any potential fires, it means you can't move anything and your hot end fan shuts off too, so you could end up with a jammed hot end or a melted spot in your bed.

While printing, the "Pause" button stops printing and pulls the head away from the print, but leaves the heaters on. You can then cancel. This isn't much of an emergency stop, because if you're hitting it because the head has crashed into something, then who knows where the "get the head away" motion will take you; in my experience, probably crashing into the printer frame and dislodging the magballs. Plus it leaves all the heaters on, so if some weird thermal runaway has happened it'll keep happening. Nevertheless it sounds the closest to what you want. So: can you rig a physical button to, effectively, hit "pause"? Or to run a specified macro? I don't see why not. Easiest to hook it up to an unused endstop pin, and you might not even need to recompile the firmware - I think it supports "triggers" that activate particular bits of g-code.

As for what the macro should do, for my delta I'd go with

"move the effector up a lot" (because that never shoots off into hyperspace), and

shut off power (M81).

For an even gentler stop, you could ask the hot end to cool to (say) 140 C before shutting off the power, but unfortunately it can be awkward to interrupt such a wait-for-temperature if you want to actually do something immediately afterwards.

So the question is: how can you make an endstop trigger a macro?

(Also where do you get an appropriately serious-looking button? I should ask my father if he has any of those awesome old knife switches or Bakelite buttons lying around his radio room.)

Your best bet is an emergency stop button that disconnects power to the printer. The M581 mechanism isn't yet fast enough to be used as a true emergency stop because it waits for macros to complete first. This will be fixed soon, probably in the 1.16 release.

Anne, thanks for the detailed work through of the situation. I agree with David and you that a true emergency stop is cutting all power for nearly all use cases.

Even very large machines that are capable of cutting or crushing people badly cut the power on emergency stop.

An emergency stop button (or fire alarm trigger or whatever) should also be a seperate control system from the DuetWifi and firmware, a big red circuit breaker is good, I just use the off switch on the plug socket for the one in my office though.

We should potentially rename the "emergency stop" that does firmware M999, M112 actions to "hard stop" or similar and then have the M581 style macro stops as some version of pause. That might encourage people to fit an external, seperate, emergency stop. (Or at least have the power switch handy )

I think the most pressing safety issue along these lines is persuading people to use PS_ON. For those of us using ATX supplies it's easy, but they're only 12V and a bit weedy for running a heated bed. For the people using 24V LED supplies, possibly also with SSR-controlled mains heated beds, it's got to be tempting to just leave the high voltage circuit on whenever the printer's on. But then there's no way for the firmware to shut off all heater power in case of thermal runaway - setting PWM to zero doesn't help if the MOSFET is the problem. I believe making PS_ON work here should just be a matter of running a mains electromechanical relay (with protection diodes and things) off the PS_ON pin and powering the 5V circuit from a spare USB charger.

By "the 5V circuit" I mean the Duet MCU, the WiFi, and a number of LEDs: the MCU has to be running and receive G-code to switch PS_ON. And at least mine I leave on all the time, with the 12V circuit and its noisy hot end fan coming online only when printing or calibrating. So batteries or capacitors would be a pain. But surely everyone has a spare USB power supply lying around near their printers? A clean 5V supply would be fine too as long as it's not switched off by the relay.

A less convenient option would be to arrange the relay in such a way that it came on when the printer was switched on, but the MCU could shut it down with a pin. You'd have to physically turn the machine back on with a switch, though.

The simplest method is a just a hard wired power switch on the front of the printer e.g a standard 20A rocker switch its then easily accessible and kills all power to the power supply. Simple is always better as far as safety circuits are concerned if you risk assess any system unless it is going to create a hazardous condition in and off itself then the first option is always to cut all power to any outputs and disconnect all drives but maintain inputs for diagnosis and monitoring. For a home printer its easy safety first switch it off so make the switch accessible.

However, the demand was not for an emergency shutdown, but for something which may save some printer parts and notably the bed. Indeed, if you have a surface like a Buildtak, maintaining hot end pressed on it will make a nice conical hole.
To lift the head, a macro could be run from pin signal, but as underlined by David, we have to wait an issue which gives higher priority to user pin signal.

Nice discussion.
But indeed, the object is to save the print and or the bed, so it would have to be an interrupt that stops the current action even while it is still being executed and the head lifted up. (or the bed dropped)

I now have a few holes and scratches on my bed surface, because the head keeps crashing into it and wants to keep moving. Horrible sounds. Emergency stop will kill the motion, but the hot end is still cooking my bed surface.

Actually in a home situation and considering its a topic about safety i would have thought the print would be of a secondary concern considering the whole principle of a 3d printer is you can print it as many times as you want. I would have thought personal safety the safety of your home and then the protection of the machine would have been the primary concerns.

It's not been extensively tested to determine if it will shut off the power before a fire begins, but it does latch in an off state when smoke is detected and requires manually resetting once the fault has been cleared, I expect it would work best in an enclosure. No false triggers yet after over a year in use, no genuine one either thankfully. It's obviously independent of the controller, and fairly simple.

What I have started using on my new printer is a plug-in rcd (ground fault device) right next to the machine. I can hit the test button as an emergency stop or general off switch, it should protect me against a mains heat bed problem and its double pole so shuts off the power to the device completely.