Introduction: Dual Z Max and Probe for Z Min
So, you've got a printer with dual Z endstops and you want to use a probe but keep the endstops. The main use case scenario for this is to have auto gantry levelling and still get a good first layer using the probe on the bed. I have a heavily modified CR-10. It homes to Z-Max and then comes down to Z-Min to probe and start printing. It uses belts on the Z axis and MGN15H Rails and MGN15C blocks on Z and X axis. As the belts are not linked in anyway I had to find a way to get the X Gantry level. You can use the drivers or board you want - the process should be similar irrespective of board as long as you are using Marlin.
Step 1: Software!
First step is getting the correct software!
If you are on Linux or Mac then I have no idea sorry! But for windows we need VSCode, Marlin 2.0x Bugfix, Platform IO and Autobuild Marlin.
VSCode - https://code.visualstudio.com/download
Marlin 2.0x Bugfix - https://marlinfw.org/meta/download/
Firstly we will install VSCode. After installation has finished we can finish preparing and finalising the IDE (Integrated Development Environment).
Launch VSCode and go to the Extensions tab (second picture, yellow arrow) and search for PlatformIO. Install this and restart VSCode. Now go back to the Extensions and search for Marlin Autobuild and install this. Now close VSCode
Extract your Marlin source to the root of C/D Drive, or whatever drive you will be using - I recommend using the root to avoid any further complications.
Open the marlin Bugfix 2.0x folder, right-click, and select "Open with Code"
This should launch VSCode with Marlin loaded! (3rd Image)
Step 2: Start Configuring Marlin - Endstops & Drivers
Now comes the fun part - configuring Marlin!
I am working on the assumption you know how to configure Marlin and I will only be covering the parts needed for Dual Z Endstops and Z-Min-Probe. We will be mainly working in Configuration.h and Configuration_adv.h
Open Configuration.h in VSCode from the left hand panel, images 1 and 2 above
Endstop Settings
Scroll down to the Endstop Settings and we will enable/uncomment (remove the // at the start of lines, Image 3)
YMAX_PLUG
ZMAX_PLUG
If you scroll further you will come to Endstop Inverting - Depending on your endstops these may be true or false. If you are unsure leave it as it is and you can check it using M119 through Pronterface or Arduino Terminal once the firmware is uploaded. On mine the endstops being used are all "true" (Image 4).
Driver Selection
Marlin has a wide selection of drivers available. Select the drivers you will be using here. Yours may differ from mine, but the process is the same. (Image 5)
Step 3: Configuring Marlin - Z_Probe and ABL
We need to configure the Inductive sensor to probe the Z-Min - AKA the build plate. Scroll down Configuration.h until you reach the Z Probe Options. Here we will enable/uncomment (Image 1)
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
If you scroll further down you will select the probe you have - As I am using an inductive probe I selected (Image 2)
#define FIX_MOUNTED_PROBE
AND even further down you will need to enter your probe offset from the nozzle - once again, your values will differ from mine but the process is the same (Image 3).
#define NOZZLE_TO_PROBE_OFFSET { -36, 0, 0 }
I like to use multiple probing for the points for extra accuracy so you can enable this option if required. This can be found a bit further down Configuration.h (Image 4)
#define MULTIPLE_PROBING 2
Next we will set the Z Homing direction. It is set to -1 as standard. As I will be homing to Z Max I set this to 1 (Image 5)
#define Z_HOME_DIR 1
Now onto the final parts in Configuration.h - Setting of the ABL in use. I tend to use Bilinear Bed Levelling with 5 x/y probe points and Bilinear Sub-Division Turned on (Image 6, Image 7 and Image 8)
#define AUTO_BED_LEVELING_BILINEAR
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
// Set the number of grid points per dimension.
#define GRID_MAX_POINTS_X 5
#define ABL_BILINEAR_SUBDIVISION
This is configuration.h now set for Dual Z Endstops and Z Probe
Next we jump into Configuration_adv.h!
Step 4: Configuring Marlin - Configuration_adv.h
Now we move onto Configuration_adv.h!
In VSCode select Configuration_adv.h.
Just 1 or 2 changes needed here - set the number of Z motors to 2 and assign the second Z motor to YMAX Endstop (Image 1)
Change
#define NUM_Z_STEPPER_DRIVERS 1
to
#define NUM_Z_STEPPER_DRIVERS 2
Enale/uncomment
#define Z_MULTI_ENDSTOPS
and finally change _XMAX_ to _YMAX_
#define Z2_USE_ENDSTOP _YMAX_
Now we will save all changes, by selecting the "File" the "Save All"
Now, as long as the rest of your configuration is correct we will launch Autobuild Marlin
Step 5: Marlin Autobuild!
I have not covered a full setup of Marlin here and am working under the assumption you know how to setup the basics like the board, serial ports, Hotend/Heatbed PID, Stepper motor direction etc.
In VSCode on the far left panel select Marlin Autobuild and then "Show ABM Panel" (Image 1). This will launch the Marlin Autobuild. Check all the details are correct board type etc and click Build! (Image 2). If no errors are found you should see "Success" in the terminal below (Image 3). The compiled firmware can be found in the Marlin Source Directory in the PIO/Build Folder (Image 4). It should be named firmware.hex. This can be uploaded using Xloader.
The next tutorial will be using Pronterface to carry out some initial testing prior to our first print!