Two steppers and two end stops on one axis



  • After converting my Cetus3D printer to using a Duet 0.8.5 board I am moving on and building a MPCNC using the Duet 0.6 from an old RepRap Ormerod printer.

    My question is that other control boards controlling this type of CNC machine can do something called "auto squaring". That means basically that both X & Y axis has two steppers each and two end stops each.

    During homing of an axis both stepper motors move and each one stops when hitting its end stop and consequently squaring the axis. (assuming the end stops are placed at the right position)

    My research has lead me to believe that this is possible using this config for X axis:

    M584 X0:3 Y1 Z2 U3
    M574 X1 Y2 Z2 U1 S1

    Can this be done with the Duet ?

    Any additional information how to set this up would be much appreciated.



  • @fotomas Just have a look here - https://forum.duet3d.com/topic/4669/ooznest-workbee-screw-driven. This is the same situation, but a CNC with dual Y axis.



  • Interesting thread, but that configuration is with two end stop switches in series. There is no way of squaring by homing, the steppers will keep chugging until both switches has been thrown.

    I want both steppers to move during homing but stop by reaching its corresponding end stop.

    I hope you my explanation makes sense.



  • I do something similar for Z axis:
    My Z is defined
    in config.g
    M584 ... Z6:7:8:9

    Then in homez.g
    don't mind the D axis -- I have a modified firmware, you'd use the axis you have available
    M584 Z6 B7 C8 D9
    G91
    G1 Z6 B6 C6 D6 F450 S2
    G1 Z-500 B-500 C-500 D-500 F450 S1
    G1 Z5 B5 C5 D5 F450 S2
    G1 Z-10 B-10 C-10 D-10 F100 S1
    M584 Z6:7:8:9
    M671 X708:708:-95:-95 Y600:-10:-10:600 S5
    G92 Z0 B0 C0 D0
    G90

    so in homeall.g I call homez.g -- so as not copy all that stuff.
    hope that helps



  • @fotomas You are totally wrong! I have both homing and limit switches on each axis and those are in series - during normal operation if any switch gets triggered it is considered an emergency situation and everything is stopped, like when pressing the emergency button.

    The switches on each axis are connected to the corresponding end-stops on the duet, thus allowing squaring the gantry. So I have 4 switch pairs connected to the Duet - X, Y-Left, Y-Right and Z. Precise homing is done a little bit different in my scripts - a quicker move for finding the switches, a small retraction and a very slow move to precisely detect the switch trigger point. When all homed, all axis retract 1mm and that is considered the origin. Just on Y, one of the axis retract a little bit more than 1mm to compensate for the switch position. Even with identical switch models, no matter how identically you position them, there might be a small difference between the paired axis. Usually you need a precise caliper to determine it as it can be something like 0.05mm.



  • @catalin_ro That's not going to guarantee square. Or at least the purpose of your limit switches isn't being served. If you skew your Y axis -- and then home it -- the first limit switch will trigger an end stop, so it won't ever re-square itself. If you can assign individual stepper outputs and home the Y left and Y right together, they each find the end stop, even if the Y axis was skewed by a mm either side, it will get corrected provided your end stops are square. I did a little bit different since my machine uses 16 steppers, so I have 2 Y axes -- Y and U and each have 2 steppers and 2 end stops. I feed each with output from a single step/dir/enable set, and feed them through CMOS 3.3v logic gates which stop sending the step to the stepper which hit it's end stop, and the result end stop is a logical union of the left and right end stops -- so this way I can use 1 duet control signal and end for 2 steppers and 2 end stops -- this works perfectly because I have 2 X gantries in my quad independent extruder machine and I adjust the end stops to ensure the gantries are dead on parallel to each other. I tried series end stops -- it's no where near as accurate as pairing an end stop to the stepper.


  • administrators

    @fotomas said in Two steppers and two end stops on one axis:

    After converting my Cetus3D printer to using a Duet 0.8.5 board I am moving on and building a MPCNC using the Duet 0.6 from an old RepRap Ormerod printer.

    My question is that other control boards controlling this type of CNC machine can do something called "auto squaring". That means basically that both X & Y axis has two steppers each and two end stops each.

    During homing of an axis both stepper motors move and each one stops when hitting its end stop and consequently squaring the axis. (assuming the end stops are placed at the right position)

    My research has lead me to believe that this is possible using this config for X axis:

    M584 X0:3 Y1 Z2 U3
    M574 X1 Y2 Z2 U1 S1

    Can this be done with the Duet ?

    Any additional information how to set this up would be much appreciated.

    Yes it's possible. You need to create an additional temporary axis that will be used during homing, so that you can home both motors simultaneously but independently. Here's how to do it for the Z axis: https://duet3d.dozuki.com/Guide/Independent+Z+motors+and+endstop+switches/18?lang=en.



  • Thank you for all replies, I now think have enough info to implement this.



  • @kazolar It does guarantee square! If you go through my homing scripts you see that the Y axis are homed independently. And as it is very difficult to insure the switches trigger at the exact same distance from the mechanical reference for 0, one of the two Y axis needs to be just slightly moved back (fractions of a mm). Once that is done, the gantry is properly squared.



  • @catalin_ro so you are doing the same thing I suggested -- which is home Y right and Y left to hit individual limit switches -- maybe I read something wrong at nearly 3 am -- I thought you were doing series end switches -- which would not guarantee square...I re-read it now and you're doing the same thing as I am (I did it in logic circuits because otherwise I don't have enough end stops/stepper outputs on the duet to have each Y axis stepper go to duet directly) -- my system uses 16 steppers -- so I had to get creative



  • @kazolar I was thinking on something similar to your solution before using the Duet as I used GRBL for about 2 years on another CNC machine with twin Y axis.



  • @Catalin_RO it works super well -- just a couple of logic circuits -- 3.3v friendly chips and it works perfectly. I ended up designing a PCB and getting it made in China for $30 -- so it's nice and professional -- it takes a few 10 pin ribbons from duet, and has outputs for the 2 physical end stops (Y and U axis) + power and I plug in the extra steppers + end stops into it. There is no latency since it's just basic logic gates. One benefit I can't ever crash the X gantries past the end stops since the step pin stops being sent when end stop is hit and direction is into the end stop, so even safer than software limits



  • I have almost got this to work now. I have a some odd behaviors though.

    I have a Duet 0.6 with a Duet Shield. Four steppers connected (driver 0,1,3,4) and four switches NO connected connected beside each corresponding stepper connection.

    These are my issues (so far 🙂 ) :

    • To get it to work I added a M574 to the homing file.
    • The end stop switch beside the connector for drive 4 => Y2 triggers homing end on drive 3 => X2
    • The end stop switch beside the connector for drive 3 => X2 triggers homing end on drive 4 => Y2
    • The drives created in the homing file goes faster during homing, despite resetting max speed in homing file. After homing and two steppers per axis they have the same speed.
    • After homing the U and V axis turns up in DWC

    What am I doing wrong?

    homey.g
    ------------------------------------------------------
    M584 Y1 V4 ; split steppers
    M574 Y1 V1 S0 
    G91 ; relative moves
    G1 Y-650 V650 F450 S1 
    M584 Y1:4 ; join steppers
    G92 Y0 V0
    G90
    
    homex.g
    ------------------------------------------------------
    M584 X0 U3 ; split steppers
    M574 X1 U1 S0 
    G91 ; relative moves
    G1 X-650 U-650  F450 S1 
    M584 X0:3 ; join steppers
    G92 X0 U0
    G90
    
    config.g
    ------------------------------------------------------
    ; Configuration file for Duet 0.6 (firmware version 1.21)
    ; General preferences
    G90                              ; Send absolute coordinates...
    M83                              ; ...but relative extruder moves
    
    ; Network
    M550 P"MPCNC"                    ; Set machine name
    M552 P192.168.0.67 S1            ; Enable network and set IP address
    M553 P255.255.255.0              ; Set netmask
    M554 P192.168.0.1                ; Set gateway
    M586 P0 S1                       ; Enable HTTP
    M586 P1 S1                       ; Enable FTP
    M586 P2 S0                       ; Disable Telnet
    M540 PDE:AD:BE:EF:CA:FA
    
    ; Drives
    M584 X0:3 Y1:4 Z2  
    
    ; Tools
    
    M563 P0 D0 
    
    ; Drive direction
    M569 P0 S1                       ; Drive 0 goes forwards
    M569 P1 S1                       ; Drive 1 goes forwards
    M569 P2 S1                       ; Drive 2 goes forwards
    M569 P3 S0
    M569 P4 S1
    
    ; Steps and Speed
    M92 X80.00 Y80.00 U80.00 V80.00 Z4000.00       ; Set steps per mm
    M566 X900.00 Y900.00 Z12.00      ; Set maximum instantaneous speed changes (mm/min)
    M203 X6000.00 Y6000.00 Z180.00 U6000.00 V6000.00   ; Set maximum speeds (mm/min)
    M201 X500.00 Y500.00 Z20.00 U500.00 V500.00     ; Set accelerations (mm/s^2)
    M906 X800.00 Y800.00 Z800.00 I30 U800.00 V800.00 ; Set motor currents (mA) and motor idle factor in per cent
    M84 S30                          ; Set idle timeout
    
    ; Axis Limits
    M208 X0 Y0 Z0 U0 V0 S1                 ; Set axis minima
    M208 X600 Y400 Z100 U600 V600 S0           ; Set axis maxima
    
    ; Endstops
    M574 X1 Y1 U1 V1 S0               ; Set active low and disabled endstops
    
    ; Z-Probe
    M558 P0 H5 F120 T6000            ; Disable Z probe but set dive height, probe speed and travel speed
    M557 X15:100 Y15:195 S20         ; Define mesh grid
    
    ; Heaters
    M140 H-1                         ; Disable heated bed
    
    

    0_1546465065962_20190102_215625.jpg


  • administrators

    1. You should create U and V in the initial M584 command in config.g, otherwise the references to U and V later in config.g won't work. That's why you needed the M574 commands in the homing files. It may also be why the speeds are wrong. Also add parameter P3 to that M584 command to hide the U and V axes initially.

    2. In your homing files, add parameter P5 to the initial M584 commands, to make U and V visible and controllable; and add P3 to the later M584 commands to hide them. Also swap the order of the G92 and M584 commands, or get rid of the G92 commands (you don't need them if your M208 lower axis limits are set correctly).

    3. Regarding the swapped endstop connectors, the pin assignment should be correct for the DueX4 board. Maybe there is a pin difference between the DueX4 and the Duet Shield; or maybe they are wrong for the DueX4 too. I'll check when I get time.



  • Thank you so much for the quick an accurate help.

    All problems are now solved, the steppers now move with the same speed AND the end stop switches works for the correct steppers now. I guess my config caused some confusion. So no need to look into the Duet Shiled wiring.

    Once again, thank you so much!

    /Tomas


  • administrators

    Thanks, I'll mark it as solved. I'm planning to make dual endstop setups much easier in firmware 2.03.



  • Final settings (for future use by anyone interested):

    config.g
    -----------------------------------------
    ; Drives
    M584 X0:3 Y1:4 Z2 U3 V4 P3; Three axis visible
    
    ; Tools
    M563 P0 D0 
    
    ; Drive direction
    M569 P0 S1                       ; Drive 0 goes forwards
    M569 P1 S1                       ; Drive 1 goes forwards
    M569 P2 S1                       ; Drive 2 goes forwards
    M569 P3 S1
    M569 P4 S1
    
    ; Steps and Speed
    M92 X80.00 Y80.00 U80.00 V80.00 Z4000.00 ; Set steps per mm
    M566 X900.00 Y900.00 U900.00 V900.00 Z12.00; Set maximum instantaneous speed changes (mm/min)
    M203 X6000.00 Y6000.00 Z180.00 U6000.00 V6000.00; Set maximum speeds (mm/min)
    M201 X500.00 Y500.00 Z20.00 U500.00 V500.00; Set accelerations (mm/s^2)
    M906 X800.00 Y800.00 Z800.00 U800.00 V800.00 I30; motor currents (mA) and motor idle factor
    M84 S30  ; Set idle timeout
    
    ; Axis Limits
    M208 X0 Y0 Z0 U0 V0 S1                 ; Set axis minima
    M208 X600 Y400 Z100 U600 V600 S0           ; Set axis maxima
    
    ; Endstops
    M574 X1 Y1 U1 V1 S0               ; Set active low and disabled endstops
    
    homex.g
    ----------------------------------------
    M584 X0 U3 P5; split steppers, 5 axis visible
    G91 ; relative moves
    G1 X-650 U-650  F450 S1 ; fast homing X and U in parallell
    ;G92 X0 U0 ; Make adjustments to square axis here
    M584 X0:3 P3; join steppers, 3 axis visible
    G90

 

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