Getting external triggers to work
I've built a filament sensor. It's simply an encased microswitch. I connected it to the E0 endstop – the signal is VCC when filament is present, and pulled down to GND otherwise, and the E0 endstop LED on the Duet changes when I insert and remove filament – so far so good.
For testing purposes, I configure it like this (in config.g): [c]M581 T2 E0 S1 C0[/c]
And my sys/trigger2.g looks like this:
M106 S250 M117 Yay!
The fan starts and the message is shown when I insert filament, but it only works once until I restart the Duet. Executing the M581 again doesn't help. M582 (Check external trigger) does trigger it again, but it does so regardless of the endstop state. Hmm?
You will need to remove and re-insert filament to trigger it again so as to get another low to high transition. Did you try that? If so then it sounds like a firmware bug.
Yes, that's what I do, and nothing happens. The LED changes state properly, but the trigger doesn't work more than once. Until a reboot, and then it works once more.
Turns out it was my fault after all. I didn't realize that the endstop input had a pull-up already. After removing my pull-down resistor and swapping signal levels (switch now closes to GND when filament present), everything seems to work fine! Thank you and sorry about the fuss!
I'm glad its working now, Yes the endstop inputs have quite strong pullups because of the LEDs (although not as strong as they were on the Duet 0.8.5), and the LED indication isn't always reliable if the device driving them can't pull the input close enough to 0V.
I'm struggling to get this to work. I've fitted micro switches to all the maxima of all the axes and wired them in series (all normally closed). So I have continuity until any of the switches is closed, then it goes open circuit. The idea is that if I do something stupid like tell an axis to move beyond it's maximum before it has been homed, then it'll stop when it hits the switch before doing too much damage. This is connected to E0 and I have a separate emergency stop button that I'd like to use in a similar fashion connected to E1. I'll likely use custom trigger.g files but for now I'm using T0. So in my config.g I have M581 E0 S1 T0 C0 and M581 E1 S1 T0 C0.
If I then fire up the printer and do something like move Z 100mm (which take a good few seconds) then while it's doing that press any of the switches, nothing happens. If I press the emergency stop button the web interface, it'll stop just like it should. I've wired the switches between estop and gnd (the outer terminals) thinking that it'll normally see 0v but when a switch opens, the pull ups will bring the voltage up. Should I wire them between estop and 3.3v? I've tried bot S1 and S0 too.
Thanks in advance
Reason for edit - wrote parallel, meant series.
Sounds like it should work. Does the indicator LED on the PCB change when you trigger one of the microswitches?
I wasn't aware that there was an indicator LED (it's not marked on the wiring schematic) but now that I've looked, I see that there are 2 LEDs between the E1 motor and the E0 motor. The top one (the one nearest the E1 motor) is normally lit but goes out when I press any of the switches and comes back on when the switch is released. I'm guessing that means my wiring is OK.
Having just done that, I noticed that the web interface said "halted" rather than "idle". So, I've reset the Duet and without doing anything else, pressed one of the switches and it immediately goes from "idle" to "halted". So it is seeing the trigger. However, if I do a large bed move like Z100, I noticed that the "idle" message is replaced with "busy". It seems that in that situation, the e stops are ignored. Which kind of defeats what I'm trying to do.
I guess this one for DC42 to add to his ever growing list?
Just a quick update on this for anyone who comes across this thread. It seems that T0 isn't triggered during a macro. What makes it freaky is that pressing a move button on DWC doesn't just send a simple G1 move command so it is treated like a macro as far as the trigger handling code is concerned. The triggers work fine if I use use say G1 Z100 F240 in the top left corner of DWC and hit send but if I press the "Z+100" button on DWC.they are ignored. DC42 has it in mind to change the handling of T0 triggers in his next firmware release (but please don't nag him - he's a very busy man).