Design a site like this with
Get started

Smarter bed probing

The problem

Using a probe to measure where the print surface is, and to compensate for imperfections is handy. But often the probe isn’t probing the actual position the printer is going to use, and because of that there might still be a valley between two probing points, depending on how many points you have set it to measure.

First attempt

My first idea were to do a google search, and it gave me a solution. A script written in python which would detect the minimum and maximum position in X and Y, and then use those values to replace the M557 line with one with the new values in. After running the postprocessing script I tried to print, and it worked! The probe were probing where the part would actually be printed on the bed.

My attempt

While the script worked, I had a feeling it must be possible to do it more easily, so I started looking around in the documentation for PrusaSlicer, which is the slicer software I use for my 3d printers.

On their site I found a placeholder called first_layer_print_max and first_layer_print_min, and they sounded like they would contain the exact values I needed. After a few attempts I could confirm they were exactly what I needed, and I could put a line together to probe only that area.

My first attempt was this, and it worked as intended. It probed the area in a 3×3 grid, and the print came out perfect.

M557 X{first_layer_print_min[0]}:{first_layer_print_max[0]} Y{first_layer_print_min[1]}:{first_layer_print_max[1]} P3:3

New problem…

However, the way the probe is mounted on my printer, it can’t reach all corners, and in some cases some points would be skipped because it were unable to reach the position.

To combat this I added a bit more to constrain the values within the limits of my printer, and that ended up looking like this.

M557 X{max(first_layer_print_min[0],42)}:{min(first_layer_print_max[0],215)} Y{max(first_layer_print_min[1],10)}:{min(first_layer_print_max[1],200)} P3:3

When probing my printer can reach down to X42 and up to X215, while Y can reach from Y10 to Y200.

Adding these makes it probe the bed as close as it can to the active print area, without skipping some points because they are out of reach.

Start gcode

To make this work with RepRapFirmware, I had to put this into my start gcode, where it usually probe the bed.

M557 X{max(first_layer_print_min[0],42)}:{min(first_layer_print_max[0],215)} Y{max(first_layer_print_min[1],10)}:{min(first_layer_print_max[1],200)} P3:3
G29 ; Probe print surface
G29 S1 ; Use height map


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: