Problem with Z axis homing



  • Hello,
    I am having trouble homing the Z axis.
    The printer I have is a diy printer (toolchanger coreXY type, with Z moving up/down).
    I have used the toolchanger firmware and I am making some changes.
    So I have managed to home X and Y axis, but the Z axis is not homing succesfully, meaning that in DWG2 it is showing that is homed but in real life the bed is not going up triggering the Z endstop/probe I am using.
    I have tried changing the M574 command to S0 and the Z homed correctly. But when it is in S2 mode is not going up to trigger the probe. Can anyone help me?

    This is my config file:

    *; Configurat; Configuration file for Duet WiFi / Ethernet
    ; executed by the firmware on start-up

    ; General preferences
    M111 S0 ; Debugging off
    G21 ; Work in millimetres
    G90 ; Send absolute coordinates...
    M83 ; ...but relative extruder moves
    M555 P2 ; Set firmware compatibility to look like Marlin

    ; Network
    M550 P"ToolChanger" ; Set machine name
    M587 S"andreas" P"as2138774" ; WiFi Settings
    M552 S1 P"andreas" ; Enable WiFi Networking
    M552 S1 ; Enable Networking
    M586 P0 S1 ; Enable HTTP
    M586 P1 S0 ; Disable FTP
    M586 P2 S0 ; Disable Telnet

    M669 K1 ; Select CoreXY mode (fw: 2.03+)

    ; Drive direction
    M569 P0 S1 ; Drive 0 X
    M569 P1 S1 ; Drive 1 Y
    M569 P2 S1 ; Drive 2 Z
    M569 P3 S1 ; Drive 3 Coupler
    M569 P4 S1 ; Drive 4 E0
    M569 P5 S1 ; Drive 5 E1
    M569 P6 S1 ; Drive 6 E2
    M569 P7 S0 ; Drive 7 E3
    M569 P8 S0 ; Drive 8 UNUSED
    M569 P9 S0 ; Drive 9 UNUSED

    M584 X0 Y1 Z2 C3 E4:5:6:7 ; Apply custom drive mapping
    M208 X-10 Y-5 Z-3 S1 ; set axis minima
    M208 X320 Y285 Z300 S0 ; set axis maxima
    M350 E16:16:16:16 I0 ; Configure microstepping without interpolation
    M350 X16 Y16 Z16 I1 ; Configure microstepping with interpolation
    M92 X100 Y100 Z400 C544 E800:800:800:800 ; Set steps per mm
    M566 X400 Y400 Z8 C2 E2:2:2:2 ; Set maximum instantaneous speed changes (mm/min)
    M203 X16500 Y16500 Z1200 C2600 E5000:5000:5000:5000 ; set maximum speeds (mm/min)
    M201 X4000 Y4000 Z400 C500 E2500:2500:2500:2500 ; Set accelerations (mm/s^2)
    M906 X1200 Y1200 Z1000 C700 E1500:1500:1500:1500 I30 ; Set motor currents (mA) and motor idle factor in percent
    M84 S120 ; Set idle timeout

    ; Endstops
    M574 X1 Y2 S0 ; Set X / Y endstop active high
    M574 Z1 S2 ; Set Z endstop probe
    M558 P7 X0 Y0 Z2 H5 F360 I0 T20000 ; Set Z probe type to switch, the axes for which it is used and the dive height + speeds
    G31 P300 X4.35 Y43.6 Z2.5 ; Set Z probe trigger value, offset and trigger height
    M557 X5:215 Y10:195 S20 ; Define mesh grid

    ; Heaters
    M305 S"Bed" P0 T100000 B4725 C7.060000e-8 R4700 ; Set thermistor
    M143 H0 S130 ; Set temperature limit for heater 0 to 130C
    M305 S"T0" P1 T100000 B4725 C7.060000e-8 R4700 ; Set thermistor
    M143 H1 S285 ; Set temperature limit for heater 1 to 300C
    M305 S"T1" P2 T100000 B4725 C7.060000e-8 R4700 ; Set thermistor
    M143 H2 S285 ; Set temperature limit for heater 2 to 300C
    M305 S"T2" P3 T100000 B4725 C7.060000e-8 R4700 ;Set thermistor
    M143 H3 S285 ; Set temperature limit for heater 3 to 300C
    M305 S"T3" P4 T100000 B4725 C7.060000e-8 R4700 ; Set thermistor
    M143 H4 S285 ; Set temperature limit for heater 4 to 300C

    ; Fans
    M106 P0 S0 I0 F500 H-1 ; Fan used on T0, T1, T2, T3 for cooling filament. Thermostatic control is turned off
    M106 P1 S255 I0 F500 H1 T50 ; Fan T0. Thermostatic control is turned on
    M106 P2 S255 I0 F500 H2 T50 ; Fan T1. Thermostatic control is turned on
    M106 P3 S255 I0 F500 H3 T50 ; Fan T2. Thermostatic control is turned on
    M106 P4 S255 I0 F500 H4 T50 ; Fan T3. Thermostatic control is turned on

    ; Tools
    M563 P0 S"T0" D0 H1 F1 ; Define tool 0
    G10 P0 X0 Y0 Z0 ; Reset tool 0 axis offsets
    G10 P0 R0 S0 ; Reset initial tool 0 active and standby temperatures to 0C

    M563 P1 S"T1" D1 H2 F2 ; Define tool 1
    G10 P1 X0 Y0 Z0 ; Reset tool 1 axis offsets
    G10 P1 R0 S0 ; Reset initial tool 1 active and standby temperatures to 0C

    M563 P2 S"T2" D2 H3 F3 ; Define tool 2
    G10 P2 X0 Y0 Z0 ; Reset tool 2 axis offsets
    G10 P2 R0 S0 ; Reset initial tool 2 active and standby temperatures to 0C

    M563 P3 S"T3" D3 H4 F4 ; Define tool 3
    G10 P3 X0 Y0 Z0 ; Reset tool 3 axis offsets
    G10 P3 R0 S0 ; Reset initial tool 3 active and standby temperatures to 0C

    ;M593 F50 ; cancel ringing at 50Hz (https://forum.e3d-online.com/threads/accelerometer-and-resonance-measurements-of-the-motion-system.3445/)
    ;M376 H15 ; bed compensation taper

    ;tool offsets - stock
    ;G10 P0 X35 Y53.5 Z-3.9 ; T0
    ;G10 P1 X35 Y53.5 Z-5 ; T1
    ;G10 P2 X35 Y53.5 Z-5 ; T2
    ;G10 P3 X35 Y53.5 Z-5 ; T3

    ; Filament diameter
    M404 P0 N1.75 D0.4
    M404 P1 N1.75 D0.4
    M404 P2 N1.75 D0.4
    M404 P3 N1.75 D0.4

    ;deselect tools
    T-1

    ;M572 D0 S0.05 ; pressure advance T0
    ;M572 D1 S0.05 ; pressure advance T1
    ;M572 D2 S0.05 ; pressure advance T2
    ;M572 D3 S0.05 ; pressure advance T3*

    The following are the homing files:

    *; homeall.g
    ; called to home all axes

    M98 Phomec.g ; Home C (ToolHead)

    M98 Phomex.g ; Home X

    M98 Phomey.g ; Home Y

    M98 Phomez.g ; Home Z

    G1 X0 Y0 F10000 ; Park*

    *; homex.g
    ; called to home the x axis

    G91 ; use relative positioning
    G1 S2 X0.5 Y-0.5 F3000 ; energise
    ;M400 ; make sure everything has stopped before we make changes
    ;G4 P100 ; wait 400ms
    ;M574 X1 Y1 S3 ; set endstops to use motor stall
    ;M913 X25 Y25 ; drop motor currents to 50%
    ;M915 H200 X Y S4 R0 F0 ; set X and Y to sensitivity 3, do nothing when stall, unfiltered
    G1 S2 Z3 F5000 ; lift Z 3mm
    G1 S1 X-400 F3000 ; move left 400mm, stopping at the endstop
    G1 S1 X2 F2000 ; move away from end
    G1 S2 Z-3 F1200 ; lower Z
    G90 ; back to absolute positioning
    ;M400 ; make sure everything has stopped before we reset the motor currents
    ;G4 P100 ; wait 400ms
    ;M913 X100 Y100 ; motor currents back to 100%
    ;M574 X1 S0 ; Define active low and unused microswitches*

    *; homey.g
    ; called to home the Y axis

    G91 ; use relative positioning
    G1 S2 X0.5 Y-0.5 F3000 ; energise
    ;M400 ; make sure everything has stopped before we make changes
    ;M574 X1 Y1 S3 ; set endstops to use motor stall
    ;M913 X20 Y20 ; drop motor currents to 25%
    ;M915 H200 X Y S3 R0 F0 ; set X and Y to sensitivity 3, do nothing when stall, unfiltered
    G1 S2 Z3 F5000 ; lift Z 3mm
    G1 S1 Y400 F3000 ; move to the back 400mm, stopping at the endstop
    G1 S1 Y-2 F2000 ; move away from end
    G1 S2 Z-3 F1200 ; lower Z
    G90 ; back to absolute positioning
    ;M400 ; make sure everything has stopped before we reset the motor currents
    ;G4 P100 ; wait 400ms
    ;M913 X100 Y100 ; motor currents back to 100%
    ;M574 X1 S0 ; Define active low and unused microswitches*

    *; homez.g
    ; called to home the Z axis

    M98 P/macros/Coupler - Unlock ; Open Coupler
    G91 ; Relative mode
    G1 S2 Z5 F800 ; Lower the bed
    G90 ; back to absolute positioning
    G1 X150 Y150 F10000 ; Position the endstop above the bed centre
    G91 ; Relative mode
    ;G4 P500 ; wait 500msec
    G1 Z-400 S1 F250 ; Move Z up until the switch triggers (first pass)
    ;G4 P500 ; wait 500msec
    G1 Z5 F500 ; Lift Z
    ;G4 P500 ; wait 500msec
    G1 Z-300 S1 F75 ; Move Z down until the switch triggers (second pass)
    ;G4 P500 ; wait 500msec
    G1 Z5 F800 ; Drop the Bed
    G90 ; Back to absolute positioning*


  • Moderator

    What firmware version are you actually using? Send M115 to check.
    Are you intending to use an endstop or a probe?
    What kind of probe is it?
    Where is the endstop located?

    Will need to know those things before I can help further.

    M558 P7 X0 Y0 Z2 H5 F360 I0 T20000 ;

    P7 isn't used in recent firmware.
    X0 Y0 Z2 is not used anymore either
    Neither is I0



  • Hi, thanks for the reply.

    The firmware is:
    "Board: Duet WiFi 1.02 or later
    Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 2.05.1 (2020-02-09b1)
    Duet WiFi Server Version: 1.23"

    I have put a microswitch as a probe, that's why I use S2 in the M574.
    The probe is located under the toolhead, just like E3D has done.

    The M558 P7 X0 Y0 Z2 H5 F360 I0 T20000 ; command, as many others, is taken from E3D's firmware.

    I hope that I have included all the needed information.
    Thanks in advance.



  • Hi. Assuming your probe/switch is connected to Z endstop, your probe defination for firmware 2.05.1 should look like this:
    M558 P4 C2 H5 F360 T20000.
    And in your homez.g you need to use probe move to probe, that is G30 , not G1 moves to probe bed,as your microswitch is defined as probe, not as endstop switch


  • Moderator

    @sigourosandreas said in Problem with Z axis homing:

    is taken from E3D's firmware.

    It's E3Ds config file, not firmware, and that command format has been retired for a long time. aidar has it right if using the z axis with a probe, but I'm not even sure if that's how they've intended the Z axis to be used in the tool changer. The config is a bit contradictory.



  • Thank you aidar and Phaedrux for your answers.
    It worked.
    I have homed the Z axis, but it does not do all the commands in the homez file. The non completed commands are with bold.
    I have also made some changes in this file as per aidar's instuctions.
    If you can check them please and tell me where the mistake is.

    *; homez.g
    ; called to home the Z axis

    M98 P/macros/Coupler - Unlock ; Open Coupler
    G91 ; Relative mode
    G1 S2 Z5 F800 ; Lower the bed
    G90 ; back to absolute positioning
    G1 X150 Y150 F10000 ; Position the endstop above the bed centre
    G91 ; Relative mode
    G30 Z-400 F1200 ; Move Z up until the switch triggers (first pass)
    G1 Z5 F500 ; Lift Z
    G30 Z-300 H3 S-2 F50 ; Move Z down until the switch triggers (second pass)
    ;G1 Z5 F800 ; Drop the Bed
    G90 ; Back to absolute positioning
    *

    It also gives me an error, saying:
    Error : G30 : G30 S-2 commanded with no tool selected

    What should I do?
    How do I tell it to select a tool? And where do I tell it?



  • For homing Z you need only single probe without any parameters. That means your homez.g should look like this:
    M98 P/macros/Coupler - Unlock ; Open Coupler
    G91 ; Relative mode
    G1 S2 Z5 F800 ; Lower the bed
    G90 ; back to absolute positioning
    G1 X150 Y150 F10000 ; Position the endstop above the bed centre
    G91 ; Relative mode
    G30
    G1 Z5 F500 ; Lift Z
    G90 ; Back to absolute positioning

    If you want to probe more then 1 time use A parameter in your probe defination. https://duet3d.dozuki.com/Wiki/Gcode#Section_M558_in_RepRapFirmware_2_x_and_earlier


  • Moderator

    Is there a more recent config file version for the tool changer? I'm not sure if the end stop switch on the tool carriage is intended to be used as a probe or a normal switch. Once a tool is mounted you'll need the offset applied. I'm not familiar enough with the e3d tool changer to give precise advice.


Log in to reply