# Filament Leaking During Automatic Bed Leveling

Before the print has actually started I have set up Auto Bed Leveling using a BLTouch sensor, during the period that this runs I find that material leaks out of the nozzle and curls back onto itself and by the time it finishes it is substantial enough to cause problems when the nozzle is primed drawing the line to the left of the print. The material that leaks out catches on the material extruded to prime the nozzle, before printing the model so when the first line of the model are extruded to very quickly pulls up off the bed and becomes a massive tangle of material.

I try to catch it my self using various thin instruments to scrape it off the nozzle as it starts the priming but this isn't always successful and is far from ideal. I have also tried adding a retraction before the bed levelling starts suing the gcode commands added to the beginning of every print, at the moment however I find that a retraction large enough to stop the leaking material also means that material doesn't come out for the priming in time so the first lines of the print don't work.

The gcode at the beginning of the print is as follows:

; Ender 3 Custom Start G-code
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
G28 ; Home all axes
G1 F1800 E-3 ; Retract filament 3 mm to prevent oozing
G29 ; BLTOUCH Mesh Generation
G92 E0 ; Reset Extruder
G1 Z5.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z5.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed


I am using an Ender 3 running Marlin 1.1.9 with BlTouch Auto Leveling, With slicing done by CURA 3.5.6

Any suggestions you have that would help to stop this would be greatly appreciated.

• What do you mean by material doesn't come out for the priming in time? It is you that defines the priming in your "start G-code", do not solely rely on the skirt for priming. – 0scar Dec 31 '18 at 6:24

The oozing is due to hot-end getting hot before the bed leveling procedure: if you move the hot-end warm up command after the G29 line you avoid that oozing

; Ender 3 Custom Start G-code
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
G28 ; Home all axes
G29 ; BLTOUCH Mesh Generation
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
G1 F1800 E-3 ; Retract filament 3 mm to prevent oozing
G92 E0 ; Reset Extruder
G1 Z5.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z5.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed


The above code will activate the heating elements but starts homing and leveling procedure without waiting for the elements to get up to temperature. Only after the bed leveling is finished the printer will pause and wait for the heating elements reach the desired temperature.

This will prevent oozing on a cold start, but you will still be affected if you start a print right after another print, when the hot-end is still close to melting temperature.

If you prefer to avoid that condition you might want to also move the M104 and M140 commands after the G29 bed leveling command.

I have noticed that leveling with a heated nozzle and bed is different than leveling cold. If you want to level with a hot plate and nozzle, another more simple solution is to retract more filament at the finishing of a print, you could add an increased retraction of filament in the "end G-code" script of your slicer.

As an example, an "end G-code" script could look like:

M140 S0       ;heated bed heater off
M104 S0       ;extruder heater off
G92 E0 ; set extruder value back to 0
G1 E-5 F300 ;retract 5 mm filament speed 300
G1 X0 Y210  ; park the machine


Be sure to update the "start G-code" to counteract this retraction in your additional priming section of the nozzle.

...
; Prime the nozzle
G92 E0 ; set extruder value back to 0
G1 E5 F300 ; extract 5 mm filament at speed 300
; additionally, extract more at elevated height and wipe the nozzle...
...


Alternatively, but less accurate (as it does not compensate for layer height) is to have a minimum length of your skirt (this will work if you always use the same first layer height, just calculate how many millimeters you require for the skirt to compensate the retracted volume, you could add some extra distance to the skirt).

The best solution would be to heat the bed, but not the nozzle at startup. If you level with a cold bed, your ABL mesh is going to be off, since the aluminum heated bed plate expands considerably once the heat is applied.

You could also issue a retract command before leveling, and then add a counteracting filament feed command after ABL is complete. I have no idea how that code would look though. Just my 2 cents.