Baby Stepping Hardware Button
-
Is it possible to add physical buttons to control baby stepping? Sometimes the skirt prints quite fast and the printer is not near the computer so I'm not able to press the button and see the result in time. I would like to add 2 buttons, one for up and one for down, to control the baby stepping at the printer rather than DWC.
-
If you have spare end stop inputs you could use M581 to configure triggers which increments babystepping up or down. Just wire the buttons to the end stop inputs.
Could use E0 and E1 stops if you aren't using them for anything else.
-
How would they be configured to call baby stepping? I assume baby skipping skips the queue and implements on the next move so simply calling a macro would place it in a queue instead which would cause quite a delay?
-
Calling a macro through a trigger will inject it immediately without waiting for the queue.
Basically have button wired to endstop 0 (up) and another wired to endstop 1 (down)
Configure triggers in sys/config.g like so.
M581 E0 T2 C0 S[whatever depending on your switch] ; this will connect the E0 endstop to the trigger2.g macro
M581 E1 T3 C0 S[whatever] ; this will connect E1 endstop to trigger3.g macro.The S value is when to trigger (rising edge, falling edge, etc.)
then in the file sys/trigger2.g: M290 R1 S0.05 ; babystep up 0.05mm
then in file sys/trigger3.g: M290 R1 S-0.05 ; babystep down 0.05mmWhen you press the relevantbutton it will execute the macro immediately (before queued commands). so it should act similar to the babystep buttons from the screen/web interface.
Should work but may be missing details, might have to setup the end stop switches first, etc.
-
Thank you very much!
-
This is perfect, as I'd like to do something similar. I'm also looking at adding some other functionality with an Arduino Mega (Since I have 6 of these that I'm no longer ever planning to connect to a 3D printer, now that I have better options)
So far, I've been watching that first layer skirt with my phone in hand connected to the DWC, though sometimes I miss the button (Or worse, hit the wrong one) on the phone screen when trying to adjust.
-
I can't imagine not having a PanelDue on the printer for this type of thing. This makes me realise how much I take it for granted now. Very clever way to add physical buttons though using microswitches and triggering macros.
-
Just to clarify the wiring and setup, this will depend on whether you are using a NO or NC switch. David recommends the NC switch.
For a NO switch (connects the circuit when the button is pressed). use the following command in config.g
M574 E0 S0 ; sets the E0 endstop to active low for NO switch
M574 E1 S0 ; same for E1
For a NC switch (always connected until pressed), use the following:
M574 E0 S1 ; sets the E0 endstop to active high for NC switch
M574 E1 S1 ; same for E1Then wire up the system like so: Sense pin for endstop (STP) --> Endstop switch contacts --> endstop GND. Wiring will be the same regardless of the switch type.
Then in the trigger setup we have to specify whether we want to trigger on a rising or falling edge. For NO switch we want falling edge, as the voltage at the sense pin will go from 3.3V -> 0V as the button is pressed. For NC it is reversed.
Two of these will also go in config.g:
M581 E0 T2 S0 ; configure trigger 2 to use E0 endstop on falling edge for NO switch
M581 E1 T3 S0 ; configure trigger 3 for E1 endstop falling edge for NO switch
or
M581 E0 T2 S1 ; configure trigger 2 for E0 endstop on rising edge for NC switch
M582 E1 T3 S1; configure trigger 3 for E1 endstop rising edge for NC switchtrigger2.g and trigger3.g macros will remain the same regardless of the switch type.
A final note from a usability standpoint is that with this setup, the babystepping buttons will be active regardless of whether a print is running or not. This may not be desirable, so if you want to change them to only work while printing, try the following codes in your start and end scripts for the prints:
Start:
M581 T2 S[0 or 1]; enables trigger 2
M581 T3 S[0 or 1]; enables trigger 3
End:
M581 T2 S-1 ; disables trigger 2
M581 T3 S-1 ; disables trigger 3An easier option is to set these triggers to only activate during a print by putting a C1 parameter in the M581 setup like so: M581 T2 C1 blah blah blah but this will only work if printing from SD card.
-
Normally closed switches are better for actual endstops from a safety perspective, but for this, I don't see it mattering as much since either way, if it's disconnected, it won't work. I have a bunch of NO buttons, so I'll just use those.
Actually, if you use the start/end code, and it's a normally closed switch, would it activate if one is connected and the other is not? (For the not connected one) which could throw stuff off, and be really annoying.
I'm kind of okay with this working whether there is a print running or not.
Edit: Second question, can I change the baby stepping increment? Sometimes 0.05mm is a little more than I want to change it by, and 0.025 would be better.
-
@supraguy Yes, if you are babystepping "manually" using this sort of macro (or a user defined one on the web interface) you can just type in the value for the M290 command for incremental steps. I think the latest PanelDue firmware actually adjusts in 0.02mm increments now which is pretty nice.
For the question about activation, if you are using two different endstops it would not cause any issue if one switch NO and the other is NC. You can set up each independently of the other.
Please keep in mind that this entire way of doing things is kind of "hackish" but should work fine.
-
Hi,
I like this idea. One question, can i use only one ground for both Buttons? I have a lot 3 wire cables and connectors. Would it make easier for me
Thanks!
-
@torro said in Baby Stepping Hardware Button:
Hi,
I like this idea. One question, can i use only one ground for both Buttons? I have a lot 3 wire cables and connectors. Would it make easier for me
Thanks!
Yes, buttons connected to different endstop inputs can use a common ground wire.
-
Thanks again!
-
Has someone noticed problems with "button bouncing" ?
increasing is fine, when i push "decrease", baby stepping decreases 2 or 3 times the programmed value.there are some possibilities with small circuits and arduino seems to have a library for this problem.
is there a solution in the firmware?
-
I was a little concerned with debounce, but that hasn't been a problem for me -- at least I haven't NOTICED a problem, which amounts to the same thing.
IIRC, this is looking for falling edge, so a small capacitor across the button wiring would work to debounce your button, at a cost of slightly slower response. Fast response is more important for mechanical/electronic things, but can be tolerated for most manual operation like this.
Depending on what you're using, it might be better to just get better buttons/switches.
-
I tried 3 different types of Buttons...
i'll try a capacitor. How small do you think should it be? -
There is already a hardware debounce circuit on the 5 endstop inputs on the Duet, but not on the ones on the expansion connector or CONN_LCD. Which inputs at you using?
-
E0 and E1.
I think the Buttons are sh*t, when there is a debouncing included...
-
I found the problem. The Buttons i tried, are big ones for 230V AC and 10-16 Amps.
Today, i found some for 12V and 0.05amps. They work like a charm. I only had to solder a small circuit Board to mount them.