Auto Bed Leveling
An old article about Marilin auto bed leveling.
Brief
Most 3D printers come with uneven printing bed. That is the mainly reason of printing failure and frustrated us a lot. Fortunately. Marlin firmware saved us by auto bed leveling (ABL). Even though, ABL is still tricky and needs a lot of patience. Here is my experience about tuning ABL.
- Installing of Auto Bed Leveling Sensor
There are several options for : UBL Touch, Servo+ Probe, and fix mounted Probe. UBL Touch is the best choice for now, can fix any surface. But it is also a little bit complicated. Servo + Probe is better. The Fix mounted Probe, for all budget concerning, works fine. If being fine tuned, it can get great result as well. This is also what we will discuss today. Probably you need modify your printer or print some parts for mounting Z probe. Usually, we use Inductive proximity Sensor LJ12A3-4-Z as the a probe which has a working range about 3mm. I heard there is a long rang sensor LJ12 A3-8-Z, which has I mm effective distance. Make sure the sensor is mounted firmly and most Important: adjustable, then we can go to next step.
- Configuration
Of course you already downloaded the Marlin firmware source code and Arduino IDE, and you also know how to make changes to Marlin firmware.
Here are some changes we should make :
- Enable EEPROM Writing
Enable EEPROM writing for saving the tuning parameter. Otherwise, you have to retune ABD after reboot.
#define EEPROM_SETTINGS
-
Enable Auto Bed Leveling
By uncommenting AUTO_BED_LEVELING* defines, choose the ABD option you want. I chose Bi-linear:
NOTE: you can choose only one ABL method.//#define AUTO_BED_LEVELING_3POINT //#define AUTO_BED_LEVELING_LINEAR #define AUTO_BED_LEVELING_BILINEAR //#define AUTO_BED_LEVELING_UBL // #define MESH_BED_LEVELING
-
Configure Auto Bed Leveling Grid
By default, the default grid has a 3x3 matrix which is good enough for us.
#define GRID_MAX_POINTS_X 3
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
-
Configure Range of Grid
Also, the boundaries of grid should be configured. Default right and back boundaries are 170. For customized printers, we could change it like this:// Set the boundaries for probing (where the probe can reach). #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION (X_MAX_POS - LEFT_PROBE_BED_POSITION) // default is 170 #define FRONT_PROBE_BED_POSITION 20 #define BACK_PROBE_BED_POSITION (Y_MAX_POS - FRONT_PROBE_BED_POSITION) // default is 170
The front and left positions are ok.
Save your changes, compile and update your printer firmware.
-
Z Axis Tuning
Before power on your 3D printer, make sure the Z sensor is at safe position: lower than the nozzle a little bit. Don't perform homing now, move z axis manually until the bed touches the sensor gently. Now power on the printer, the sensor is triggered. Then lift the sensor up a little bit higher, until it is higher than nozzle. Keeping the sensor triggered, and try your best to get the vertical distance between the sensor and the nozzle as far as you can. Now home the printing head. The bed should not hit the nozzle. -
Auto Bed Leveling First Run
Now runAuto Bed Leveling
from control panel or, unfortunately you couldn't find any menu item for it like me, run it by G-code. The printer will performABL
. Until now, the result ofABL
is not suitable for printing. We need do more work. -
G-code You Must know
We should know some G-code for fine tuningABL
. CheckMarlin
's website for more information aboutG-code
.
Here are someG-code
we will use: -
G29
PerformAuto Bed Leveling
.G29
has some parameters but bareG29
is enough for us. -
M420
Apply the result ofABL
. For example,M420 S1
uses the result of lastABL
. -
M851
Adjust the offset between nozzle(or extruder) and sensor. We will use this code to fine tune. -
M500
Save our works. It only works when enabled EEPROM writing, which is disabled by default. -
Auto Run ABL
The slicing software should provide a interface for editing start code and end code, which will be attached to very beginning and end of slicing G-code. We can addG29
to start code to make theABL
run automatically before printing.
I useCura
, so my start code looks like this:G28 ;Home G1 Z15.0 F6000 ;Move the platform down 15mm ;Prime the extruder G92 E0 G1 F200 E3 G92 E0 M106; cooling the model with breeze G29 P3 ; Run ABL M420 S1 ; Apply the ABL
- **Adjust Z Offset**
By watching the processing of first running of `ABL`, you should notice the gap between nozzle and bed. According the `A4 paper rule` about the best distance between nozzle and bed, the gap is too big for printing. We could adjust this by changing the source code or by running G-code, either way works. But changing source code is less flexible, you have to compile and update firmware repeatedly. By G-code you can get result immediately.
Estimate the gap by eyes, let's say it's 0.5mm, closing the gap but not too closing: we don't want the nozzle to hit the bed, an aggressive estimate will do. Because we are using the Inductive Proximity Sensor, the offset should be positive.
For UBL touch or Servo + Probe, we probably use a negative value.
Changing source code:
```cpp
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0.5 // Z offset: -below +above [the nozzle]
Or running G-code:
M851 Z0.5
The offset will be used for next printing: the nozzle is 0.5mm closer to bed when printing. By printing a model, we will see the result. Prepare a thin, crossing most of main bed area frame model to get better testing result.
- Fine Tune Z Offset
Now print the test model, watch the printing of first layer. Usually, we will find the nozzle is still a little bit far from bed. This time we increase 0.05 to the offset, to make nozzle closer to bed.
Run G-code:
M851 Z0.55
Then re-print our test model and checking the printing. Keep trying to find a best value for offset. If the nozzle touches the bed too close to extrude the filament, decrease the offset value.
Finally, we could get a acceptable value.
- Save Result
Save our effort into EEPROM, next time the printer will use it automatically:
Run G-code:
M500
- Ready To Go
Now your 3D printer is ready for use, enjoy the burning of filament!
Good luck!