Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

Robo 3d Auto Bed Leveling (Auto Bed Height Compensation)

by ZiggyRobo, published

Robo 3d Auto Bed Leveling (Auto Bed Height Compensation) by ZiggyRobo Apr 17, 2014


Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag


Thing Statistics

23356Views 1965Downloads Found in 3D Printer Parts



This thing is an implementation of the Marlin Auto Bed Leveling function on a Robo 3d printer. Of course this Z Probe design could be adapted to other printers.

This function really should be called something like Auto Bed Height Compensation, but regardless the function is a great improvement thanks to the efforts of the Marlin team. No more fiddling with that Z Axis height adjustment and no more having to finely adjust the bed level.

IMO this function in the new Marlin absolutely transforms the way the Robo 3d works.

Best of all is you can set the height of the extruder above the bed precisely and know that that height will be exactly the same every time. It is also very easy to vary the extruder height above the bed by changing the Z Offset value on the LCD controller motion control menu.

The bits to make the Z Probe are

  • Printed Z Probe frame
  • Opto endstop
  • Servo 9 gram model SG90 or equivalent
  • Printed servo horn
  • Brass rod 2.5 mm diameter (ends need to be cut square and flat).
  • Probe set screw collar (taken from a blue PCB screw terminal block as shown in the pictures and widely available on eBay)
  • M3 screws and nuts

The opto endstop is connected to the RAMPS Z endstop min pins on the RAMPS.

The servo is connected to the Ramps servo 1 pins. Power for the servo requires a jumper between the 5v and VCC pins on the Ramps near the yellow fuses.

The general steps to set Auto bed Leveling in Marlin RAMPS are here https://github.com/ErikZalm/Marlin.

The most critical parameter is


Measure this as described on the github/marlin site then make fine adjustments by printing/checking/adjusting until the height of the extruder above the bed is exactly right. You should not have to touch this again unless you physically change the Z Probe in some way.

The servo angles that work with this Z Probe frame are down (45) and up (85) but some variation might be necessary. Also the printed servo horn end will need to be filed down to get the fit exactly right.

Be aware that the mods in Marlin to make this work are reasonably complex. An example of the Marlin configuration.h file settings for a Robo 3d is included in the files.

You need to understand that with the Z probe there is no Z Min Limit switch any more and no Z homing function. There are also a few bugs in the Auto Bed Leveling code which cause strange behaviour.

To support this Z Probe design it is also necessary to make a change to the Marlin_main.cpp file as explained here


When printing you need to add some gcode commands right at the start of the gcode print file

G28 X0 Y0 ; home X/Y axes
G29 ; probe bed
G28 X0 Y0 ; home X/Y axes

Enjoy not having to level the bed or manually adjust the extruder height.

More from 3D Printer Parts

view more

All Apps

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

Do you mind posting your results of a M48 V3 ?

Seems I've invented something that had already been invented :-(

ZiggyRobo: Can you please post the details about the modification you had to make to Marlin to make this work? The link you posted: https://github.com/ErikZalm/Marlin/issues/882 does not work anymore.

Hi hardik

The simplist way to avoid the probe trigerring before it has deployed properly is to make sure the


is defined in Marlin configuration.h

You might have to increase the delay value depending on how fast your servo moves.

If you still have problems - leave another comment.

Do you mind posting your scad file?

Hi Caputsic

The holes in the carriage are ok for M3 screws but I used some thin plastic shim to make the screws fit tightly. I just pushed the shim into the holes then tightened the screws. Needs a bit of trial and error to get them to fit snuggly.

Hey Ziggy Robo,

You put that you used M3 screws and nuts, but the M3 screws I bought slide smoothly into the extrude carriage. They don't bite into the plastic or screw into anything. The hole in the carriage is only about 10mm deep and does not go all the way through to the other side so there is no way to add a nut to secure it.

How exactly did you attach this entire assembly to the extrude carriage?

-Thank you,


This mod adds a probe for the Auto Bed Levelling Compensation function in the Marlin firmware. By probing the bed at several places (usually in a 3 x 3 pattern), the firmware can determine any slope on the bed and compensate the Z automatically at it prints.

What is the benefit of this mod vs just adding a compensating offset to g- code? I use;

G1 Z1;z axis offset
G92 Z0 ;Force new Z0


Just finished mine with E3D. See https://www.youtube.com/watch?v=1hFXow4G-es
The firmware modifications are a little bit of a hazzle. Lots of settings that I tried. At the end, I used the lastest RoBo firmware from http://help.robo3dprinter.com/Wiki/RoBo_3D_Firmware with most important changes described in the thing. One other critical setting is to

define INVERT_Z_DIR false

from the original "true". Otherwise auto level will probe in Z direction, not in -Z.
Regarding the E3D, I just printed a 5mm kind of washer that gives enough space between the E3D and the auto level mechanics.

Hi Ziggy,

This thing is still fits in if the hotend replaced with a E3D v6 one?

I suspect there will be a problem with the fitting because of the E3d fan assembly. One possibility to give more space would be to use a couple of standoffs for the probe assembly. But I have not tried this myself.

im currently testing my remix for E3D v6
if Ziggy allow me to share my scad files based on this idea i can upload them, but its still work in progress

Your remixed design and printer look great. Please go ahead and publish your remix if you want.

Suggest you also make a note about the Opto Endstops design flaw. They need to be modded or will fail over time.

Hi Ziggy, thanks for the reply, i already printing version to use bicycle spoke, will test how it goes. Glad to hear that Marlin is ok :)
also what about ambient / day light? do you cover optical sensor?

Please remeber that with Marlin you do need to make the firmware mods I have described in the instructions.

The opto endstops use a TCST2103 optical interrupter which has a light shield built in. I have not had problems with any stray light. However intense, focused light will disrupt the opto sensor.

But regarding Opto Endstops in general......

I have seen that many (seems like most) opto isolators on ebay use this design


Unfortunately the person who designed this opto endstop seems to have missed the fact that the TCST2103 opto sensor is rated only to 4 milliamps. When the opto endstop is triggered and the led is on, the current is about 7 milliamps. This can cause some opto endstops to behave erratically. One solution is to remove the led. Another solution is to replace the 1k led resistor with at least 2.2k.


The brass rod can usually be found at hobby stores (ie model train, aircraft etc). It is possble to use a different diameter but remember the rod needs to work with the opto endstop so must fit within the optical sensor and operate the sensor.

The top end of the rod must be flat because the top end has to cut off the optical beam in the sensor at exactly the same place each time.

The bottom end of the rod should touch the bed in exactly the same way each time. Having the end flat works but it would also be possible to have a sharp point or smoothly rounded point at the bottom end of the rod.

As I mentioned in the instructions, some simple modifications to Marlin are required. I have used the auto level sensor for several months now and find it works reliably with the modified Marlin.

If you need the scad just message me with an email address.

Hi, Ziggy, im interested in your design, where i can get this brass rod? Can i use something else, different dia? Is scad file missing? How much important to have ends flat? does it works good with marlin fw? Thanks :-)