Independent axis homing with two endstops per axis

  • Tried to build a MPCNC and just started configuration. I have two motors and endstops for the x and y axis respectively.
    Currently, for the

    • x axis I connected the stepper motors to the x and y driver
    • y axis I connected the steppers to the e0 and e1 driver

    The endstops are connected to the related motor.
    Does my configuration home each motor per axis individually?

    ; General preferences
    G90                                            ; send absolute coordinates...
    M83                                            ; ...but relative extruder moves
    M550 P"MPCNC"                                  ; set printer name
    ; Network
    M550 P"MPCNC"                        	    ; Set machine name
    M552 S1                                     ; Enable network
    M586 P0 S1                                  ; Enable HTTP
    M586 P1 S0                                  ; Disable FTP
    M586 P2 S0                                  ; Disable Telnet
    ; Drives
    M569 P0 S0                                     ; physical drive 0 goes forwards
    M569 P1 S1                                     ; physical drive 1 goes forwards
    M569 P2 S0                                     ; physical drive 2 goes forwards
    M569 P3 S1                                     ; physical drive 2 goes forwards
    M569 P4 S1                                     ; physical drive 2 goes forwards
    M584 X0:1 Y3:4 Z2
    M350 X16 Y16 Z16 E16 I1                        ; configure microstepping with interpolation
    M92 X80.00 Y80.00 Z4000.00 E420.00             ; set steps per mm
    M566 X900.00 Y900.00 Z12.00 E120.00            ; set maximum instantaneous speed changes (mm/min)
    M203 X6000.00 Y6000.00 Z180.00 E1200.00        ; set maximum speeds (mm/min)
    M201 X500.00 Y500.00 Z20.00 E250.00            ; set accelerations (mm/s^2)
    M906 X800 Y800 Z800 E800 I30                   ; set motor currents (mA) and motor idle factor in per cent
    M84 S30                                        ; Set idle timeout
    ; Axis Limits
    M208 X0 Y0 Z0 S1                               ; set axis minima
    M208 X310 Y310 Z80 S0                          ; set axis maxima
    ; Endstops
    M574 X1 S1 P"!xstop+!ystop"   ; X min active high endstop switch
    M574 Y1 S1 P"!e0stop+!e1stop"   ; Y min active high endstop switch
    M574 Z1 S1 P"!zstop"   ; Z min active high endstop switch

  • Moderator

    With the Duet it's uncommon to use more than a single endstop per axis since the firmware uses soft axis limits to keep the print head within the set bounds. With the low forces exerted and stall detection there is not much risk if there are skipped steps and it hits the frame. Furthermore, endstops are only active during a homing move (G1 H1). Hitting an endstop otherwise during a job does nothing.

    With a CNC and much more powerful axis movements I can see how it would make more sense to have some active endstops going. Sometimes what people will do is have a normal endstop on one end and an E stop on the other. You can take that a step further actually and use one end as an endstop for homing and then when homing is done, reconfigure the endstops to all be E stops.

    All homing procedures are carried out by your commands in the homing files. You can configure the endstops right there in that file and then change the configuration in the same file after the homing moves are complete.

    See if these documents help you out.

  • I heard the two switches are used to perform a self squaring (in case there are just 1-2 mm difference) on bigger MPCNCs. Mine is just 600x600 mm and it seems square. However, I wonder whether this can be configured in the firmware. So far I really only used the Duets for 3d printing.

  • administrators

    @dgrat Having an endstop for each drive (in your case X axis = x driver and y driver) makes sense. I think what @Phaedrux was talking about was an endstop at each end of a single axis which is a different thing.

    In your care, where you have the X and Y motor driving the X axis (and E0 and E1 driving the Y axis) then being able to home both the drives on X independently, with one endstop per drive, in order to ensure the axis is trammed square is the correct thing to do.

    It looks like you are using RRF v3.x from your config file, is that right?

    You have correctly allocated the endstops using M574 from what I can see, although are you really using NO switches not NC (NC is recommended and normally safer:

    Endstop type S0 (active low switch) is no longer supported in M574 commands. Instead, use type S1 and invert the input by prefixing the pin name with '!'. Ex: M574 X1 S1 P"!xstop". Invert the input when using an NPN output inductive or capacitive sensor, or using a NO switch (not recommended, use a NC switch instead).

    (from here :

    What exactly is not working?

  • It looks like you are using RRF v3.x from your config file, is that right?


    although are you really using NO switches not NC

    I use these (, maybe I wired the wrong way?!

    What exactly is not working?

    It seemed as if it was homing just fine. According to the docu I was confused because of the pin naming and I was not sure whether individual homing is just working out of the box like this.

    it really works.

  • administrators

    You have the correct M574 endstop configuration for those endstop switches, see

    Independent homing of dual axis motors should be working. If you are in doubt, you can check it by triggering one of the endstop switches early; but if you do that, take precautions against damaging the machine due to running just one of the axis motors, for example by reducing the motor currents.

Log in to reply