Comment on page
Bed Leveling & Probing
This page serves as an in depth guide to bed leveling. A good bed level will allow you to print a consistent first layer across the entire bed.
The Promega is equipped with two different Z-probes, an IR (infra-red) probe and a deployable endstop limitswitch. The default config.g file is set up to use the limit switch. This section covers the two different probes, their settings and how to use them. We recommend using the limit switch for less experienced users as it has proven to be more robust under many different circumstances.
G30: Commands the printer to perform a single z-probe. The z-height of your printer will then be set to the Z-offset as defined in
G30 S-1will cause the printer to perform a z-probe and print the trigger height but will not change the z-height of the printer, this can be used to find probe offset.
G31: Sets the z-probe status and offset, this changes depending on which probe you wish to use.
M558: Defines the z-probe type.
G29: Executes bed leveling as defined by
M557 Pnnn Xmmm Ylll: Defines the pattern that will be probed when
nnnrepresents the point number if you wish to perform single point probing. A better option is to define a mesh with
lllare the minimum values for each axis and
kkkare the maximum values.
jjjrepresents the interval over the area you just defined. A working
M557command for the Promega is:
M557 X50:370 Y10:350 S30.
G32will execute the bed.g file located in sys/ on the microSD card.
Warning: This limit switch is manually deployable. Remember to put the limit switch on the mount prior to probing, and remove the limit switch prior to printing or moving the bed to the nozzle.
Mounting the Limit Switch Probe
- 1.When mounted, the limit switch magnet should be firmly attached to the bottom of the mount as shown in the picture below.
- 2.Connect to the Duet Web Console. In the Machine Status table observe the Z-probe cell. Press the Z-probe switch and you should see this value change from 0 to 1000. If this is not happening, it indicates a problem with the wiring of the limit switch. Stop and fix the wiring before continuing with this guide.
- 3.In order to unmount the limit switch simply remove it from its mount and stick it above the nozzle. Stick the limit switch against the metal mount so that the limit switch is pressed down. Now if you accidentally send the command
G30with an unmounted z-probe, you will get an error: "Error: Probe already triggered during move" instead of a crash of the bed against the nozzle.
Limit Switch Configuration Settings
In the config.g configuration file you can set certain properties of the Z-limit switch. The commands
G31are the most important here. If you wish to enable the limit switch as your z-probe you have to enter the following commands into your config.g file:
M558 P4 I1 X0 Y0 Z1 H5 F100 T5000 ; Set Z probe type -- SET AS LIMIT SWITCH
G31 P999 X40 Y-28.5 Z5.8 ; Set Z probe (limit switch) trigger value, offset
These two commands enable and configure the Duet board z-probe. Remember that you must comment all other M558 and G31 commands in order for these commands to take effect. If you enter these commands in the configuration file and then enter the same commands for the IR probe 10 lines below, the board will be configured to use the IR board.
M558command above sets the Z-probe type.
P4parameter informs the firmware that the z-probe is a switch that is connected to the E0 endstop detection port.
I1inverts the reading on this port, the switch is wired as normally closed and therefore always outputs a value of 1000.
X0 Y0 Z1ensures that this limit switch is only used for homing the z-axis. Any non-zero value will enable homing on that axis.
H5sets the dive height of the probe. This defines the distance in mm that the probe will move after contact.
F100is the feedrate of the homed axis. Reduce this value to slow down the bed more as it moves to make contact with the limit switch.
T5000is the travel speed between probe points.
The G31 command sets certain z-probe settings such as offset and trigger height.
P999sets the trigger value to 999. Whenever the z-probe trigger value is reached the board will register a detection. For the limit switch this value should not need to change.
X40 Y-28.5 Z5.8Represents the offset of the z-probe to the nozzle, this value changes depending on which extruder you have mounted. If you have the K'Tana, the offsets of the z-probe to the nozzle are going to be different than the compound nozzle. It is also worth noting that the offset for the K'Tana nozzle is based on the right nozzle. The Z-offset to the z-limit switch varies per printer. We recommend that you tune your z-probe Z offset before printing. Follow the section below for calibrating the Z-offset of the limit switch.
Calibrating the Limit Switch
To find out the z-offset of the limit switch to the nozzle, follow the steps below. 1. Home the printer again, just to ensure you do not crash the printer throughout this process. 2. Print head to the center of the build plate by sending the command
G1 X187 Y1543. Heat up the bed to the preferred printing temperature. You can do this by sending the command
nnnis your temperature in °C. You can always look up the recommended bed temperatures for specific materials online. For PLA, a bed temperature of 50°C will work well. For ABS-R, a bed temperature of 60°C is recommended. 4. Wait until the heated bed has reached temperature before continuing. 5. Set the Z-probe offset to 0 by entering the command
G31 G31 P999 X-40 Y28.5 Z0. This will make it easier to gauge the distance between the Z-probe and the nozzle in the following steps. 6. Run the command
G29 S2. This clears any active bed leveling compensation. This is very important as it will conflict with your updated Z-probe offset and induce a 0.1 - 0.3mm error depending on the magnitude of your bed leveling compensation at that point. 7. Deploy your Z-probe 8. Check whether the Z-probe is functioning correctly. This is a great step to perform before using your Z-probe in order to prevent crashes. Press your Z-probe limit switch and observe the change in value from 0 to 1000 in the Duet Web Console Machine Status table in the Z-Probe box. If the value does not change the Z-probe is wired or configured wrong, do not continue to the next step!
- 1.Move the bed towards the nozzle by sending the command
G1 Z20. When you send the command
G30the bed will move slowly and precisely to the Z-probe, if you send
G30while the bed is at
Z100or greater you will have to wait for a long time for the Z-probe to trigger.
- 2.Run the command
G30. This will move the bed toward the z-probe until the limit switch triggers.
- 3.Now your Z0 is set to your Z-probe limit switches trigger height. This is because the Z-probe limit switch offset is 0mm. Now that we have set our Z0 to the trigger height we can move the bed toward the nozzle in order to find the distance between the trigger height of the Z-probe and the nozzle!
- 4.Retract the Z-probe.
- 5.Jog the bed up slowly toward the nozzle using the negative Z buttons in Machine Control on the Duet Web Console. Read the next step!
- 6.As you are moving the bed up towards the nozzle you will encounter an axis limit. These axes limits are set for the X, Y and Z axes and will stop you from moving past a certain coordinate. This will make it harder to crash the printer. However, in this case we know what we are doing so we can disable the axes limits. Send the command
M564 S0to disable the axis limits. To learn more about this command visit the RepRap G-code wiki.
- 7.Be careful when moving the bed close to the nozzle. Use the 1mm and 0.1mm buttons. Determining when the bed is touching the nozzle can be difficult. You might have to heat up the nozzle as you learned before in order to ensure that none of the filament from the hot-end gets in the way. Using a piece of paper to determine when the nozzle is touching the bed is also helpful. Grab a sticky-note or small piece of paper and place it under the nozzle. Then carefully jog the bed into the nozzle, move the paper back and forth. When you feel the nozzle grab the paper your nozzle is touching the bed!.
- 8.Record the Z-value that the printer is currently displaying in Machine Status. The absolute (non-negative) of this value is your Z-probe offset. It might be a good idea to write down this value.
- 9.Enter the command
G31 P999 X-40 Y28.5 Znnnwhere
nnnis your Z-probe offset.
- 10.Move the bed away from the nozzle
- 11.Deploy your Z-probe!
- 12.Send the command
- 13.Move the bed back up to the nozzle as described in the steps above. Your Z value should be 0 when the bed is touching the nozzle. If it is not you might need to tune the Z-probe offset or repeat the process.
- 14.In order for these changes to take effect permenantly, you will have to open up your config.g file and update the Z-offset of this command there. Follow the section below.
Troubleshooting the Limitswitch
The IR probe is located on the right side of the nozzle fan duct. The IR probe should be as parallel to the bed as possible. The IR probe functions by emitting Infra-Red rays (hence the name IR probe) at the bed and receiving them when they are reflected off a surface at a specific distance. Because not every surface is consistant, this detection height changes per surface. However, even variations within one surface can cause a difference in detection height. For example, glue from your previous print or a dirty print surface. This will all cause error and noise within your eventual bed level. We have found that this z-probe is very precise, but not always accurate. You will find that the limit switch is sometimes much better suited for some situations, such as a glass bed. While the IR probe is sufficient for others. For the best results we recommend a clean and dark surface such as a black print bed sheet. Follow the guide below for configuring your printer to use the IR probe.
Configuring the IR Probe
To use the IR probe a number of settings have to be changed in config.g. Ensure that the IR probe is parallel to the bed before using it. The following code should be entered or uncommented in config.g:
M558 P1 X0 Y0 Z1 H5 F120 T5000 ; Set Z probe type -- SET AS IR_PROBE
G31 P450 X-30.4 Y-30.7 Z2.6 ; Set Z probe (IR) trigger value and offset
Remember that it is best practice to comment or remove all other instances of these commands in the configuration file, this will prevent you from mistakenly configuring and enabling the other z-probe. This code is for the compound nozzle, to obtain this code for the K'Tana nozzle visit the M3D Promega GitHub Repository.
M558command above sets the z-probe type:
P1sets the z-probe type.
X0 Y0 Z1defines which axis this probe homes, any non-zero value enables that axis. In this case this probe only zeroes the z-axis.
H5configures the dive height to 5mm. The dive height is the vertical distance the bed moves between probe moves
F120sets the feedrate of the probe move.
T5000sets the travel feedrate, the speed of travel in between probe moves.
G31command sets the z-probe status:
P450sets the trigger value, for the IR probe this has to be less than ~500 or the z-probe will not trigger. Manually test the z-probe trigger value before changing!
X-30.4 Y-30.7defines the offset from the nozzle to the IR probe.
Z2.6sets the z offset of the IR probe. This will have to be changed whenever you change the mounting height of the z-probe or whenever you change print bed material.
Calibrating the IR Probe
To discover the z-offset of the IR probe to the nozzle follow the steps below:
- 1.Home the printer and move to
X200 Y200 Z50, probing in the center of the bed is the best idea as that is where the most printing occurs.
- 2.Heat up your bed and wait for it to reach temperature. Ensure that your print bed is clean. 3. Heat up your nozzle in order to remove any filament or debris on the nozzle tip.
- 3.Turn off bed leveling with
G29 S2, bed leveling can interfere with probing the bed.
Always disable bed leveling before probing or bed leveling, they will interfere with each other!!! <
- 1.Check that the z-probe is functioning correctly by manually jogging the bed to the nozzle. You should see the Z-probe value in the Duet Web Console Machine Status table change before the nozzle hits the bed. Remember the trigger value of the z-probe, this will vary per print surface.
- 2.Enter the command
G31 Pn Z1.0where
nis a value less than what you recorded in the previous step. The z-probe will trigger whenever it detects a value greater than
Z1.0represents a stop gap to prevent a crash if you do send
- 3.Jog the bed up until the bed is touching the nozzle, a piece of paper can help to determine when the nozzle is touching the bed. When the nozzle and bed are touching send command
G92 Z0. This will set the current z-height of the printer to 0.
- 4.Move the bed to
G1 Z20. 7. Send the command
G30 S-1this will print out the z-height of the bed when the probe is triggered. It will not update your z-height value. Record the value that is printed out. To ensure that you are getting consistent values, you can repeat this step multiple times. Move the bed to
Z20between every probe or you will get an error.
- 5.Send the
G31command with your z-probe offset value set to the value you obtained in the step above.
G31 P450 X-30.4 Y-30.7 Znnn,
nnnis the value from the step above.
- 6.If you want these changes to affect your board permenantly, then copy and paste the command above into your config.g file. Be sure to remove all other
G31commands or comment them.
- 7.You have now successfully calibrated your IR probe. Send the command
G30in order to probe the z axis. You can then move your bed up to your nozzle manually and verify that at
Z0the nozzle is touching the bed.
If you crash the bed into the nozzle it will cause the bed to skip and fall. After this happens your bed might no longer be level. Follow the steps below to skip a tooth on the bed in order to level it. Once the bed is level within ~3mm you can allow Mesh Bed Leveling to complete the rest.
- 1.Power cycle the printer and then turn it on. This will make it easier to manually move the motors.
- 2.Move the bed up to the nozzle. The best way to move the bed of the Promega is by holding the bed with both hands on either side in the center as shown below. If you want to stop your bed from falling down you can place a binder clip on the z-motor belt as pictured below.
- 3.Once the bed is at the nozzle, gauge the distance between the Z-slider and the top z-belt clamp as shown in the picture below. If one of these distances is greater than the other four it means your bed is not level. If you have a caliper you can measure the distance between the bed and each belt clamp corner.
- 4.Move the bed halfway down the printer. Hold the bed in place while gently pulling up on one corner. Keep pulling up until you hear a loud click and feel the bed move in that one corner.Be careful with the amount of force you apply as you can break the belts or belt clamps.
- 5.Repeat step 3 in order to check that your bed is now level. If it is not skip another corner of the bed.
- 1.Home the printer and heat up the bed to printing temperature. When the bed warms up it warps slightly. However, bed leveling compensation can compensate for this.
- 2.Define your mesh bed leveling grid with the
M557command. The config.g file should already have configured a working mesh:
M557 X50:370 Y10:350 S30. You can change the maximum and minimum values of the mesh as well as the interval but be careful as running G29 with a wrong mesh can crash your printer. Be sure to take the offsets of the z-probe as defined in
- 3.Disable any previous bed leveling compensation with the command
M561, they accomplish the same goal. If you do not disable previous bed leveling you will find that your next heightmap will be off by around +- 0.3mm.
- 4.Ensure that you have properly configured your z-probe as in the sections above. Test your z-probe before probing by triggering the sensor and observing a change in the Machine Status tab.
- 5.Make sure your bed is as level as possible. While bed leveling compensation can account for small variations in bed height it can't account for greater than 2-3mm.
- 6.If you are currently using the limit switch be sure to place it on its mount. If you are using the IR probe ensure that your bed is squeaky clean.
- 7.Send the command
G29 S0to execute bed leveling immediately or
G32which will execute bed.g. bed.g can be a simpler option in the long run as it can automatically heat up your nozzle and bed and define your mesh grid before.
- 8.The bed leveling procedure will generate a heightmap.csv file located in the sys/ folder. Once the bed leveling procedure completes it should display the heightmap. If this is not the case you can always go to Settings > System Editor and then click heightmap.csv in order to see your heightmap.
- 9.Once bed leveling completes it should have already enabled the compensation.
G29 S1enables compensation from heightmap.csv by default and
G29 S2disables compensation. In config.g you should have the command
G29 S1which enables bed compensation so you don't have to re-run the bed leveling procedure everytime.