Welcome! Log In Create A New Profile


auto bed leveling

Posted by Eqpirate07 
auto bed leveling
December 31, 2014 03:31PM
Hello everyone!

So I just finished putting together my auto bed leveling stuff for my prusa I3. I have the auto bed level setup where the zprobe swings down from a servo mounted to the extruder and then probes the bed in 4 corners. right now after attaching the servo plate to the extruder, the extruder sits about 2mm above the bed, whereas with the stock plate it was configured to put the extruder right down to the bed so that it can print. with the auto bed leveling enabled this new difference should be compensated for. It took me about three days working in my spare time trying to get everything set up and configured properly. today I finally homed my x, y, and then z axis, and preformed the G29 command to run the auto bed level, and it worked!!! I feel like everything is all in place now and ready to start printing. However, I am lost as to how to implement this feature into my prints! I usually put my gcodes from slicer onto a sd card and pop it into the lcd on my printer and fire away. Is this still possible with the auto bed leveling or do I still need to have pronterface open to make the changes for the bed being unlevel before a print? I added the home gcodes and G29 to my custom gcodes on slicer so that when I start a print it will home, then probe the bed. that all worked perfect but when it went to go start printing, the extruder was still about 2mm above the bed! I feel like it didn't even implement the new measurements for the bed after probing to auto level it.

Any help on what to do with all this would be great!

Thanks in advance,

Re: auto bed leveling
December 31, 2014 06:34PM
So, first of all.
To implement the code in the slicer software, you have to edit the start gcode file in your slicing program. For Slic3r, the start gcode will look something like this
G21; set mm units
G92 E0; reset extruder distance 
G90; set absolute coordinates 
G28; home all axes 
G1 Z5; lower platform 5mm to clear bed in case of improper leveling 
G1 X100 Y100 F3000; move extruder over bed center 
M104 S195; set extruder temp to 195°C and start heating 
M109 S195; wait for target extruder temp to be reached 
G1 Z[first_layer_height]; Move Z to first layer height.
You want to find where it says
G28 X0 Y0 Z0
or something like that. You want to replace it with
That should do it! To test if you are having problems with the inaccuracy of the Z-probe, and assuming that your printer's running Marlin, you can use
M48 n15 X100 Y100 e
Make sure you have the letter cases right, and that should probe the bed 15 times, raising and lowering the z-probe each time, then give you the standard deviation of the set of points. It might take a second or two for the printer to respond to the command. Homing any axis after the
will reset the bed leveling matrix, so that might be your problem. Also, you can just play around with the z-probe offset in Marlin until you get it right. As long as the Gcode file has the commands, you can use a SD card. Good luck!
Re: auto bed leveling
December 31, 2014 10:22PM
so as it is right now, my start gcode has:

G21 ; set units to millimeters
M140 S85 ; set bed temp
M104 S235 ; set temperature
G28 X0 ; home x axis
G28 Y0 ; home y axis
G28 Z0 ; home z axis
G29 ; auto bed level
G1 Z5 F5000 ; lift nozzle
M190 S85 ; wait for bed temp
M109 S230 ; wait for temperature to be reached
G90 ; use absolute coordinates
G92 E0
M82 ; use absolute distances for extrusion

I used this to print and it didn't implement the new bed at all, it was still too high.

maybe I need to set the z higher to be lower than the actual bed and it will work?
Re: auto bed leveling
January 03, 2015 02:27AM
or should I say how do I check to make sure that it uses the new bed measurements after running g29?
Re: auto bed leveling
January 03, 2015 09:40AM
g29 uses probe data, and recalculates z height, g28 homes and resets all values. for probing to work correctly use g29. offsets for z height when probe retracted should be calculated by settings in firmware.

the settings in firmware may be what you need to change

there is no need for g28, after g29

do you only have a probe for z, or do you have a limit switch for z as well. normally home z to the highest z home limit switch, then go down to say 15mm to 20mm and then run g29.

it is easy to see if the settings are accepted. since bed is not likely 100% level, you will see z axis constantly adjusting.

if you want to check if bed is level just type in G1 Z0 F100 . the bed should go down to zero. or just type in M114 and look at log.M114 tells you current machine positioning.

Instructions for configuring Bed Auto Leveling
There are two options for this feature. You may choose to use a servo mounted on the X carriage or you may use a sled that mounts on the X axis and can be docked when not in use.
See the section for each option below for specifics about installation and configuration. Also included are instructions that apply to both options.

Note for RAMPS users:

By default, RAMPS have no power on servo bus (if you happen to have a multimeter, check the voltage on servo power pins).
In order to get the servo working, you need to supply 5V to 5V pin.. You can do it using your power supply (if it has a 5V output) or jumping the "Vcc" from Arduino to the 5V RAMPS rail.
These 2 pins are located just between the Reset Button and the yellow fuses... There are marks in the board showing 5V and VCC.. just connect them..
If jumping the arduino Vcc do RAMPS 5V rail, take care to not use a power hungry servo, otherwise you will cause a blackout in the arduino board ;-)

Instructions for Both Options

Uncomment the "ENABLE_AUTO_BED_LEVELING" define (commented by default)

The following options define the probing positions. These are good starting values.
I recommend to keep a better clearance from borders in the first run and then make the probes as close as possible to borders:


A few more options:

* \#define XY_TRAVEL_SPEED 6000

X and Y axis travel speed between probes, in mm/min.
Bear in mind that really fast moves may render step skipping. 6000 mm/min (100mm/s) is a good value.


The Z axis is lifted when traveling to the first probe point by Z_RAISE_BEFORE_PROBING value
and then lifted when traveling from first to second and second to third point by Z_RAISE_BETWEEN_PROBINGS.
All values are in mm as usual.

Servo Option Notes
You will probably need a swivel Z-MIN endstop in the extruder. A rc servo do a great job.
Check the system working here: [www.youtube.com] (Enable English subtitles)
Teasing ;-) video: [www.youtube.com]

In order to get the servo working, you need to enable:

* \#define NUM_SERVOS 1 // Servo index starts with 0 for M280 command

* \#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1

* \#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 165,60} // X,Y,Z Axis Extend and Retract angles

The first define tells firmware how many servos you have.
The second tells what axis this servo will be attached to. In the example above, we have a servo in Z axis.
The third one tells the angle in 2 situations: Probing (165º) and resting (60º). Check this with command M280 P0 S{angle} (example: M280 P0 S60 moves the servo to 60º)

Next you need to define the Z endstop (probe) offset from hotend.
My preferred method:

* a) Make a small mark in the bed with a marker/felt-tip pen.
* b) Place the hotend tip as *exactly* as possible on the mark, touching the bed. Raise the hotend 0.1mm (a regular paper thickness) and zero all axis (G92 X0 Y0 Z0);
* d) Raise the hotend 10mm (or more) for probe clearance, lower the Z probe (Z-Endstop) with M401 and place it just on that mark by moving X, Y and Z;
* e) Lower the Z in 0.1mm steps, with the probe always touching the mark (it may be necessary to adjust X and Y as well) until you hear the "click" meaning the mechanical endstop was trigged. You can confirm with M119;
* f) Now you have the probe in the same place as your hotend tip was before. Perform a M114 and write down the values, for example: X:24.3 Y:-31.4 Z:5.1;
* g) You can raise the z probe with M402 command;
* h) Fill the defines bellow multiplying the values by "-1" (just change the signal)


Sled Option Notes
The sled option uses an electromagnet to attach and detach to/from the X carriage. See [www.thingiverse.com] for more details on how to print and install this feature. It uses the same connections as the servo option.

To use the sled option, you must define two additional things in Configuration.h:

* \#define Z_PROBE_SLED

Uncomment the Z_PROBE_SLED to define to enable the sled (commented out by default).

Uncomment the SLED_DOCKING_OFFSET to set the extra distance the X axis must travel to dock the sled. This value can be found by moving the X axis to its maximum position then measure the distance to the right X end and subtract the width of the sled (23mm if you printed the sled from Thingiverse).

Next you need to define the Z endstop (probe) offset from hotend.
My preferred method:

* a) Home the X and Y axes.
* b) Move the X axis to about the center of the print bed. Make a mark on the print bed.
* c) Move the Y axis to the maximum position. Make another mark.
* d) Home the X axis and use a straight edge to make a line between the two points.
* e) Repeat (b)-(d) reversing the X and Y. When you are done you will have two lines on the print bed. We will use these to measure the offset for the Z probe endstop.
* f) Move the nozzle so that it is positioned on the center point of the two lines. You can use fine movement of 0.1mm to get it as close as possible. Note the position of X and Y.
* g) Zero the Z axis with the G92 Z0 command.
* h) Raise the Z axis about 20mmm.
* i) Use the G32 command to retrieve the sled.
* j) Now more the X and Y axis to the position recorded in (f).
* k) Lower the Z axis in 0.1mm steps until you hear the "click" meaning the mechanical endstop was trigged. You can confirm with the M119 command. Note the position of the Z axis.
* l) Make a mark on the print bed where the endstop lever has touched the print bed. Raise the Z-axis about 30mm to give yourself some room.
* m) Now measure the distance from the center point to the endstop impact site along the X and Y axis using the lines drawn previously.
* n) Fill in the values below. If the endstop mark is in front of the line running left-to-right, use positive values. If it is behind, use negative values. For the Z axis use the value from (k) and subtract 0.1mm.

For example, suppose you measured the endstop position and it was 20mm to the right of the line running front-to-back, 10mm toward the front of the line running left-to-right, and the value from (k) was 2.85. The values for the defines would be:


That's it.. enjoy never having to calibrate your Z endstop neither leveling your bed by hand anymore ;-)
Re: auto bed leveling
January 03, 2015 01:21PM
Thank you James, I have everything set up correctly, I'm using a z max endstop and the z probe is my z min. I did notice that as a ran a dry practice print as the hotend was moving around my z rods were constantly spinning showing that the new compensation must have been accounted for so therefore the error must have been in my miscalculation of the distance between the hotend and the z probe. So last night I went and recalculated this distance and changed the settings in my configuration h file and it was a whole 1.6mm off, so I believe this was what was causing the issue. I relished the board with this change and am about to try a print! Wish me luck!!!!

Re: auto bed leveling
January 05, 2015 02:44AM
If you changed something and eeprom is active you should make a M502 and M500 to reload the coded settings.

Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Sorry, only registered users may post in this forum.

Click here to login