We’ve promised that we would start publishing dev diaries to give you a unique opportunity to see what’s happening “behind the curtain” – and here’s the first one! Today, we’ll take a look at the Mesh Bed Leveling routine and the changes we made in recent firmware releases. This includes the new community-requested 7×7 Mesh Bed Leveling.
7×7 Mesh Bed Leveling and how we tackled it
We’ve been using a 3×3 Mesh Bed Leveling (MBL) on our printers for a long time. What does it do? The P.I.N.D.A. probe measures the distance from the steel sheet in nine locations across the print area (a grid of 3×3 points). It creates a virtual 3D map of the sheet and allows the printer to compensate for an uneven surface. However, around six months ago, our community started to point out that apparently, 7×7 calibration gave improved results. Also, 7×7 pull requests appeared on our Github. We started to investigate the situation because the procedure is more complex than a simple increasing the number of measurement points.
What we needed was hard data – real measurements and performance tests. Therefore, we first decided to accurately measure the quality of MBL algorithms using a dial gauge – and not just visually on a test model.
So we assembled a set of special firmware versions, each containing one implementation of MBL (external pull requests from external contributors and our own implementation).
All testing firmware samples had the automatic distance measurement validated using a digital dial indicator. Specifically:
- Original Prusa FW with MBL 3×3
- FW by stahlfabrik with MBL 7×7 support
- FW by mionut with MBL 7×7 support
We used a special G-Code to activate the dial indicator measurement. The G-Code template is G78 Aaaa Bbbb Cccc Dddd Eeee Ffff, where:
- aaa is the x-axis width of the measured area
- bbb is the y-axis width of the measured area
- ccc is the number of points in the x-axis
- ddd is the number of points in the y-axis
- eee is the offset in the x-axis
- fff is the offset in the y-axis
Example: G78 A205 B200 C3 D3 E0 F0
Measured deviations were automatically recorded onto an SD card for further processing.
Our testers performed a set of measurements on the selected set of printers/firmware and the results of the first weren’t overwhelmingly conclusive. The accuracy was about 20-30 % better compared to 3×3 MBL. We did not feel that 7×7 is a major improvement, considering all the factors.
Firmware results Comparison
The biggest difference in actual deviation in millimeters (smaller numbers mean a better accuracy):
|Firmware name||Without MBL||With MBL (3×3)||With MBL (7×7)|
|Prusa||0,704 – 0,711||0,254 – 0,262||N/A|
|stahlfabric||0,690 – 0,701||0,247 – 0,265||0,189 – 0,197|
|mionut||0,694 – 0,703||0,232 – 0,263||0,180 – 0,194|
Through another analysis, we found out that it’s necessary to minimize the measurement error with repeated measurements using the P.I.N.D.A. sensor. Therefore, there are repeated distance measurements during MBL process – typically 3 to 5 in one location. The higher number of measurements increased the accuracy by a small margin, but the expected error rate below 0.05 mm still seemed unreachable.
Another thing is, the P.I.N.D.A. sensor sensitivity is highly temperature-dependent. In the current version, it’s supplemented with a thermistor that allows the detected magnetic field level to be compensated.
And then there was another issue – the magnets in the heatbed. These can throw off the readings, so we had to find a way around it. Our MBL avoids the magnets because the firmware contains information about exact locations of all the measurement points – in other words, we’re not using a regular 7×7 grid.
The need for speed
We’re pretty sure you’ve figured one rather annoying thing about 7×7 measurements already. The original 3×3 measurement took 17 seconds to perform. Now there were five times more points to measure – quite inconvenient. This is why the printer with 7×7 MBL is performing a “tapping” routine instead of the old measuring movements. The extruder won’t rise higher when the measured values are within internally set limits. It’s up to you how many measurements you want to perform in a single location (we recommend a minimum of 3 and up to 5 for maximum accuracy).
So what happens if the measured value is out of bounds? The printer will try to correct the situation automatically – it will move the extruder up and slowly down again, which is the original measuring procedure. Only if this doesn’t help, it’s necessary to perform Z-leveling. By the way, there was at least one surprising observation during testing: if there are two printers placed next to each other on a shelf, the vibration of the first one could throw off the MLB on the other one. However, this situation can be also solved by running the slower measurement routine.
Here’s the comparison of MBL times for the various number of points:
- 7×7 points, 5 measurements – 56 seconds
- 7×7 points, 3 measurements – 46 seconds
- 3×3 points, 3 measurements – 17 seconds
56 seconds may seem like a rather long time, when you’re standing next to the printer, waiting for it to start printing the first layer. However, when you are starting a several-hours-long print job, this number becomes almost insignificant. In return, you will get better printing performance, especially if your steel sheet is not 100% perfect.
We have also confirmed, that the results are not dependent on the target surface temperature. Our community developed a visualization plugin for OctoPrint called PrusaMeshMap. You can see an illustration of measurements on a pre-heated bed below.
7×7 MBL brings improvements that we could measure and verify, however, they are not really game-changing ones. We assume that when it comes to printers with a different print bed design (where greater local deformation may occur), the improvement would be more noticeable. Even so, considering the fact that printing times are usually hours, not minutes, the one-minute delay at the start (when using the maximum number of measurements) doesn’t matter that much.
You can select between 3×3 and 7×7 MBL in Settings/Mesh Bed Leveling menu.
The improved Mesh Bed Leveling is just one of many changes we have implemented since the launch of the MK3/S – and we’re still planning new additions, tweaks, and updates. Do you want to know what we are cooking?
- First Layer Calibration with materials other than PLA
- localization fixes
Firmware 3.9 (November 2019)
- Linear Advance 1.5 with backwards compatibility with older G-Codes – developed in cooperation with our community
- Plenty of UI tweaks, overall improvements
- Improvements to the filament sensor – a higher level of control
We’re also focusing on many other areas, e.g. crash detection in Y-axis when printing with ASA, decreasing the temperature of the extruder motor when printing with PLA, and more. Stay tuned and don’t forget to update your printer’s firmware regularly!
Also, let us know if you like our dev diaries and what would you like to read about!