Powering off a DuetWifi after print completion, not ATX supplied



  • Re: Remote Control Power Switch using Raspberry Pi

    Jackal 21 Jan 2017, 20:13: "I have only implemented remote switch off on my delta with raspberry pi and Omron remote reset switch (https://www.omron.com/ecb/products/pdf/en-a8gs.pdf)"

    After seeing this in the linked thread above, I ordered one of these switches, thinking that I could easily drive it to shut down mains power to the MeanWell SE-600-24 that powers my printer.

    This has hit a snag after realizing that it requires 5V 0.2A to trigger the coil, and that the G-code driven power off only opens a switched dc contact on the ATX control pins.

    My questions are: is there any way to change what output the ATX M80 and M81 trigger, or to invert the switch behavior (M81 i1 for instance?)

    If I could invert the switching behavior, I could run a voltage regulator or just a divider circuit, and either drive it through the ATX power output or a transistor, to trigger the reset coil on the power switch.

    The other option that I was pondering was to use an external transistor to switch it, controlled by one of the unused heater outputs on the expansion header.
    If going that way, is there any relatively simple g-code to trigger it after the thermostatic extruder cooling fan has turned off, like the ATX power seems to already have logic programmed to do?
    I was hunting for any g-code to do this, but was not finding it if it exists.



  • Hi. I currently use the PS_ON to kill the power to a psu that supplies V-IN, but use a seperate PSU for the 5V supply tthe board, so not exactly what you want. Here's what I'd investigate.

    1. Wire three switches into the mains supply o your power supply. First (closest the mains) will be the main switch. This will probably be in the fused IEC socket (kettle lead socket) along side a fuse. After this wire a manual switch and relay in parrallel so that if either are in the on position or enabled there is mains going from them to the power supply. The manual switch is an override that allows the system to be powered up, or if required stay on after a print. The relay allows mains through after the M80 signal.

    2. Make yourself an initialisation macro that includes a home all and M80, or at least an M80. The manual switch wil need to be in the on position until after this routine finishes.

    3. Pick a spare fan input (think you could call a fan assigned to the Duex5 even if there is no Duex5) and and set it up as a thermostat fan that shuts off once the temps are bellow 60C. You shouldn't need to connect a fan.

    4. In your end of build gcode turn all heaters off then use the gcode that blocks until the thermostat fans are off.

    That should work with no mods to the firmware required and allow you to override the behaviour when needed. I'll find the required gcode when I get to work.

    Edit: I've put a fly back (or is it flywheel?) diode across the coil for the relay to protect the duet from inductive spikes when the relay is de-energised. The PS-ON grounds after M80 so you will need to supply the other side of the relay with 5VDC that you can pull from the board. I recall checking the wiring specs for the input and realising it couldn't take 24VDC but can't remember what the limit is.



  • Here is the gcode reference:

    https://duet3d.dozuki.com/Wiki/Gcode

    It is the M81 command that can have an extra parameter to delay until all thermostatic fans have turned off.

    Looks like M106 is the command you will need to look into to set up the thermostatic fan.



  • Where possible try to make sure the switches and relays are double pole and break both the live and the neutral legs of the power supply. You should avoid working on the machine when it is physically connected to the mains but there are circumstances where it can be safer to still have the machine connected to the mains earth but isolated from the live and neutral.

    A common gotcha presents itself if you touch the neutral to the earth of a system on an RCD protected circuit. This is often enough to drop the RCD breaker which when in a house may take out a socket ring main until you can get to the breaker board. If your switching breaks the neutral too this is less likely to occur. In addition residential properties don't have their electrics checked on a routine basis. It's not beyond the realms of possibility that a dodgy bit of DIY has resulted in the live and neutral being swapped over. Some devices will run just fine like this and not give you an indication there is a potentially dangerous wiring fault present.

    If at all in doubt get a sparky to wire the mains side, run a PAT test on your equipment, or just check over your work. Should be a real easy job for them.



  • The issue that I am running into with this switch is that if I use the ATX PS-Off g-code:M81, it breaks the connection between the pins on the ATX power control connector. The thermostatic setting isn't an issue, other than the only g-code for power that recognizes it being M81.

    I will have to test whether M81 is a blocking command, and if it will cause a Wait condition until it is completed.
    If so, it would be able to indirectly allow another command to trigger once the hot end fan has cooled down, if the M81 was followed with a command to turn on a "fan" that triggered the remote disconnect power switch in a shutdown macro.

    Barring something like this being functional, it looks like the energized relay method that DocTrucker suggested may be the only option, though a bit more of a work around to get to that point than it seems like should be required.

    Regarding the wiring of the switch on the mains power, it is a dual pole, single throw switch, so it is already switching line and neutral. The printer is also protected by a whole house RCD circuit breaker, which I have not had any issues with leakage current false triggering, or switched lines.



  • Maybe its a little bit "complicated" but what about using an arduino micro with wireless sender and a wireless socket?

    Programming the arduino and let it sense the PS-On signal should be simple. Just an idea.


  • administrators

    @hey_allen said in Powering off a DuetWifi after print completion, not ATX supplied:

    This has hit a snag after realizing that it requires 5V 0.2A to trigger the coil, and that the G-code driven power off only opens a switched dc contact on the ATX control pins.

    One option is to use the PS_ON output to operate a SPDT relay. When on, the relay charges a capacitor up to 5V through a resistor. When the relay is turned off, it discharges the capacitor into the coil that you mentioned.



  • That makes a lot of sense, and it's simple to boot.

    I have a couple of 27,000mfd 15vdc caps around that my work used to use as brown-out prevention on the 5vdc supply rail of some small dot-matrix receipt printers.
    I suspect that one of those would be more than enough to trigger the coil.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.