Kill your 3D printer when it gets lazy !
Given the heat a 3D printer can generate, even when idle, I would better kill it than let it powered unattended, both for the planet, and to reduce the slightest risk of fire. ;)
I stick here to the simplest and most straightforward modification, partly because it is already supported by the Marlin printer firmware.
By the way, the total cost is less than $10, and you will just need a few solder points!
- a solid state relay (SSR). Mine is an oversized Fotek one, that I purchased on ebay for about $8, shipping included. Now, the smaller SSR-25 DA ($3.80 S&H included) should be quite OK. These are electrically operated switches, that work just like regular relays, by letting big AC current through a pair of contacts when a small DC current is applied to another pair of contacts. You could use or make a cheaper opto-triac also (because we are dealing with AC current).
- a momentary push button, (about $3 on ebay max). The connection is made when the button is pushed, and opened when released or idle (which is the standard behavior if not specified). I recommend one suited to your mains (220/110V AC), but since the button is used for a short period when the printer draws almost no power (no heating), I used a less robust 3A 125V that I had in stock (see the pictures), and screwed it directly in the plywood as it was robust enough.
- some short wire suited to the mains, solder and two pin if you want it clean or removable. Heat shrinking tubing is almost free and always good to have also, as it protects you from electric shocks, the electronics from shortcuts, and soldered connections from abusive bending.
Really, that's all for the bill of materials!
How it works
How to die?
M104 S0 ;extruder heater off
M140 S0 ;heated bed heater off (if you have it)
G28 X0 Y0 ;move X/Y to min endstops
M84 ;steppers off
G90 ;absolute positioning
M81 ;added here: commit suicide (shut pin A0 down)
As soon as the firmware is booted, Marlin sets the A0 pin to high (5V). And whenever it decodes such a M81 g-code command, it sets the pin to ground (zero volt).
So technically, it is as simple as using the state of A0 to command the relay: when A0 is powered (aka "high"), the relay is closed and the printer is powered. When it is low, the relay is opened and everything is switched off at the root. Once again, we can directly plug A0 into the relay command because we are using a solid state relay, and NOT a hungry coil-based relay which does require more power, hence a few more electronic components.
But then... how to live before dying?
This is where we add a push button in parallel to the relay, to temporarily restore the wire we just cut. Holding it for one or two seconds is sufficient to bypass the A0-relay functionality, until the software is up and running and deals with its own life.
Additionally, connect a the same two AC relay connectors to a cable that ends on your push button. Hence the mains current flows whatever the relay state when you push on the button.
The top picture will show it installed to the power supply, located below the printer since my hotbed addition.
One warning: make sure you will not electrocute yourself with the push-button connectors, since they are connected to the mains! Either choose an appropriate button with a safety cap, or add heat shrinking tubing and/or hot glue if you do not have protected connectors. Also do not let it loose, screw it in place on the plywood.
Now, the SSR has two oriented DC connectors. Connect the "minus" (ground) one to a ground pin of your Arduino board. The "plus" connector goes directly to pin A0 of your board.
This is a 1.5.4 board. Just connect any of the two GND pins to the "minus" SSR connector,
and the "0" (which really is the A0 Arduino pin) to the "plus" connector of the SSR
In my opinion though, better do not solder cables directly to the board. You can add a 13-piece 2.54mm Right Angle Row Pin Header to the board. Then, use crimp terminal connectors for example, protected with small pieces of heat shrink tubes around it once the cable is clipped. This way, your cables are removable and your setup more versatile.
A row pin header and one crimp terminal connector (both extremely cheap en ebay)
On my side, sadly, my board came with a vertical (straight) pin header already soldered. It does not help really because the fan shroud will then leave no room to connect anything to it. I had to bend my connector quite hard, which is bad.
ConlusionThat's it, now just tell your printer to kill itself when it gets bored because it is idle.
If you own an Ulticontroller, you can create a one-line gcode file on your SD card and run it to shut your printer off without the need for any more hardware. Just write "M81" to a text file named "off.gcode" on your SD card.
Final note: when the board goes through a reset, the relays temporarily switches off. What probably happens is that the rebooting board still has time to raise the command before power drains completely. If it ever causes a problem, either I would hold the push button during a reset, or I would add a diode plus a small polarized capacitor on the SSR command pin to hold the signal longer and filter out this temporary condition.