hits counter

Auto bed-leveling for the Makerfarm Prusa i3 - Part 1: Assembly and basic setup.

If there’s one task that has been most frustrating in operating a 3D printer, it has to be leveling the bed.   Like any other task that involves making multiple adjustments, this one was tedious and time-consuming.  Get one corner “Just right”, and another corner goes just a little out of adjustment, and you’re making another round.  When I first built my Makerfarm Prusa i3, there was no method available to adjust the Y-axis, so all I could do was adjust the X-axis and hope for the best.  This got a little better when a simple manual bed leveling arrangement occurred to me (apparently just after it occurred to Colin at Makerfarm).

The manual bed leveling helped, but added to the time and effort required to get the bed actually dead level.

Luckily, as often happens in the RepRap community, someone brilliant got it sorted.

The code was originally developed by Lars Brubaker, and implemented on the Makerfarm Prusa i3 by Alex Borro.

In the interest of full disclosure, it’s worth noting that this mod does not actually level the bed.  Rather, it probes the bed at three locations, and from that data calculates the plane that the print bed actually sits on. The print is then adjusted so that it prints perpendicular to the bed.  Here’s an example of what this looks like from Alex Borro.

Here’s how I implemented this on my Makerfarm Prusa i3:  There may be better ways, but this is how I did it.

What you will need:

I remixed one of Alex’s parts, and designed another one.  You’ll need to print one of each. I suggest printing these in ABS, since they will be near the hotend and will probably be experiencing some heat.

Parametric 9g Servo mount for Makerfarm i3 with auto bed leveling

Z-probe holder for Makerfarm i3 with auto bed-level

You’ll also need a small, 9g servo.  Here’s one:

TowerPro SG90 9G Mini Servo with Accessories

You will also need (2) M2.5 x 12mm bolts and (2) M2.5 nuts

The Z-axis endstop will actually be moved onto the end of the servo arm.  You can wire in a secondary endstop in series if desired.  I found the stock microswitch with the flag attached to be less accurate than a microswitch without the flag.  Here is the one I used:

Omron SS-5 Microswitch

Once you have all the parts, assembly and installation are pretty straight forward.  Here’s a video:

Next up:  Configuring Marlin to work with the Auto bed-leveling mods:

43 comments to Auto bed-leveling for the Makerfarm Prusa i3 – Part 1: Assembly and basic setup.

  • This is a great set of videos – I’ve just got the bed-zeroing and levelling set up on my MakerFarm using them – thanks!

  • Jeff Schaber

    I’ve been following your progress and have even printed off your parts from Thingiverse but have a question regarding the endstop mount. I downloaded the .scad file but when I open it and compile all I get is the following error:

    WARNING: Can’t open include file ‘boxes.scad’.
    Module cache size: 0 modules
    Compiling design (CSG Tree generation)…
    WARNING: Ignoring unknown module ’roundedBox’.
    WARNING: Ignoring unknown module ’roundedBox’.
    WARNING: Ignoring unknown module ’roundedBox’.
    WARNING: Ignoring unknown module ’roundedBox’.

    I’m using a different extruder with my i3 and need to lengthen the arm but can’t seem to get the .scad to cooperate. any suggestions?

  • You need to install the MCAD library, which contains the boxes.scad file, which contains all the roundedBox code. MCAD actually comes with the current version of OpenSCAD, but for some reason often doesn’t install correctly.

    Here’s a page that describes how to install it:


    And here’s the github repository for MCAD if you can’t find it:


    Have fun!

  • Jeff Schaber

    Thank you sir! I’m new to OpenSCAD so I’m still trying to figure things out. I have to i3’s on my desk right now and neither are working to my satisfaction so I do appreciate the documentation you have on this.

    I almost had it working last night but need to reposition where the probe hit thus redesigning your parts.

    One question, for some reason the M401 and M402 commands would not work for me to retract and extend the arm. I can move the arm with the M280 P0 S{angle} command fine but not the other 2. I’m thinking I have something screwed up in my config.h file but not sure. If you have a simple answer that would be great but if not no worries, I’ll go over your blog post about upgrading the makerfarm firmware and hopefully this will reveal itself to me.

    Thanks again!

  • Ron

    hey there, Great work!

    I am having issues, but I think its and Z stop one? you say “You can wire in a secondary endstop in series if desired.” do you mean parallel? also on the ramps 1.4 there are 6 end stop connectors (i believe 2 for each?) can I use the 2 Z stops? rather should I ?
    I loose Z control after flashing the new Marlin ( probably missed a line of code I’m guessing?)

    Keep it up!

    • RAMPS 1.4 has pins for a MAX and MIN on each of the three axes. They wont work at the same end of the same axis without serious modification to Marlin. If you need a secondary end stop (which I don’t recommend, by the way), you’ll definitely want to wire it in series. To do this, you’ll first need to make sure you’ve got your end stops wired as “Normally Closed” (NC). Just cut one of the wires leading to the end stop and hook each end up to another microswitch. Bob’s your uncle, secondary end stop.

  • Ron

    Thank you sir!
    I got it going and yes i did remove the second stop.
    working real well, need a bit of print adjustment, but the warping is done!
    did modify the the start.gcode and the end.gcode because I did get a crash when the head was not is a good place.

    G28 ;home

  • Mark Adams

    I am perplexed. Where do the two wires from the probe switch connect to the board?

    Also, please forgive a dumb question, but do I jump those pins that need jumping by connecting them with a wire?


  • Pedro

    hi…when i put the jumper ramp don’t “boot up” an i don’t detect it on PC do you know why this could append ?

  • Pedro Marques

    hi already try it withou the servo and most of the other stuff disconnected
    i’m using Ramps 1.4 and i already buyit assembly….

    • That really shouldn’t be happening. My only other suggestion would be to double check that you’ve got the jumper in the right location. Beyond that, I would suspect your RAMPS board may be defective.

  • gfosdike


    I’m running a reprap pro mendel with a dual x carriage on a Megatronics v3 board. I have a couple of issue after enabling Auto Bed Leveling that I’m hoping you can help me with.

    The first is when the z probe is retracted after a G28 or G29 it hits the bed, it really needs to retract about 4mm to stop it.

    The other is after a G28 or 29 you then try and move a single axis, all three move at once. The only way I can fix it at the moment is to call T1 to force it to auto park T0 and then call T0 again. It may be something to do with trying to run Dual X carriage and Auto Bed Leveling together.

    Any help would be much appreciated.

    Best Regards


  • Chris McKnight

    I am trying to get my auto leveling to work, but am having problems. When I send an M280 command, it extends and works perfectly. So I know it works, and it is powered correctly. However, when I issue a G28 or G29 command, the axis move like they are supposed to, however the servo does not move. It just vibrates, but never actually moves. Any ideas?

  • Theo

    Hi I want to install bed leveling on my delta printer, can I leave my max endstops as is and just add the probe to the Z-min on my ramps 1.4 board?
    I also wants to know, running Marlin on my Mega R3 where should I set the servo up and how

  • Theo

    Hi me again, I’ve downloaded Marlin v1 and implement bed auto leveling on my Rostock delta.
    The Marlin complies with errors such as duplicate declarations…
    I get the rostock to probe but way off into the one side.
    Any ideas?

  • Duckfriedrice

    Hi Zennmaster, I have to say your blog and video tutorial is fascinating.
    I’ve been trying to upgrade my X carriage with an auto bed leveling servo probe.

    I’ve followed your tutorial on youtube, Part 1~3
    But cannot get the servo to move in prontrface with M280 P0 S150

    I’m using ramps 1.4, Marlin firmware
    Define CoreXY
    SG90 Mini Servo
    Omron SS-5 Micro Switch

    I have to change the RC Servo commands to small letters in order to compile successfully.

    Here is what I have done:
    1. Jumpered 5V and Vcc
    2. Omron Microswitch plugged to Z Min endstop pins
    3. Servo plugged to D11 pin (servo pin) on ramps 1.4
    4. Defined num_servos 1
    5. #define min_software_endstops false
    7. #define XY_TRAVEL_SPEED 3000
    8. #define num_servos 1
    9. #define servo_endstops {-1, -1, 0}
    10. #define servo_endstop_angles {0,0, 0,0, 165,70}

    Please kindly suggest the way out, I’ve been stuck for few days
    and making no progess at all, many thanks Zen 😀

  • jaco

    how to ajust x,y,z,e axcel for homing.
    what must the clearance between the extuder point and headbed plate glass.

    • Jet

      Hey Jacob,

      Use the thinnest filler gauge to set the distance from the glass to the extruder. The x,y,and z setting is demonstrated on the “part 3” video.

  • Hi,

    Been reading your post,I have 1 question of you don’t mind answering, If i want to use the autoleveling features so I only need 1 endstop for Z?


  • Lucas

    Where did you get those bolts? I’m having a devil of a time finding bolts with that spec. Will 10mm work?

    • Most of my hardware comes either from Amazon, or a local place called Mt. Hood Fastener. In general, the RC car community is where the hardware comes from.
      Also, of you’re talking about the m2.5 bolts for mounting the servo, then 10 mm should work. Also, enlarging the mounting holes to accept m3 is a reasonable thing to do, and a number of people have reported success with it.

  • DannyBoy

    Any idea what differences would be invloved for the new 10″ version of the makerfarm with hex hothead?

    • So far, on my 8″ i3v, I’ve found the bed to be sufficiently stable and easy to level that I haven’t yet seen the need to install the bed-leveling. If you wanted to do it, though, the only difference I see is that the X-carriage uses a different part on the side. There are a few i3v variants of that part on T-verse. Other than that, it should be the same.

  • Marko

    Very well done video. I’m using it to setup my auto bed leveling. I have one problem however, if I home the X and Y my nozzle sits just on the corner of my print area, but my servo z switch sits about 5cm outside of the bed. If i do a G28 command to home all axix it results in a runaway because the switch wont make contact with anything.

    What I would need is a solution where it will move the bed, perhaps to center, so that when it does a Z home the switch will be able to contact the bed.

  • David


    In your video you don’t mention what wires we have to connect to the switch:
    NO and Comm?
    NC and Comm?
    NC NO and Comm?
    In the RAMPS NO is Signal or the NC?

    All the best,


  • In the video the X and Y offsets are shown as floating number. The software is not set up for that. It needs to be an integer (full number without digits). If you do the X and Y offsets as xx.xx, the software will not compile and upload. Only the Z value should be a float number.

  • Kevin Whyte

    Hi. Thank you for your excellent instructions but I am experiencing a problem. I have a Sunhokey Prusa i3 and whenever I trigger the Z stop the LCD screen goes blank and I lose the USB connection to the printer. Any ideas what I might be doing wrong? I’ve seen somewhere that you may have to jumper some pins on the board – could that be the issue maybe?

    • Kevin Whyte

      I should have mentioned that the Z stop was working fine before when it was in it’s original position. In your video I notice that you only have 2 wires going into the end stop but on my printer there are 3 wires. Can you advise how your end stop switch was wired?

      • The microswitches that I use for endstops have three positions: Ground, NO (normally open) and NC (normally closed). Obviously, you would need to choose between NO and NC, since wiring both would create a conflict. The connectors used by Makerfarm, and most other i3 designs that I’ve seen, remove one wire from the 3-wire connector. I wonder if perhaps one of your three wires is a “dummy”, not connected to anything. What is at each end of the three wires?

  • jon

    why not use a proximity sensor? it would probably be cheaper and easier to add in without the additional potential failure point of the servo.

  • Brett Nowak

    I have a Sunhokey Prusa i3 printer and i wanted to add this bed leveler. I bought all the parts i need and set them all up on my printer so all i need to do is configure it. Im completely new to programming and i dont under stand how you open up the software and edit it. Is the a program editor i need? and how do i know what version my printer is running?

  • Luke

    HI all I need some help. I am trying to setup auto leveling on my folgertech Prussia I3 2020. I bought a sheet a aluminum and a sensor. I installed everything and test the sensor. Everything was working fine so I went to update my marlin. Fortunately someone had already done this so I did not have to go do it myself. I flowed the video below to set all my settings. When I send a G28 the printer levels just fine but upon sending a G29 the printer does nothing. I also have linked another video showing what the printer does along with a link to my arudino code download.

  • […] direct you to the instructibe I linked earlier, this excellent video by Thomas Sanladerer, and this blog series by ZennMaster – those were the three resources that helped me the most when I was setting up […]

Leave a Reply to gfosdike Cancel reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>