Hi,
I have just upgraded my CoreXY machine to have two stepper motors for the Z axis. I wanted to be able to auto sync both of the Z stepper motors when homing.
I used my unused Extruder stepper (E2) stepper driver for the Z2 motor and added a homing switch for the Z2 motor.
I activated the Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS and assigned pin numbers for both the second Z stepper driver and Z min home sensor switch. Also added some code to Marlin.
Operation:
When the printer receives a Z home, both Z stepper motors (Z1 & Z2) drive the print platform towards the home position.
When either of the Z stepper motors min home switches are triggered the corresponding stepper motor stops.
Once both stepper motors have reached home, there is a delay before they then both move the print platform a short distance away from home and then back to home again.
Current Issue:
There appears to be a set time to home both Z stepper motors regardless of their starting positions.
This is different to normal homing of the Z axis when not using Z_DUAL_ENDSTOPS. ( No delay for small homing moves).
The set time appears to be based on the Z maximum movement setting and the homing speed.
The set time appears to be good that there is a motor drive timeout if both Z1min & Z2 min aren’t triggered.
It would be good to have some code that once both the Z1min & Z2min are triggered that there is no time delay. This would overcome the delay with small home movements.
Apart from this issue, auto syncing of the two Z axis motors is an excellent feature of Marlin.
I had to make a few changes to the Marlin code as listed below.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Marlin Version: 1.1 Development version
Sketch: Configuration.h
Description: Define the Z2 homing sensor end stop pull if required.
Line 319
#define ENDSTOPPULLUP_Z2MIN
---------------------------------------------------------------------
Sketch: Configuration_adv.h
Description: 2 lines were added for Z2min and comments added for Z2max as you don’t use both min and max for Z2
Line 148
#define Z_DUAL_STEPPER_DRIVERS //uncomment if using Z dual stepper drivers
#ifdef Z_DUAL_ENDSTOPS //uncomment if using Z dual end stops
//#define Z2_MAX_PIN 5 //uncomment if using Z2MAX for homing - MAX Endstop used for Z2 axis. Define pin being used for Z2 sensor
//const bool Z2_MAX_ENDSTOP_INVERTING = true; //uncomment if using Z2MAX for homing - true to invert- for NO switches - false for N/O switches
#define Z2_MIN_PIN 5 //uncomment if using Z2MIN for homing - MIN Endstop used for Z2 axis. Define pin being used for Z2 sensor
const bool Z2_MIN_ENDSTOP_INVERTING = false; //uncomment if using Z2MIN for homing - true to invert- for NC switches - false for N/O switches
---------------------------------------------------------------------
Sketch: pins_ramps13.h
Description: Define which pins are being used – Currently using E2 extruder driver PCB for stepper Z2 on a ramps board.
Line 48
#define Z2_STEP_PIN 36
#define Z2_DIR_PIN 34
#define Z2_ENABLE_PIN 30
---------------------------------------------------------------------
Sketch: Stepper.ccp
Description: The following was added for Z2min
Line 933
#if HAS_Z2_MIN
SET_INPUT(Z2_MIN_PIN);
#ifdef ENDSTOPPULLUP_ZMIN
WRITE(Z2_MIN_PIN,HIGH);
#endif
#endif
---------------------------------------------------------------------
Sketch: Marlin_main.cpp
Description: Allows M119 to report state of Z2min sensor
Line 3877
#if HAS_Z2_MIN
SERIAL_PROTOCOLPGM(MSG_Z2_MIN);
SERIAL_PROTOCOLLN(((READ(Z2_MIN_PIN)^Z2_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif
----------------------------------------------------------------------------------------------------------------------------
Note:
Adding Z2min to the M119 End Switch report allows a good testing all endstop sensors.
It is also very good to show how M666 endstop adjustment works.
After a normal home you can see both Z1min and Z2min are triggered.
Give a M666 g-code with a plus or minus figure and then do a Z home and you can see how either Z1min or Z2min is trigged and the other Zmin is open.
I changed my Marlin Endstop “Open” message from ‘Open” to “ - - - “ as I think “Open” is a bit confusing as if using a switch it may in fact be closed.
Using “ Un-triggered” is more correct but I found using ‘- - - “just looked better.
Better to have switches closed when away from home as less chance to get electrical noise that may cause a false home detect.
---------------------------------------------------------------------
Sketch: language.h
Description: If using another language you may need to change that as well.
Line 155
#define MSG_ENDSTOP_OPEN "- - -"
================================================================================================
Something else that can be added for M119
Found this to be good to have added to Marlin when using a filament present switch (filament runout) for M119 reporting.
Sketch: Marlin_main.cpp
Description: M119 is used to report status of endstop switches. It can be edited to report additional switches like the filament present switch.
Line: 3887
Code added:
#if HAS_FILRUNOUT
SERIAL_PROTOCOLPGM(MSG_FILAMENT);
SERIAL_PROTOCOLLN(((READ(FILRUNOUT_PIN)^FIL_RUNOUT_INVERTING)?MSG_FILRUNOUT:MSG_FILRUNIN));
#endif
Sketch: language.h
Description: If using another language you may need to change that as well.
Line: 145
Code added:
#define MSG_FILAMENT "Filament: "
#define MSG_FILRUNOUT "Out "
#define MSG_FILRUNIN "Present “
--------------------------------------------------------------------------------------------------------
I have just upgraded my CoreXY machine to have two stepper motors for the Z axis. I wanted to be able to auto sync both of the Z stepper motors when homing.
I used my unused Extruder stepper (E2) stepper driver for the Z2 motor and added a homing switch for the Z2 motor.
I activated the Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS and assigned pin numbers for both the second Z stepper driver and Z min home sensor switch. Also added some code to Marlin.
Operation:
When the printer receives a Z home, both Z stepper motors (Z1 & Z2) drive the print platform towards the home position.
When either of the Z stepper motors min home switches are triggered the corresponding stepper motor stops.
Once both stepper motors have reached home, there is a delay before they then both move the print platform a short distance away from home and then back to home again.
Current Issue:
There appears to be a set time to home both Z stepper motors regardless of their starting positions.
This is different to normal homing of the Z axis when not using Z_DUAL_ENDSTOPS. ( No delay for small homing moves).
The set time appears to be based on the Z maximum movement setting and the homing speed.
The set time appears to be good that there is a motor drive timeout if both Z1min & Z2 min aren’t triggered.
It would be good to have some code that once both the Z1min & Z2min are triggered that there is no time delay. This would overcome the delay with small home movements.
Apart from this issue, auto syncing of the two Z axis motors is an excellent feature of Marlin.
I had to make a few changes to the Marlin code as listed below.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Marlin Version: 1.1 Development version
Sketch: Configuration.h
Description: Define the Z2 homing sensor end stop pull if required.
Line 319
#define ENDSTOPPULLUP_Z2MIN
---------------------------------------------------------------------
Sketch: Configuration_adv.h
Description: 2 lines were added for Z2min and comments added for Z2max as you don’t use both min and max for Z2
Line 148
#define Z_DUAL_STEPPER_DRIVERS //uncomment if using Z dual stepper drivers
#ifdef Z_DUAL_ENDSTOPS //uncomment if using Z dual end stops
//#define Z2_MAX_PIN 5 //uncomment if using Z2MAX for homing - MAX Endstop used for Z2 axis. Define pin being used for Z2 sensor
//const bool Z2_MAX_ENDSTOP_INVERTING = true; //uncomment if using Z2MAX for homing - true to invert- for NO switches - false for N/O switches
#define Z2_MIN_PIN 5 //uncomment if using Z2MIN for homing - MIN Endstop used for Z2 axis. Define pin being used for Z2 sensor
const bool Z2_MIN_ENDSTOP_INVERTING = false; //uncomment if using Z2MIN for homing - true to invert- for NC switches - false for N/O switches
---------------------------------------------------------------------
Sketch: pins_ramps13.h
Description: Define which pins are being used – Currently using E2 extruder driver PCB for stepper Z2 on a ramps board.
Line 48
#define Z2_STEP_PIN 36
#define Z2_DIR_PIN 34
#define Z2_ENABLE_PIN 30
---------------------------------------------------------------------
Sketch: Stepper.ccp
Description: The following was added for Z2min
Line 933
#if HAS_Z2_MIN
SET_INPUT(Z2_MIN_PIN);
#ifdef ENDSTOPPULLUP_ZMIN
WRITE(Z2_MIN_PIN,HIGH);
#endif
#endif
---------------------------------------------------------------------
Sketch: Marlin_main.cpp
Description: Allows M119 to report state of Z2min sensor
Line 3877
#if HAS_Z2_MIN
SERIAL_PROTOCOLPGM(MSG_Z2_MIN);
SERIAL_PROTOCOLLN(((READ(Z2_MIN_PIN)^Z2_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif
----------------------------------------------------------------------------------------------------------------------------
Note:
Adding Z2min to the M119 End Switch report allows a good testing all endstop sensors.
It is also very good to show how M666 endstop adjustment works.
After a normal home you can see both Z1min and Z2min are triggered.
Give a M666 g-code with a plus or minus figure and then do a Z home and you can see how either Z1min or Z2min is trigged and the other Zmin is open.
I changed my Marlin Endstop “Open” message from ‘Open” to “ - - - “ as I think “Open” is a bit confusing as if using a switch it may in fact be closed.
Using “ Un-triggered” is more correct but I found using ‘- - - “just looked better.
Better to have switches closed when away from home as less chance to get electrical noise that may cause a false home detect.
---------------------------------------------------------------------
Sketch: language.h
Description: If using another language you may need to change that as well.
Line 155
#define MSG_ENDSTOP_OPEN "- - -"
================================================================================================
Something else that can be added for M119
Found this to be good to have added to Marlin when using a filament present switch (filament runout) for M119 reporting.
Sketch: Marlin_main.cpp
Description: M119 is used to report status of endstop switches. It can be edited to report additional switches like the filament present switch.
Line: 3887
Code added:
#if HAS_FILRUNOUT
SERIAL_PROTOCOLPGM(MSG_FILAMENT);
SERIAL_PROTOCOLLN(((READ(FILRUNOUT_PIN)^FIL_RUNOUT_INVERTING)?MSG_FILRUNOUT:MSG_FILRUNIN));
#endif
Sketch: language.h
Description: If using another language you may need to change that as well.
Line: 145
Code added:
#define MSG_FILAMENT "Filament: "
#define MSG_FILRUNOUT "Out "
#define MSG_FILRUNIN "Present “
--------------------------------------------------------------------------------------------------------