M581 Configure External Trigger - Behavour During Duet Reset
-
Hi all,
If I set an M581 external trigger to monitor for a rising edge will it trigger on a Duet reset if the contact endstop input remained closed during the reset? Would it presume an open state to begin with then treat the first scan as a change to closed and so a rising edge? If you had one set to detect a falling edge would that need to see a high first or could that also be triggered during a reset if it was low during the reset?
Back story for those who want to read more!...
I'm using a pair of guided contact relays to cut mains power to the PSU that supplies the heaters and steppers. Separate 5V in for the electronics, and 24VDC for the fans. The coils for the relays are grounded by the PS_ON pin and have flyback diodes wired in parallel to the coils. I've a physical reset button which supplies 24VDC to the safety relays and once latched they supply 24VDC to themselves, meaning you can release the reset button - which is of course helpful! The supply to the coils goes through my big red stop button, meaning if this is pressed the safety relays release.
This system is primarily created to give the user & duet a very reliable method of interlocking the heaters in the event of a fault or indeed unspecified user panic. It is loosely based on the working practices that were set for performance level d interlock circuits when I last worked in that area but certainly not compliant.
There are a couple of things that aren't quite perfect with the system yet.
- The duet is unaware of the e-stop. This is not really a problem as the steppers have been killed with the heaters and fans are still running. Therefore it shouldn't damage anything.
- There is no monitoring of the relays to ensure they have operated as expected. Relays can weld open or shut and typical safety systems would at least check the system is definately in a safe state before allowing it to be re-armed. Sophisticated (/very expensive) safety systems have numerous additional checks which I won't be mimicking!
- Steppers take a while to stop as the PSU discharges. This isn't really a problem as the protection is intended for the heaters. A risk assessment will however likely point out that a user is likely to hit the big red button in panic and expect the motors to stop quick.
I intend to wire in a monitor contact to the duet that is normally closed when the relays are in the 'safe' position and use this to trigger on rising edge a macro containing M80. This then allows the user to arm the machine.
I'll set a second external event to trigger on the falling edge of a normally closed switch going through the e-stop button that will trigger an emergency stop. I believe this will leave the Duet controller waiting on a reset, so I am also considering a second button to trigger a M999 rather than need to poke around for the reset button on the board or reach for the power.
End result should be far easier to use from the end user point of view. Turn system on (duet fires M80 if relays are in safe position - which should be the case during a duet reset) and then presses reset to enable the system. If the end user hits the big red button the duet detects it and stops ASAP as well as the relays cutting power to the heater/stepper PSU. If the duet triggers a stop and fires M81 it will drop the safety relays. With the addition of a couple of indicator lights fault finding shouldn't be too difficult either.
-
From this link:
https://duet3d.dozuki.com/Wiki/Connecting_an_Emergency_Stop
It seems to suggest the duet needs to see a transition before it triggers the responce. That's not the end of the world as I think I can use M582 at the end of the config file to force the check of status and fire the m80 command if the relay is safe.
-
M581 looks for an edge so if the input is in the active state initially, it won't trigger until the state becomes inactive and then active again. M582 is provided so that you can have it trigger immediately. HTH David
-
Thank you!
-
Wired and working great. User has no need to be sending M80, or triggering a macro that does so.
At the bottom of my config file I've added the following:
M581 E2 S0 T2 C0 ; Cause the rising edge of E2 endstop to trigger trigger2.g (Relays safe)
M581 E3 S1 T0 C0 ; Cause the rising edge of E3 endstop to trigger e-stop. (user e-stop.)
M582 T2 ; Check if relays safe and fire trigger2.g if so.and in trigger2.g:
M80 ; Ground PS-ON pin.
M300 ; BEEP!My physical e-stop button comprised of 3 normally closed switches. Two of these cut the power to the safety relay coils and the other is fed to the E3 endstop on the duex5 card. The other input is looped through a normally closed contact on each safety relay. Works fine and with a few LED pilot lights should be easy to check. Both relays would have to fail (weld contacts in the active position) before the e-stop wouldn't stop the machine. These contacts have a fuse protecting against over current.
Edit: I'd tried to save wiring by just wiring one wire to the e-stop inputs and grounding to a common ground in the safetys/power distribution box. Not worth doing! I got enough noise doing this to give false e-stop trips.