Dual Motor Auto Square and Leveling
-
Hi have a DND With 2 Y motors and 2 Z motors on a Duet3 6hc board. I want to be able to make adjustments when homeing to level the Z and Square the Y within the homey.g, homez.g, and home all files.
My under rstanding is that to do this you need to create an axis for each motor.
"M584 X0.0 Y0.1:0.3 Z0.2:0.4 U0.3 V0.4 P3 ; U=Y2 V=Z2 set axis mapping"
I'm not positive that this is needed or if it is that I did it correctly. I have read that you can add M584 Y0.1 P5 to the homeing and this would split the Y axis to make the neccesary adjustments.
Looking for a little guidance on this one and what would need to change in my homez.g, homey.g and hamoeall.g files.
; Smart Drivers M569 P0.0 S0 D2 ; driver 0.0 goes backwards (X axis) M569 P0.1 S0 D2 ; driver 0.1 goes backwards (Y axis) M569 P0.2 S1 D2 ; driver 0.2 goes forwards (Z axis) M569 P0.3 S1 D2 ; driver 0.3 goes forwards (U axis) M569 P0.4 S1 D2 ; driver 0.4 goes forwards (V axis) ; Motor Idle Current Reduction M906 I30 ; set motor current idle factor M84 S30 ; set motor current idle timeout ; Axis M669 K0 ; set Cartesian kinematics M584 X0.0 Y0.1:0.3 Z0.2:0.4 U0.3 V0.4 P3 ; U=Y2 V=Z2 set axis mapping M350 X16 Y16 Z16 U16 V16 I1 ; configure microstepping with interpolation M906 X1000 Y1000 Z1000 U1000 V1000 ; set axis driver currents M92 X100 Y100 Z400 U100 V400 ; configure steps per mm M566 X60 Y60 Z60 U60 V60 ; set maximum instantaneous speed changes (mm/min) M203 X12000 Y12000 Z3000 U12000 V3000 ; set maximum speeds (mm/min) M201 X600 Y600 Z60 U600 V60 ; set accelerations (mm/s^2) ; Axis Limits M208 X0 Y0 Z-100 U0 V-100 S1 ; set axis minimum M208 X1248 Y2470 Z140 U2470 V140 S0 ; set axis maximum ; Kinematics ;M669 K0 ; configure Cartesian kinematics ; Endstops M574 X1 S1 P"io1.in" ; configure active-high endstop for low end on X via pin io2.in M574 Y1 S1 P"io2.in" ; configure active-high endstop for low end on Y via pin io2.in M574 Z2 S1 P"io4.in" ; configure active-high endstop for high end on Z via pin io4.in M574 U1 S1 P"io3.in" ; configure active-high endstop for low end on U (Y2) via pin io3.in M574 V2 S1 P"io5.in" ; configure active-high endstop for high end on V (Z2)via pin io5.in
homeall.g
; homeall.g ; called to home all axes ; ; generated by RepRapFirmware Configuration Tool v3.5.4 on Mon Sep 09 2024 22:47:08 GMT-0600 (Mountain Daylight Time) ; increase Z G91 ; relative positioning G1 H2 Z5 F7200 ; move Z relative to current position to avoid dragging nozzle over the bed G90 ; absolute positioning ; home XY var xTravel = move.axes[0].max - move.axes[0].min + 5 ; calculate how far X can travel plus 5mm var yTravel = move.axes[1].max - move.axes[1].min + 5 ; calculate how far Y can travel plus 5mm G91 ; relative positioning G1 H1 X{-var.xTravel} Y{-var.yTravel} F6000 ; coarse home in the -X and -Y directions G1 H2 X5 Y5 F7200 ; move back 5mm G1 H1 X{-var.xTravel} Y{-var.yTravel} F300 ; fine home in the -X and -Y directions G90 ; absolute positioning ; home Z var zTravel = move.axes[2].max - move.axes[2].min + 5 ; calculate how far Z can travel plus 5mm G91 ; relative positioning G1 H1 Z{var.zTravel} F600 ; coarse home in the -Z direction G1 H2 Z5 F6000 ; move back 5mm G1 H1 Z-10 F300 ; fine home in the -Z direction G90 ; absolute positioning G1 H0 Z130 ;move z down 10mm
homey.g
; homey.g ; called to home the Y axis ; ; generated by RepRapFirmware Configuration Tool v3.5.4 on Mon Sep 09 2024 22:47:08 GMT-0600 (Mountain Daylight Time) ; increase Z G91 ; relative positioning G1 H2 Z5 ; move Z relative to current position to avoid dragging nozzle over the bed G90 ; absolute positioning ; home Y G91 ; relative positioning var maxTravel = move.axes[1].max - move.axes[1].min + 5 ; calculate how far Y can travel plus 5mm G1 H1 Y{-var.maxTravel} F6000 ; coarse home in the -Y direction G1 Y5 F7200 ; move back 5mm G1 H1 Y{-var.maxTravel} F300 ; fine home in the -Y direction G90 ; absolute positioning ; decrease Z again G91 ; relative positioning G1 H2 Z-5 F7200 ; move Z relative to current position G90 ; absolute positioning
homez,g
; home Z G91 ; relative positioning var maxTravel = move.axes[2].max - move.axes[2].min + 5 ; calculate how far Z can travel plus 5mm G1 H1 Z{var.maxTravel} F1000 ; coarse home in the +Z direction G1 Z-5 F6000 ; move back 5mm G1 H1 Z{var.maxTravel} F300 ; fine home in the +Z direction G90 ; absolute positioning G1 H0 Z130 ; move z down 10mm
Thanks
-
@Alijambo73 Currently there isn't a way to define a different endstop position for each driver in an axis, though there is a feature request to do this: https://github.com/Duet3D/RepRapFirmware/issues/627
This means you have to do it the 'old fashioned' way, by splitting the axes. See the 'In RepRapFirmware 2.x' tab here: https://docs.duet3d.com/en/User_manual/Connecting_hardware/Z_probe_auto_levelling#axis-levelling-using-endstops
In that example, in the last step "Step 4: Edit your homez.g" you can add a move to square your axes. Note this refers to the Z axis, but can be any axis. eg:
... ; Move Z and U down until the switches triggers G1 H1 Z-205 U-205 F1000 ; Add move to square axis, can be Z or U G1 H2 U-1 ; back to combined axes and hidden U M584 Z2:3 P3 ...
Ian
-
@droftarts Thanks for the reply. I treid this but I'm having endtop issues.
If I have the drivers set like this:
; Smart Drivers
M569 P0.0 S0 D2 ; driver 0.0 goes backwards (X axis)
M569 P0.1 S0 D2 ; driver 0.1 goes backwards (Y axis)
M569 P0.2 S1 D2 ; driver 0.2 goes forwards (Z axis)
M569 P0.3 S1 D2 ; driver 0.3 goes forwards (U or Y2 axis)
M569 P0.4 S1 D2 ; driver 0.4 goes forwards (V axis)and Axis like this:
M584 X0.0 Y0.1:0.3 Z0.2:0.4 U0.3 V0.4 P3 ; U=Y2 V=Z2 set axis mappingIf I have my enstops configured like this:
; Endstops
M574 X1 S1 P"io1.in" ; configure active-high endstop for low end on X via pin io2.in
M574 Y1 S1 P"io2.in" ; configure active-high endstop for low end on Y via pin io2.in
M574 Z2 S1 P"io4.in" ; configure active-high endstop for high end on Z via pin io4.in
M574 U1 S1 P"io3.in" ; configure active-high endstop for low end on U (Y2) via pin io3.in
M574 V2 S1 P"io5.in" ; configure active-high endstop for high end on V (Z2)via pin io5.in
Then the U and V don't work. I can see them triggering correctly in the endsop monitor for U and V axis but when they are triggered during homeing they don't stop the motor when triggered.So I tried this:
; Endstops
M574 X1 S1 P"io1.in" ; configure X axis endstop via pin io1.in
M574 Y1 S1 P"io2.in+io3.in" ; configure active-high endstop for low end on Y via pin io2.in + io3.in
M574 Z2 S1 P"io4.in+io5.in" ; configure active-high endstop for high end on Z via pin io4.in + io5.in"
But then they work they are combined on the same axis but I get "Error: Failed to enable endstops"code; homey.g ; called to home the Y axis ; ; generated by RepRapFirmware Configuration Tool v3.5.4 on Mon Sep 09 2024 22:47:08 GMT-0600 (Mountain Daylight Time) ; increase Z G91 ; relative positioning G1 H2 Z5 ; move Z relative to current position to avoid dragging nozzle over the bed G90 ; absolute positioning ; home Y G91 ; relative positioning var maxTravel = move.axes[1].max - move.axes[1].min + 5 ; calculate how far Y can travel plus 5mm G1 H1 Y{-var.maxTravel} F6000 ; coarse home in the -Y direction G1 Y5 F7200 ; move back 5mm G1 H1 Y{-var.maxTravel} F300 ; fine home in the -Y direction G90 ; absolute positioning ; decrease Z again G91 ; relative positioning G1 H2 Z-5 F7200 ; move Z relative to current position G90 ; absolute positioning M584 Z0.1 U0.3 P5 ; split Z motor control to Z and V and show U (param P5) in the UI G1 H1 Z-205 U-205 F1000 ; Move Z and V down until the switches triggers G1 H2 U3.175 ; Add move to square axis, can be Z or U M584 Z0.2:0.4 P3 ; back to combined axes and hidden U_text
; home Z G91 ; relative positioning var maxTravel = move.axes[2].max - move.axes[2].min + 5 ; calculate how far Z can travel plus 5mm G1 H1 Z{var.maxTravel} F1000 ; coarse home in the +Z direction G1 Z-5 F6000 ; move back 5mm G1 H1 Z{var.maxTravel} F300 ; fine home in the +Z direction G90 ; absolute positioning G1 H0 Z130 ; move z down 10mm M584 Z0.2 V0.4 P5 ; split Z motor control to Z and V and show V (param P5) in the UI G1 H1 Z205 V205 F1000 ; Move Z and V down until the switches triggers G1 H2 V-1.014 ; Add move to square axis, can be Z or V M584 Z0.2:0.4 P3 ; back to combined axes and hidden V
How should the end stops be configured and are the homez.g and homey.g seup correctly?
Thanks -
@Alijambo73 Note: your homey.g is wrong. When you split the axis, you have put Z in. You want Y and U, not Z and U. I'm basing the example below on homez.g.
Your endstops can be configured where and when they are needed; they don't have to be defined only in config.g and then not defined again. Also, you don't need to re-home the Z and U axes after you have homed them as a combined Z, you just need to give U it's position with G92, then apply the adjustment. So there's a few ways to do this.
Probably easiest is to keep the config.g as:
; Endstops M574 X1 S1 P"io1.in" ; configure X axis endstop via pin io1.in M574 Y1 S1 P"io2.in+io3.in" ; configure active-high endstop for low end on Y via pin io2.in + io3.in M574 Z2 S1 P"io4.in+io5.in" ; configure active-high endstop for high end on Z via pin io4.in + io5.in"
Then home Z normally. After that, change the last section of homez.g to:
M584 Z0.2 V0.4 P5 ; split Z motor control to Z and V and show V (param P5) in the UI G92 V130 ; Set V axis to the same as the Z axis G1 H2 V-1.014 ; Add move to square axis, can be Z or V G92 V130 ; Probably easiest to set V back to the same value as the Z axis M584 Z0.2:0.4 P3 ; back to combined axes and hidden V
For Y, make sure you use the correct axis labels! so something like:
M584 Y0.1 U0.3 P5 ; split Y motor control to Y and U and show U (param P5) in the UI G92 U0 ; Set U axis to the same as the Y axis G1 H2 U3.175 ; Add move to square axis, can be Y or U G92 U0 ; Probably easiest to set U back to the same value as the Y axis M584 Z0.2:0.4 P3 ; back to combined axes and hidden U
I haven't tested this, so use with caution!
Ian
-
@droftarts Thanks. I actually just got it working in a similar way. I probably have a few extra steps but here is what I have as of now.
home Z G91 ; relative positioning var maxTravel = move.axes[2].max - move.axes[2].min + 5 ; calculate how far Z can travel plus 5mm G1 H1 Z{var.maxTravel} F1000 ; coarse home in the +Z direction G1 Z-5 F6000 ; move back 5mm G1 H1 Z{var.maxTravel} F300 ; fine home in the +Z direction ;G90 ; absolute positioning ;G1 H0 Z130 ; move z down 10mm M584 Z0.2 V0.4 P5 ; split Z motor control to Z and V and show V (param P5) in the UI G1 H1 Z140 V140 F500 ; Move Z and V down until the switches triggers G92 V0 G1 H0 V-2.184 F1 ; Add move to square axis, can be Z or V G92 V140 M584 Z0.2:0.4 P3 ; back to combined axes and hidden V G90 ; absolute positioning G1 H0 Z130 F1000 ; move z down 10mm
and
homey.g ; called to home the Y axis ; ; generated by RepRapFirmware Configuration Tool v3.5.4 on Mon Sep 09 2024 22:47:08 GMT-0600 (Mountain Daylight Time) ; increase Z G91 ; relative positioning G1 H2 Z5 ; move Z relative to current position to avoid dragging nozzle over the bed G90 ; absolute positioning ; home Y G91 ; relative positioning var maxTravel = move.axes[1].max - move.axes[1].min + 5 ; calculate how far Y can travel plus 5mm G1 H1 Y{-var.maxTravel} F6000 ; coarse home in the -Y direction G1 Y5 F7200 ; move back 5mm G1 H1 Y{-var.maxTravel} F300 ; fine home in the -Y direction G90 ; absolute positioning ; decrease Z again G91 ; relative positioning G1 H2 Z-5 F7200 ; move Z relative to current position G90 ; absolute positioning M584 Y0.1 U0.3 P5 ; split Y motor control to Y and V and show U (param P5) in the UI G1 H1 Y-205 U-205 F1000 ; Move Y and U down until the switches triggers ;G92 Y0 G1 H0 Y5.175 F100 ; Add move to square axis, can be Y or U G92 Y0 M584 Y0.1:0.3 P3 ; back to combined axes and hidden U G90
I think I will leave it as is for now unless you see anything that will cause me problems.
Can I just add the additions to the end of my home all file?
Thank you for the help.
-
@Alijambo73 How did you define the endstops? Because you're homing Z once together, then individually (same for Y). Usually you would need to redefine the endstops between them, or you get the "Error: Failed to enable endstops" message, eg have this at the beginning of homez.g
M574 Z2 S1 P"io4.in+io5.in" ; configure active-high endstop for high end on Z via pin io4.in + io5.in"
then when you split the axes, redefine as:
M574 Z2 S1 P"io4.in" ; configure active-high endstop for high end on Z via pin io4.in M574 V2 S1 P"io5.in" ; configure active-high endstop for high end on V (Z2)via pin io5.in
It takes a few less homing movements if you do it the way I suggested.
Ian
-
@droftarts So I changed my config.g to this
; Endstops M574 X1 S1 P"io1.in" ; configure active-high endstop for low end on X via pin io2.in M574 Y1 S1 P"io2.in+io3.in" ; configure active-high endstop for low end on Y via pin io2.in M574 Z2 S1 P"io4.in+io5.in" ; configure active-high endstop for high end on Z via pin io4.in
and my homez to this
; home Z G91 ; relative positioning ;var maxTravel = move.axes[2].max - move.axes[2].min + 5 ; calculate how far Z can travel plus 5mm ;G1 H1 Z{var.maxTravel} F1000 ; coarse home in the +Z direction ;G1 Z-5 F6000 ; move back 5mm ;G1 H1 Z{var.maxTravel} F300 ; fine home in the +Z direction ;G90 ; absolute positioning ;G1 H0 Z130 ; move z down 10mm ; level Z M584 Z0.2 V0.4 P5 ; split Z motor control to Z and V and show V (param P5) in the UI M547 Z2 S1 P"io4.in" M547 V2 S1 P"io5.in" G1 H1 Z140 V140 F500 ; Move Z and V down until the switches triggers G92 V0 ; set V to 140 G1 H0 V-1.7 F1 ; Add move to square axis, can be Z or V G92 Z140 V140 ; set V to 140 M584 Z0.2:0.4 P3 ; back to combined axes and hidden V M574 Z2 S1 P"io4.in+io5.in" G90 ; absolute positioning G1 H0 Z130 F1000 ; move z down 10mm
This leads to "Warning: M547: Command is not supported" and "Error: in file macro line 15: G1: Failed to enable endstops"
in the link https://docs.duet3d.com/en/User_manual/Connecting_hardware/Z_probe_auto_levelling#axis-levelling-using-endstops It has the endstops configured one per axis and doesn't reference them at all in the home z example. My U and V endstops were not triggering the corresponding drivers to stop so changing the config g solved that.
Let me know if you can see what I'm missing with the endstops in my home z file.
Thanks
-
@droftarts As of now this is what I have in my config.g
M584 X0.0 Y0.1:0.3 Z0.2:0.4 U0.3 V0.4 P3 ; U=Y2 V=Z2 set axis mapping
; Endstops M574 X1 S1 P"io1.in" ; configure active-high endstop for low end on X via pin io2.in M574 Y1 S1 P"io2.in+io3.in" ; configure active-high endstop for low end on Y via pin io2.in M574 Z2 S1 P"io4.in+io5.in" ; configure active-high endstop for high end on Z via pin io4.in
and in my homez.g
; home Z M574 Z2 S1 P"io4.in+io5.in" ; configure active-high endstop for high end on Z via pin io4.in G91 ; relative positioning ;var maxTravel = move.axes[2].max - move.axes[2].min + 5 ; calculate how far Z can travel plus 5mm ;G1 H1 Z{var.maxTravel} F1000 ; coarse home in the +Z direction ;G1 Z-5 F6000 ; move back 5mm ;G1 H1 Z{var.maxTravel} F300 ; fine home in the +Z direction ;G90 ; absolute positioning ;G1 H0 Z130 ; move z down 10mm ; level Z M584 Z0.2 V0.4 P5 ; split Z motor control to Z and V and show V (param P5) in the UI M547 Z2 S1 P"io4.in" M547 V2 S1 P"io5.in" G1 H1 Z140 V140 F500 ; Move Z and V down until the switches triggers G92 V0 ; set V to 140 G1 H0 V-1.7 F1 ; Add move to square axis, can be Z or V G92 Z140 V140 ; set V to 140 M584 Z0.2:0.4 P3 ; back to combined axes and hidden V M574 Z2 S1 P"io4.in+io5.in" G90 ; absolute positioning G1 H0 Z130 F1000 ; move z down 10mm
After reading a little closer i realized i miss the point of adding M574 Z2 S1 P"io4.in+io5.in" in the begining of homez.g. I still get the error "Failed to enable endstops" error.
-
-
@Phaedrux Wow, I can't believe I missed that. Everything seems to be working perfectly now.
Thank you for all the help.
-
-