In earlier posts in this series, I described how to install and connect Duet electronics on a Mini Kossel, how to install and configure the firmware, and how to calibrate the printer. In this post I cover using a Z probe.
Z probe types
My fork of RepRapFirmware currently supports the following types of Z probe:
- Type 1: Any probe that produces an analog signal that increases as the head nears the bed. This includes an unmodulated IR sensor – although don’t recommend these, because of their sensitivity to ambient infrared light. Better is my own infrared sensor, which not only modulates the IR but uses dual infrared beams so as to be mostly insensitive to the reflectivity of the bed. It could also be used with FSRs in the bed supports, wired in a potential divider configuration so as to provide a voltage that increases as the load on the bed increases.
- Type 2: a simple modulated infrared sensor. The Duet will output a modulation signal to turn the IR emitter on and off.
- Type 3: as type 1 but the control signal is driven low instead of high. This allows you to have two different Z probes and to switch between them.
- Type 4: a microswitch wired to the E0 endstop pins of the Duet. The switch should be closed when the Z probe is deployed but not touching he bed, and open when the probe is deployed and pressed against the bed. For safety, when the probe is not deployed, it should be open.
The type of Z probe is defined by the P parameter in the M558 command in config.g. The config.g file in my repository uses P4, which is suitable for the original microswitch Z probe on the Mini Kossel. If you are using a different type of Z probe instead, replace P4 by P1 or whatever is appropriate, and connect it according to the installation instructions.
You should set the Z probe X and Y offsets to zero in the G31 command in config.g. This is because when using the Z probe for delta calibration, the position of the head matters more than the position of the probe. The P parameter in the G31 command is the trigger threshold, and should be set to 500, for both my IR probe and a switch. If you are using a different sort of IR probe, you may need to use a different threshold.
Before using the Z probe, you must set the homed height parameter in the M665 command in config.h to be within a few mm of the correct value. To do this, home the printer, then command it to a suitable height, for example send G1 X0 Y0 Z20. Measure the height of the nozzle above the bed. If it is not close to the height you chose (20mm in this example), adjust the H parameter in the M665 command accordingly.
Calibrating the Z probe
You can view the output of the probe in the web interface, or by sending G31 without any parameters via the USB port. The Z probe reading is a value between 0 and 1023. If it is a switch, the reading should be 0 when the probe is deployed but not touching the bed, and 1000 when it is either not deployed, or deployed and touching the bed sufficiently to activate the switch.
To test the Z probe, home the printer, lower the nozzle until it just grips a sheet of paper between it and the bed, then send G92 Z0 to define that point as Z=0. Raise the head a few mm and deploy the probe manually if necessary. Check that the Z probe reading is lower than the threshold you configured in your G31 command. Then lower the head further in small increments. Before the nozzle touches the bed (or just after if you are using FSRs in the bed supports), the reading should increase to above the threshold. Make a note of the Z height at which this happened. Then put this figure in the Z parameter of the G31 command in config.g.
Tuning the Z probe deployment and retraction routines
If you have the standard Mini Kossel mechanical Z probe, then you may need to adjust the locations used for probe deployment and retraction. These are contained in files sys/deployprobe.g and sys/retractprobe.g on the SD card. If you do not already have these on the SD card, you can upload them using the “Upload config file” button in the Settings tab of the web interface.
To test probe deployment, home the printer and then run this command:
The head will move close to the Z tower and then past the Z tower belt to deploy the probe. If necessary, edit the contents of deployprobe.g to adjust the starting location and the amount of movement.
With the probe deployed, run command:
This should move the probe over the post and push it down to retract it. Depending on the position of the post in your build, you may need to adjust the position and/or the height that the head moves down to.
4-factor fast auto calibration (endstops + delta radius) is supported starting at version 1.00f of my RepRapFirmware fork. 7-factor auto calibration (endstops, tower positions and diagonal rod length) is supported from version 1.04c onwards. To run it, simply heat the bed and hot end to operating temperature, and ‘print’ the appropriate auto-calibration gcode file. I provide a selection in my repository. I suggest you use either bed10-6.g (10-point probing for 6-factor calibration), or bed10-7.g (10-point probing for 7-factor calibration).
If your printer is not a Mini Kossel, you will need to edit your chosen auto calibration file, to change the probe coordinates to appropriate values for the size of the bed on your machine.
When you run the auto calibration file, it first clears any bed compensation and homes the printer. Then it deploys the probe. It does a dummy probe at the centre first, because I have found that the mechanical probe gives a less accurate reading on the first probe after deployment (you may wish to remove this if you are using a different type of probe). It probes a number of points, depending on which file you selected. It then does two Newton-Raphson iterations of a least-squares minimization process, prints the parameters it found (look in the Message tab if you are using the web interface), and retracts the probe.
You can read more about how the auto calibration works and how to tune it for your printer here.
Having chosen the auto calibration file you want to use and edited the coordinates to suit your printer, copy it to /sys/bed.g on the SD card. It will then be run in response to a G32 command.
Setting the height at the start of a print
I also provide a file called setheight.gcode in the /gcodes folder. This deploys the probe, does a single probe to determine an accurate height, then retracts the probe. For accurate results, heat the bed and hot end to operating temperature first.
You may wish to incorporate the contents of setheight.gcode in the start gcode of your slicing program. Or you can run G32 auto calibration whenever you use your printer, as I do.
A note on extruder mot0r current
I had a recurring problem on my Mini Kossel, where the extruder drive would sometimes stop feeding filament. On inspection, I found that it had chewed through the filament. I tried various settings of the clamping screws on the extruder drive, to no avail. I never had this problem on my Ormerod, so I was starting to wonder whether it was a feature of the extruder design on the Mini Kossel.
Then it occurred to me that on the Ormerod, I hear the extruder motor skipping steps when it can’t push the filament hard enough; but I never heard this on the Mini Kossel. It dawned on me that the Mini Kossel has a longer and more powerful extruder drive motor than the Ormerod, and the key is to reduce the stepper motor current, so that the motor skips steps before the extruder chews through the filament. I have turned the extruder stepper motor current down to 500mA, and all is now well.