hits counter

Auto bed-leveling for the Makerfarm Prusa i3 - Part 3: Final setup

Now that you’ve got the hardware assembled and Marlin enabled and installed, it’s time to put it all together:

The first thing you’ll want to do is set up your servo extend/retract angles.

Do that by sending the following command in Pronterface:

M280 P0 S160

This command is telling the printer to extend servo 0 (P0) to an angle of 160 degrees (S160).

If everything is installed correctly, you should see the servo arm swing down.

Unless you are very lucky, this will probably not be the angle you want. Try again, varying the “S” value until the foot of the microswitch is parallel with the print bed. When the Z-axis lowers to home, you want the trigger on the switch to be making clean contact with the bed. If the angle is too far one way or the other, the switch will never get triggered and the hotend is lowered, and you’ll have a nice head crash.

After you’ve determined your extension angle, repeat the process to find your retraction angle (the position for the switch when it’s retracted). I’d start around 70 degrees. You’re looking for a position where the microswitch is completely clear of the print surface, but not so high that it is straining against the bottom of the carriage.

After you’ve found your angles, switch between them a few times just to make sure.

Once you’re sure, return to your Marlin Configuration.h file, and enter your angles in the following line:

#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles

Enter your values in the third pair, which coresponds to the Z-axis endstop.
(IE: #define SERVO_ENDSTOP_ANGLES {0,0, 0,0, (entension angle),(retraction angle)} // X,Y,Z Axis Extend and Retract angles)

Go ahead and flash these changes to your printer.

Next, define your probe/extruder offsets.

Make a small mark somwhere on your print bed. Somewhere around the middle works well, but it’s not critical.

Using the X,Y, and Z controls on Pronterface, carefully position the hotend so that it is just touching the mark you made. Using Pronterface, raise the hotend by 0.1mm. You should be able to slide a single sheet of paper between the nozzle and the bed, just like when you were setting up your old-school Z end stop.

Now zero all the axes with the following command:

G92 X0 Y0 Z0

This is temporarily setting the hotend’s current location as the zero point for all three axes.

Now, raise the hotend until there is plenty of room to extend the Z-probe. If you have flashed the servo angles, you can extend the Z-probe by using the M401 command.

With the probe extended, use Pronterface to place the microswitch’s trigger right on top of the mark on the bed. Carefully lower the carriage, probably only 0.1mm at a time, until the Z-end stop is triggered. You can check on this using the M119 command. Once you’re really close, be careful to check the endstop after each and every lowering event. It is sometimes possible to continue lowering the carriage after the endstop is triggered, so be careful. Once you have verified that the Z-end stop has just triggered, use M114 to read the current position of the hotend, and record the values. You should have one value for X, one for Y, and one for Z.

Your values should be something like: X: -29.85, Y:1.85, Z:8.40. Before you do anything else, multiply each number by -1. All this does in reverse the sign. In other words, positive numbers must become negative, and negative numbers must become positive.

Now, back to Marlin. In the Bed Auto-Leveling section in Configuration.h, look for the following lines:


Replace the values with your sign-reversed values. In our example, it would look like this:


Now there’s one last set of values to change: Right above the offsets, there are four #defines for probing positions on the bed:

Initially, set them as follows:


This will cause the probing locations to happen fairly close to the center of the bed. After you’ve got everything else working, you can start to move these further out. Use caution though. In addition to the obvious potential issues of bumping into something, or else probing over the edge of the bed, there are also some reports of very strange behavior caused by a probing position being closer to the edge than the absolute value of one or more of the offsets. To illustrate: In our example, with an X-offset of 29.85 (positive OR negative), if we set the left or right probing position within 29.85mm of the left or right edge of the bed, we could potentially see reversed directions and things like that. Just be careful as you move those values out, and be ready to return them to somthing safe if the unexpected happens.

You can now flash the changes to your printer.

Once this is set up, the G29 command will run the auto-level. In order for this to work correctly, though, it has to start from the homed position, so make sure to home all your axes with a G28 before running the G29.

Another word of caution: As of the time of this writing, I haven’t been able to get Z_RAISE_BEFORE_HOMING to work correctly, so I’ve been making it a habit to bump up the Z-axis a few MM before homing. Forgetting this results in, at the very least, frustration.

One last, and very important note:

DO NOT SKIP MEASURING ANY OF THE VALUES YOU NEED TO MEASURE! The values I have used for examples WILL NOT WORK! Each installation is a little bit different, and you really need to have accurate values that you can only get by making your own measurements.

114 comments to Auto bed-leveling for the Makerfarm Prusa i3 – Part 3: Final setup

  • msmone

    Hi Zenmaster,

    Thanks for all your information about the makerfarm prusa i3. It helped me a lot. Now i’m implementing the autolevel option. I also had the problem with the not moving z-axis. I changed the xy speed to 150 instead of your 4000. I read this on the forum at reprap.org. It does the levelling very slowly but the z-axis will go up and down.
    wdl1908 made an adjustment in the Marlin_main.cpp. But i don’t know how to implement this.

    Thanks again.


  • msmone

    Hi Zen

    I just realised your talking about something else. To set the xy speed helped for me.


  • cdmiller

    Hi Michael,

    I got all this set up last night and have some issues to resolve before I set the offsets from the print head and try a print. The Marlin I downloaded is direct from the Github as of last night and listed as Marlin_v1.

    1. I’m seeing the same behavior as Jeff Schaber (video 1 post) in that the M401 and M402 commands are unresponsive while the S280 commands appear to work fine. Is there some problem in the latest Marlin with the M401 and M402?

    2. The little towerpro sg90 buzzes the whole time the printer is on but holds position fine.
    Is your experience similar or are you using a better quality servo at present?

    3. The sg90 is inconsistent in positioning between printer reboots, which would make presets in Marlin problematic at best. Do you see this behavior with your installed servo?


    – cameron

    • Hi Cameron –

      Sorry this slipped by me somehow!

      It looks like you’ve got it sorted, but here goes anyway:

      Bugs come and go in Marlin, especially now that this is kind of a hot deal. I haven’t specifically heard about those, but you never know.

      I’m using a different servo (one I had laying around), but I can’t imagine it’s any better than the Towerpro. I’d suggest un-commenting this line:


      Finally, I haven’t seen the servo settings changing between reboots, but I absolutly see it happening any time there is a probe crash. πŸ™ I hate to say it, but you might have a bad servo.

    • ollie

      hello cdmiller,

      just wondering if you were able to fix this issue? I have exactly the same issue!!!!

    • Wawok


      I have the same problem with my servo it doesn’t work with I send M401 or M402 but when I send M280 P0 S… it work’s fine. Did you solved that problem ?

  • Adrian

    Hi Zen,

    thank you for the detailed description of the auto bed leveling.

    Currently I am having a problem after this procedure was performed.
    The offset of the probe is 2.7 mm below the tip of the hot end the this is also the value (-2.7mm) that was flashed on the Controller. The leveling procedure is working fine.
    I see that the Z-axis is set to 2.6 after the bed leveling procedure stopped and also after heating up the bed. But before the actual printing was started this value is set back to Zero so that the tip is moving to 2.6 mm over the heating bed. I would expect a movement in the z-direction before the printing should actually start??

    Thanks in advance for your help.


  • Adrian

    sorry, I made a Little mistake im my description. The tip is not moving up after the procedure but is keeps the last position and resets z-position from 2.6 to Zero. Therefore the printing is started 2.6 mm above the bed.

    • Zennmaster

      Sounds like you’re homing after you do the bed leveling, which erases the leveling data. In your Gcode, always make sure to run your G29 AFTER your final G28.

  • Adrian

    Hello Michael,

    I think the homing is always triggered before printerface is starting a print automaticly. So even though my last command is G29, there will be a additional homing bofore the printing started which is currently changing the satrting point because the endstop is 2.6 mm below the tip.
    Is there a possibility the avoid automatic homing after G29?

    I have also observed that the z-axis motors are making weird noises when moving the axis > 1mm (only with Marlin s/w v1 and not with the makerfarm firmware).
    Currently I am very unhappy with the auto-bed-leveling function & Marlin V1 and switched back to makerfarm firmware with the conventional z-axis endstop (which is also not a good solution)


    • Zennmaster

      No, Pronterface does not do anything before starting a print. The G28 comes from Slic3r. Look in “Printer Settings” and then in “Custom G-code”. In the “Start G-code” box you will find “G28; home all axes”. That’s where your homing is coming from. Since the G29 needs to be called from the homed position, I would suggest inserting it on the next line down from there, so it would look like:

      “G28; home all axes
      G29; level the bed
      G1 Z5 F5000; lift nozzle”

      Or something similar.

  • Thanks for this tutorial! This was fun to implement has really helped my printing. Something you may want to consider adding to your tutorial is adding;

    G91 ; set to relative movement
    G1 Z7 ; move Z up 7mm
    G90 ; return to absolute movement

    to the end of all print jobs. As you mentioned, there is a strong possibility of head crashes if at the end of a print job the carriage is too low to allow the Z probe to extend. Adding that little bit above just makes sure the carriage is just high enough to allow safe homing for the next job

  • Simon

    Hi, I have a rise and fall issue with my nozzel.

    I currently have my offsets at the following configuration.

    The issue is that when it prints, it would initially start too high off the bed when printing.

    I tried entering the following codes in slic3r: G28,G29, and G1 Z-1 to lower it. This starts off fine. But as I try to print a circular shape, the Z axis would then rise away from the bed and fall close the the bed. I have checked the measurements and re taken then. I’m rather stumped. I’m wondering what I am missing?



    • Someone ran into this a month or two ago. It turned out o be a bug in the #define Z_RAISE_BETWEEN_PROBINGS line in Configuration.h. Two suggestions: 1) Make sure you’ve got the latest version of Marlin, and 2) Change the #define Z_RAISE_BETWEEN_PROBINGS value to 0.1 and see if you get an improvement.

      Let me know how that goes.

  • Dave

    Hi. First, thank you for your guide. It’s really well put together. Second, I’m have one slight issue and I’m not sure how to fix it. It seems like the Auto Leveling is working fine and everything is in there properly, except that the Hot end never homes. It’s always raised 4.7mm off of the bed which is what my probe offset is. I’m not sure where to fix that.

    Thanks for your help.

  • Elrac

    Hi Zenmaster,

    I followed your instructions and have had the bed leveling running on my printer for a while now. Thank you for writing this and for designing the probe holder.

    I was wondering if you know the difference between the G29 and G32 commands? I have been using the G29 command, and it seems like the bed leveling is working correctly, but reading the Marlin wiki it seems like the G32 command would be the correct command to use. Any info you could provide would be helpful, thanks.


    • Good question! From what I have been able to find out, it seems that at one time G32 would have indeed been the correct command to use. Sometime in the history of Marlin, G29 did not update the transformation matrix, it simply reported three probe results. This allowed the math to be performed in the host software, for example, rather than on the Arduino. G32 took the same probe results and did the transformation on the Arduino. Since then (when Alex merged the changes, I think), the G29 command is the one that’s gotten all the love, and received all of the code updates (accurate levelling, etc). There may be some redundancy at the moment, but going forward, it looks like G29 is the way to go.
      Ya gotta love community-developed software!

  • TAZ427

    Thanks a lot for all your support on this. One comment I’d make and adding this piece of info may help others avoid this minor issue.

    You need to check your GCODE start sequence. If it has a G28 Z# or G28 (blank spaces after) you need to follow up w/ a G29 in the code so that it resets the Z offset. I checked both Slic3r and Cura; by default both have a G28 Y0 X0, G28 Z0 in the sequence, these I needed to comment out and replace with a G28 and G29. Otherwise the Z axis will get zero’d, and the hotend will crash into the bed. Thankfully on the MarkerFarm, the Z carriage platform is just held to the nut traps of the Z screws by gravity, else it could have done some damage.

    Thanks to Zennmaster for pointing out that this was what was happening to mine on YouTube feed. But given this is so common of a GCODE start sequence, I think it should be included in the part 3 instructions (and maybe a pop-up added to the video.)

  • cmcd2820

    I have followed all your guides and have it working 90%. The problem is that when I do a G28 it homes the X and Y, then kicks in the safe Z homing in the center of the bed. When I send a G29, it tries to raise the Z axis too fast and the Z motors hum, the display shows it went up 15, but the carriage does not move. It then slowly sets the Z zero point in the home corner. Going down on the Z axis is fine, it’s just when it tries to raise it. It probes the first point, then SAYS it raises by 5 between points, but again, the z motors hum, but the carriage does not move.

    When I manually move the z motors, they do the same thing when I try to move them too fast. How do I set the homing speed for the Z axis so that it moves instead of just saying it moves?

    • cmcd2820

      Ok, I checked and the firmware on the printer had the max z at 5, not 2. Once I updated that it works fine, except:

      My G28 works, my G29 seems to calibrate correctly. When the probing stops, and the servo retracts the head is 6mm above the print bed.


      That is my offset. However, when the print starts, the head is still 6mm above the bed. The Z motors are spinning to level it, but the gap is a little big. What did I miss?

      • It looks like you may have skipped the part where you reverse the signs after you take the measurements. Unless your probe is somehow ABOVE your nozzle, the Z-offset should be a negative number.

    • eychu

      I have some problem, how you solve it? Witch variable you change?

  • asdfghjk

    Hello, thank you for sharing this with us!
    The G29 command works great so far but when it starts printing the printer starts right where it stopped the leveling process, so in your case X150 and Y150 and the hotend is somewhere in the air. It seems like it uses this coordinates as home position. I did everything as described.
    Can you help me please ?

  • redkite

    Hi. Great tutorial, but i have a issue.
    When send the G29 it starts to probe but it does that in the same place, X and Y axis doesn’t move while probing. Any thoughts about what’s wrong?

    I will try to upload a video later today that shows my problem

    • I had a similar problem at first. In my case, I had left the MAX endstops enabled in my Configuration.h. That’s the first thing I’d suggest looking at.

    • Oh, one other thought: Make sure you’ve got #define min_software_endstops false

    • Kris

      Hi Guys,

      I have the same problem with a Prusa i3+Marlin+Ramps 1.4.
      (before installing servos and Z-probe, the printer worked “perfectly”)

      So, I just added a servo, enabled it, moved the fixed Z-Min endstop to the Servo-Arm,
      configured, measured the parameters, etc.

      It “works”, just it measures all the points in the same starting position (X-Y home, after initial Home).
      It does it in the Grid mode, and in the fixed-3-points way also.
      (the LCD UI shows that X-Y are changing from point to point but, motors do not move.
      After Auto-Home, X-Y values are totally out of sync with the real position)

      Any IDEA?
      (I have checked twice all the parameters)

      • Kris

        So, for the future, maybe it will help…

        I found it.

        I had no X-MAX endstop,it was disabled in the conf,
        but the inverting logic was not set to false, so it was “TRIGGERED” all the time.

        I think the appropriate define is checked all over the code, so printer works,
        just this ABL code handles differently.

        So, even if you have it not defined, you have to set the logic config set to the correct value, to have the ENDSTOP signal not triggered.

  • Honza

    Hello :),

    i have this problem. I send G28 over prontrface in to printer, X axes homing right, Y axes homing right but Z axes home speed so fast and too G29 gcode.. Z axes has more problem. How can i repair this problem? then Z, X, Y speed normaly? More information in record movie πŸ™‚

    Clip: Video Clip
    And this is my config: Configuration

    Thanks for answer.

    RE( Sorry for my bad english πŸ™ )

    • These two lines control your speeds:

      #define HOMING_FEEDRATE {50*60, 50*60, 50, 0} // set the homing speeds (mm/min)

      #define DEFAULT_MAX_FEEDRATE {500, 500, 3, 25} // (mm/sec)

      The order the values are in is (X,,Y,Z,E). Note that HOMING_FEEDRATE in is in MM/MIN and DEFAULT_MAX_FEEDRATE is in mm/SEC. Also, in your video,things didn’t really look that bad. How fast are you expecting your Z-axis to go?

  • Roman

    Thanks for your post.
    After following your instructions i’ve got the following issue:

    G29 returns:
    Bed x: 30.00 y: 180.00 z: 6.94
    Bed x: 30.00 y: 70.00 z: 10.09
    Bed x: 170.00 y: 70.00 z: 13.27
    echo:endstops hit: Z:13.27

    My bed is leveled and individual G30 return same offsets.
    What am i missing here?

  • ACW

    I followed your instructions and the auto bed level works. What doesn’t work now is that the Z offset from extruder keeps changing. The values for the Z height are not consistent. Have you seen this problem before? What would you recommend for a fix?

  • errehache

    I have a similar problem! It changes… I think it is probably mechanical, but need to verify

  • james

    Ok so everything seems to be working. I can send g28 and everything homes in the center of the bed (where i put the mark). G29 goes through the autoleveling successfully. My question is how do I set me home position back to the back right of the bed like it was originally? When we temporarily set the home position with the g29 x0 y0 z0 it looks like it became permanent? What am i missing? Thanks!!!

    • james

      actually everything is now working correctly. It goes throught the g29 procedure seemigly correctly but when the print starts the z axis raises up and begins printing in the air. After the G29 is the head supposed to be close to the print bed?

  • James

    I think I figured it out. I didn’t reverse the value of the z offset.

  • james

    OK so one last question… for tonight… Everything is working great. However, I would like my home position to be to the back right of the print bed like yours is. Preferably when I use the LCD and hit autohome i would like it to go to the back right position like the default makerfarm before auto bed leveling. currently when I autohome the x and y end stops are triggered then the print head moved to the center of the bed to home to z axis. This is where it then stays. Any advice on how to change this?!

  • George

    I have done this mod and i did G28 and then G29, probes fine but my bed is uneven for sure and when i print something it does not compensate for the uneven bed i have. What am i doing wrong?

    • Do you mean it just shoots out at a big angle, or do you mean it lifts by .1mm or so at one corner?

      Do you have AUTO_BED_LEVELING_GRID defined, or are you using the 3-point mode?

      If you’re using 3-point mode (which was all that was available when I made the guides), you may have a warped bed. I would suggest activating Grid mode.

  • George

    OK i figured this out, to get the Z axis to move during print to compensate for ANY uneven bed just put M320 S2, this turns on auto bed leveling and will allow the printer to adjust during printing. The Z axis will move during prints

    • You really shouldn’t have to do that. In your Configuration.h, are you sure this line:

      #define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)

      Doesn’t look like this:

      //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)


  • Gary

    Hi Michael,

    I absolutely LOVE your blogs and videos about the Makerfarm printers! Your videos got me interested enough to buy one.

    Of course, THEN I had to do this auto bed leveling upgrade and that’s where I’m at at this point. I have the new Marlin flashed to my I3v printer and everything seems to be working fine except when I use the LCD screen to “Auto Home”. The X and Y axis seem to home ok, but then the Z axis moves everything back to the center point of the bed – where I set the temporary 0 point for my Z offset from the hotend. You mentioned that G92 X0 Y0 Z0 is the command used to temporarily set the hotend’s current location as the zero point for all three axes.

    I didn’t see anything where you indicated resetting the 0 point back to the corner of the bed. Did I miss that and is that what’s causing me issues now? If I reset my 0 positions back to their original place, which allows the print head to be right on the bed, won’t that screw up the auto leveling process?

    Sorry if you explained this somewhere else, but I just can’t seem to find it.



    • Hi Gary –

      Since I made my guide, Marln’s progress has rolled on. πŸ™‚ There are two ways to fix this:

      1) In your Configuration.h, comment out #define Z_SAFE_HOMING.

      2) Set the Z_SAFE_HOMING locations to something other than the defaults, which are X_MAX_LENGTH/2 and Y_MAX_LENGTH/2 (the middle of the print area).

      Enough has happened in the last few months that I suppose it’s time to make a new version of the guides!

  • James

    I just realized that the servo is hiring my x axis “carriage?” http://i.imgur.com/wV6frFa.jpg
    Did I print the correct part? Has anyone else had issues with this? I’ve only lost about 1/4″ of bed space but it’s enough to find or make a different part! Thanks

  • Matthew Harris

    Hi there Zen

    I know you’ve probably answered this question a million times, but for some reason my Z axis always resets to zero just after auto levelling but just before the print starts, my custom G-code on slic3r is:

    G28 ; home all axes
    G1 Z5 F5000 ; lift nozzle

    any suggestions?

    • Could you explain that a little more? The zero point should be just a hair above the print surface, is that not what you’re seeing?

      • Matthew

        When I set it up I followed your instructions for calibrating the offset, but for some reason it seems to ignore the z axis offset and starts printing something like 15mm higher than it should, I feel like I’ve missed something along the way but as far as I know I followed your instructions to the letter

  • dazza

    hi Zenmaster
    and a big thank you for your hard work on this super tutorial .
    I have just (touch wood) got it all working .
    has a beginner in 3d printing I found you very easy to understand .

    keep up the good work .
    cheers darren

  • nick

    I have this working great. However after homing with G28 X0 Y0 and then auto level with G29, my print starts off in the back right corner. If i print with out G29 the print starts off perfectly centered. I have my center set in the Marling Firmware, Sli3er and PrinterRun / Repetier Host (i switch back and forth between the PrinterRun and Repetier). Not sure why it would not print in the center after auto level. Any thoughts?

  • hey on your video the servo does not retract when moving to the next point but mine does, can’t find anything to disable it any idea?

    • When I made the video, that was how Marlin did it. It was very shortly after that when it changed to the behavior you see now which is, for the most part, a much better and safer procedure. Don’t worry, it’s doing it right!

      • jason

        I need it o drop the arm first, otherwise it hits the z upright and resets so I can’t get it to home, I need it to home x, home y, then drop the arm and level to z and keep the arm down until complete, the constant retracting can’t happen….. got any ideas how to change the order it carrives out the command?

  • Rob

    Following your directions I have this running nicely on my Makerfarm printer. My auto level servo make little noises as a print is running, as if it’s getting little bursts of signals to move. Once the print starts, is there a way to issue a command to turn off the power to the servo’s header until the print finishes?

  • Zack

    Thank you for the wonderful write up and videos which helped me get my auto-leveling working. I’ve been using it for a few weeks now on my Markerfarm I3 and I noticed earlier today while printing larger prints, that on the right side of my bed I am getting a nice perfect “squish” for my first layer of PLA on the right side of the bed. However, on the far left side of my bed, there is a noticeable difference in the first layer not getting squished down on the bed which is resulting in print quality issues that have repeatably been just on the left side of my prints. I realized that the left side not getting good adhesion on the first layer is the cause for almost all of my quality issues in my prints. I’ve looked through the configuration.h file and tried to track down a solution to this problem, but haven’t been able to figured it out. Have you ever ran into this or a similar issue with your auto leveling or know where I might start to try and find a solution?

    • Sadly, that is something I have indeed come across. The last couple of months have been really busy, and I have been neglecting my print cave, but the solution I was about to try is in the current version of Marlin.

      The way it works now, you select either “grid” mode (the default) or “3-point” mode. Grid mode allows you to specify the points that define a rectangle (the same way you did using the old way), as well as the density of probe points (IE: density ‘3’ would give 9 probe points within the rectangle – 3×3). Where the previous version uses a siple cross-product to determine the plane of the bed, the new version uses a least-mean-squares algorithm, which can more accurately describe a non-planar surface.

      What is most likely going on is either that the bed isn’t actually completely flat, or just as likely, the y-axis has a slight “twist” in it.

      Like I said, I haven’t actually had a chance to update my firmware, but this is the direction I was planning on going.

      There are some really smart people working on Marlin!

      • Zack

        Thanks for all of the helpful insights. I would not be that surprised if my bed was a little warped and that there was a twist in my Y-Axis too. I have been working on it when I can and got a lot of time to put into the printer today. What I thought was originally a slicing software issue; I have now tracked down to a firmware issue which I think is in my configuration.h file.

        I noticed today that my prints are completely shifting over about 20mm on the bed in the X-axis and it is also throwing off my Y-Axis. This is causing a real problem because I am losing 20mm on the right side of the bed in the X-Axis and it is causing a x-carriage to crash into the x-motor assembly on the left side of the bed if I try to print on the far left side. It is also creating the same issue in the Y-axis which I think is around 20mm too. This is only happening if I used the G29 for auto bed leveling. If I setup the Z axis and don’t use auto bed leveling, the prints are not offset the 20mm and are printing exactly where I am wanting them.

        My probing is working perfectly other than the 20mm offset when the printing begins. I am using G28 before G29 too and when using G29 my Z Axis is homing and calibrating perfectly. I realized the 20mm offset is what was causing my original left side print issues with them not getting squished right on the first layer.

        I spent some time today and uploaded the new Marlin firmware as well to rule that out and I also disabled Z_SAFE_HOMING which did nothing, but when I adjusted #define Z_SAFE_HOMING_X_POINT (0)—to zero instead of the center of the bed and
        #define Z_SAFE_HOMING_Y_POINT (0) to zero too, it actually shifted my prints even further away to a 33mm offset making my issue worse.

        I was wondering if you (or anyone reading this) might have a clue to what is causing my offset problems that only happen when using auto bed leveling. Any insights or ideas would be so appreciated. I’ve put about 8 hours into trying to track down the problem today and as of right now it has got be beat. I even tried to add offsets in Pronterface and it did nothing to help the issue.

        • Zack

          Well it seems getting some sleep to reboot my brain over this issue has helped. I noticed this morning when running tests that the offset problem is exactly the same offset as my X and Y probe offsets.

          #define X_PROBE_OFFSET_FROM_EXTRUDER 33.2
          #define Y_PROBE_OFFSET_FROM_EXTRUDER 9.4

          I believe that these are perfect numbers in relation to the offset of the probe to the hot end on my Makerfarm I3 however…once auto leveling is complete, these are the same numbers that my bed is thrown off. So after auto leveling, my new X0 is actually X 33.2 and my new Y0 becomes Y 9.4 making my new X0 Y0 home position actually X-33.2 Y-9.4 which is why it throws the bed off and the Gcode of whatever I am printing.

          The weird thing is my Z offset(#define Z_PROBE_OFFSET_FROM_EXTRUDER -6.0) is working perfectly when printing after auto leveling because the Z axis is not thrown off like the X and Y are.

          So I ended up changing my Probe offsets from the extruder to zero on both the X and Y Axis and it is actually probing the same, but now I don’t have the bed offset problem anymore. So basically I fixed my problem…but now my question is…why/how. My offsets now look like this.

          #define X_PROBE_OFFSET_FROM_EXTRUDER 0
          #define Y_PROBE_OFFSET_FROM_EXTRUDER 0
          #define Z_PROBE_OFFSET_FROM_EXTRUDER -6.0

          It doesn’t seem to make sense to me that this fixed it, but it has LOL.

          • Dustin

            Zack, I have been plagued by the same issue for over a month now…a month since I have been too busy to play with my i3v, but I was thinking the same thing with the offsets, since i noticed the numbers were also where the offset of the printing was. I will take your advice and switch the X and Y nozzle offsets to 0 and give her a go! I also wonder why more people haven’t had the same issue if setting up the software/hardware as Zennmaster tells us to do…Oh well, if it worked for you, it gives me hope on mine, and it will be good to get extruding again! Thanks for the advice.

  • ollie

    hello, I have got the probing part of this set right, so it will probe the bed then if I move X or Y Z moves a bit for compensation. However when I run G29 (after homing X and Y) the hot end stays in the same place on the z axis and so the hot end is the Z_PROBE_OFFSET_FROM_EXTRUDER away from the bed! what command do I send to set the hot end near the bed?

    I have tried G1 Z0 but nothing happens and when I send M114 I get
    ” X:2.59 Y:165.01 Z:-0.63 E:0.00 Count X: 2.59 Y:165.00 Z:-2.71″
    so even though the probe is still touch the bed it says Z is below the probe!

    also when I home Z the probe is down and homes to the end stop on the probe but it still says Z is at 0.00. yes the probe is at 0.00 but the hot end is at Z= 20mm

    please could you help

  • Luc

    Hello, I have about the same issue as everyone. after the probe process me extruder stay away from the bed. I notice that a lot of people add this line in there start G-Code: G1 Z5 F5000. My questions is, the Z5 value is coming from where? Should I understand that the Z5 is coming from the Z PROBE OFFSET ?
    Thanks for the amazing help you are providing us.

  • Dustin

    Thanks for creating such awesome tutorials for things such as this, that really pay off once setup! I am close to being at that point, but am running into issues right now, not sure if you have had this happen to you. I will do my best at describing.

    I did the setup per your instructions, G28 homes as it is supposed to, G29 will auto-level also…but when using pronterface/Repetier Host, as soon as the G28 command finishes homing, pronterface will let out a huge line of error, saying something like:

    Resend: 4 Error:No Checksum with line number, Last Line: 3 [ERROR] Error:No Checksum with line number, Last Line: 3

    Shortly thereafter, it will going into the G29 auto-level sequence, and when that sequence was done and the bed/nozzle temps were at set point, the print wouldn’t start, the same type of code just kept repeating itself on pronterface until it crashed pronterface. On the MARLIN screen, Home XY before Z, shows up…? (it just homed before G29 started!) When trying to print using Repetier, the program disconnects from printer after G28 homing.

    I have powered off printer and disconnected for a period of time, retried…no luck. I have swapped USB cables out, no luck. The only luck I have had was loading gcode onto SD and printing from Marlin, it worked fine. Any Ideas? Thanks again!

  • Well.. Remember to use 502 and then 500 after changing configuration and uploading to the Arduino.. or else the changes won’t be used..

    That’s what I found out.. My Z axis wouldn’t raise after an autolevel, and the leveling was off.. until I found out that saving the changes using a 502 and then a 500 command from pronterface after uploading solved the issue..

    dexus – Norway

  • Hello, I’ve followed the instructions and everything seems to work except for the auto leveling G29 command. When I home the axis (top right corner) and M114 I get the following:
    X:66.00 Y:96.00 Z:16.70 E:0.00
    instead of, I assume x0 y0 z0.
    After this I run G29, the Z-axis moves down a little, then probes, which it shouldn’t do because of Z already homed and can break the servo arm. I then gave it a higher Z0 so that I can see what happens when I G29 and it does the probing 4 times in the same X,Y position while all the time lowering the Z-axis. X & Y axis does not move at all during this. This is what I get:
    Bed x: 50.00 y: 50.00 z: 11.31
    Bed x: 150.00 y: 50.00 z: 9.72
    Bed x: 150.00 y: 150.00 z: 8.47
    Bed x: 50.00 y: 150.00 z: 7.64
    Eqn coefficients: a: -0.00 b: -0.02 d: 12.13
    planeNormal x: 0.00 y: 0.02 z: 1.00
    echo:endstops hit: X:115.70 Y:45.50 Z:7.64
    The z readings, going down, is me faking the bed.

    Any idea what could be wrong? Can I perhaps send you my config file?

    • Things to check:

      1) Make sure the wiring to the probe microswitch is solid.

      2) Make sure you have your MAX ENDSTOPs disabled.

      3) Make sure you have #define min_software_endstops false

    • Goof

      I’m having the exact same issue. When I use the X_PROBE_OFFSET_FROM_EXTRUDER and Y_PROBE_OFFSET_FROM_EXTRUDER it tells my board its off by that much. x-6 and y -63 (yes larger off set on my prusa v2. My print job will run off the bed. Any ideas on this? Thanks!

  • halmalki

    Hi Zennmaster,
    Thanks for the tutorial.
    I have an issue with this , as the z probe retract and hit the heatbed after probing each point.
    Is there any way to elevate z after probing? then to retract z probe??
    Many thanks.

    • Hello, sorry it’s taken me so long to respond!

      In your Configuration.h file, there is a line in the auto-leveling section:


      Make sure this is un-commented and set to something other than 0.

    • Joe Ostrander

      tl;dr… “G29 E”

      Not sure if you solved your problem yet or not, but I had the same problem. After probing, the switch would strike the heatbed BEFORE the Z_RAISE_BETWEEN_PROBINGS kicked in. So as soon as it was done probing, it would retract (hitting the bed) and THEN raise to move to a different probe position. I didn’t have a problem when I had my probe arm retracting to a forward position, but when I switched to have it retract backwards (hidden), it would hit.

      I did 2 things:
      1) switched to a metal roller switch – this allowed me to have the probe trigger at less of an angle and when done probing it would just retract with what appeared to be no interference. I like the idea of not having the plastic switch probe a hot bed and I also would think that by not retracting the probe between points, that it is more accurate.

      2) after changing the switch out, I happened to be looking through a newer Marlin_main.cpp code file and saw that they added some enhancements to the G29. You can now issue a “G29 E” and it will do all the probing without retracting between probes (like it does in ZennMaster’s video).

      Hope that helps save someone from the struggles I had πŸ˜€

  • Jake

    Everything is working after following your guide thanks for that. But I’m getting a loud motor noise between movements during a G28 or G29 command. When the noise happens everything pauses. It last for a second or two then the Z axis pulls up the extruder and it moves to the next location. The noise repeats each time the Z axis picks up the extruder after hitting the end stop.
    Any idea what might be causing this?

    • Look for this line:

      #define DEFAULT_MAX_FEEDRATE {250, 250, 2, 22}

      And make sure you’ve got the Z speed set to 2, and in this line:

      #define DEFAULT_MAX_ACCELERATION {1000,1000,5,1000}

      You’ve got Z set to 5 or less. I’d suggest lowering these values gradually, and seeing if you get any improvement.

  • Joe Weissman

    Zennmaster, It is a great thing that you have done. I have installed the hardware and software on a Prusa I3v10 and the leveling function does not work properly. After a G28, the G29 results in a probe at the right rear corner 0,0 position and then the probe transitions to the far left rear corner and goes off the platform, resulting in a crash as the switch cannot make contact. It then advances forward and repeats in the same y position. I have spaced the coordinates pretty far inside the build area and the excursion should not be as far as it is.

  • Joe Weissman

    Also, the z-acceleration with raising the probe seems crazily high. This is causing the Z-axis stepper motors to jam.

  • Lex

    how do you get yours to home at that position that is shown on the the video(14:21)? mine will home(when G28 is sent) at the opposite corner of that spot.


    • In your Configuration.h, look for these lines:

      #define INVERT_X_DIR true // for Mendel set to false, for Orca set to true
      #define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false

      Change them to the opposite of what they are currently.

      You may also need to reset these lines:

      // Sets direction of endstops when homing; 1=MAX, -1=MIN
      #define X_HOME_DIR -1
      #define Y_HOME_DIR -1

  • Curtis Wood


    Thanks for the VERY nice tutorial here, it was the only one I saw that mentioned the ‘min_software_endstops’ setting which is just a little important πŸ™‚

    I’m finally doing a test print with auto bed leveling after 6+ hours of messing with it. I was having the same problem a few other people were having above with the probe settings not taking affect, and essentially printing in mid air. I found in another forum that the issue seems to be some bad settings stuck in EEPROM that are over riding the probing. The fix, for me at least, is to execute M502 (restore EEPROM to default [Configuration.h] settings) and then M500 to save them back.

    Make sure to update Configuration.h with the stepper settings on each axis other wise the calibration will need to be redone, also that the EEPROM settings are enabled in the Configuration.h.

  • Lemm


    autoleveling is very frustrating for me. I mostly followed your instructions (I use a inductive probe instead of a micro switch) but leveling doesn’t work. On one side of the bed the PLA sticks perfectly on the other side (Xmax, Ymax) it is too high.

    here is my G29 output if you’re interested
    21:29:17.802 : Bed x: 80.00 y: 20.00 z: 0.06
    21:29:24.767 : Bed x: 140.00 y: 20.00 z: 0.14
    21:29:31.696 : Bed x: 200.00 y: 20.00 z: 0.33
    21:29:38.771 : Bed x: 200.00 y: 100.00 z: 0.81
    21:29:45.745 : Bed x: 140.00 y: 100.00 z: 0.79
    21:29:52.731 : Bed x: 80.00 y: 100.00 z: 0.71
    21:29:59.867 : Bed x: 80.00 y: 180.00 z: 1.00
    21:30:06.845 : Bed x: 140.00 y: 180.00 z: 1.04
    21:30:13.848 : Bed x: 200.00 y: 180.00 z: 1.01
    21:30:13.857 : N359 M105 *8
    21:30:13.871 : Eqn coefficients: a: 0.00 b: 0.01 d: -0.02
    21:30:13.871 : planeNormal x: -0.00 y: -0.01 z: 1.00
    21:30:13.871 : echo:endstops hit: Z:1.01

    do you have any ideas ?

  • Mike

    Hi I just got a new hotend, switching from the magma to a e3d v6, and I am having trouble getting the new G92 X0 Y0 Z0 spot to be stored – it’s keeping the old spot. I have tried resetting the eeprom and reflashing several version of Marlin. Is there a trick to overwriting the existing G92 X0 Y0 Z0 spot?


    • The only thing you need the G92 for is to temporarily establish a “zero-point” so you can measure the offsets for your Z-probe. There’s no need to store that value.

      So, just to make sure, When you’ve got the nozzle resting on the mark on your bed, you issue the G92 X0 Y0 Z0.

      On your LCD, you should now see all your positions (X,Y,Z) at 0. If they’re not, then something went wrong with the command. Make sure you’re using all caps for one.

      If you see that you’ve got zeros on your LCD, then you’re fine. Raise the hotend, extend the probe, then put the trigger of the probe on the dot. You should now be able to read the offsets from your LCD (they will be the current X,Y, and Z positions). At this point, nothing needs to be stored to EEPROM.

      In your Configuration.h, you’ll need to enter your new offsets (reversing the signs).

      That’s what you need to re-flash.

      The 0,0,0 point gets reset each and every time a G28 (home) gets issued, so there’s no reason or point in saving it.

      Hope this helps!

  • Adam Filipowicz

    im getting this error (only showed up after i entered in probe offsets

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.
    Arduino: 1.0.6 (Windows NT (unknown)), Board: “Arduino Mega 2560 or Mega ADK”
    In file included from /Marlin.h:22,
    from BlinkM.cpp:5:
    /Configuration.h:447:9: error: floating constant in preprocessor expression
    /Configuration.h:452:13: error: floating constant in preprocessor expression
    /Configuration.h:456:9: error: floating constant in preprocessor expression
    /Configuration.h:461:13: error: floating constant in preprocessor expression

    here are my probe offsets


    NOTE: my X and Y stepper motor plugs are in backwards

  • Adam Filipowicz

    turns out taking off the decimal place on the x and y fixed the problem.

  • Thanks for your videos, they have been a great help. But I have a problem I don’t understand. After I home the printer with g28 and things happen as expected. When I give a g29 command, all hell almost breaks out. The head stays to the back of the bed where it homed, then samples and moves from right to left, and looks like it takes four samples as it moves to the left. The probe does not look like it moves up and down just retracts, then extends. Using the four bed sampling points you suggested in your config file. Any ideas?

  • […] a bit of an issue with auto bed leveling for my prusa i3v. I've been following this guide (http://zennmaster.com/random-things/auto-bed-leveling-for-the-makerfarm-prusa-i3-part-3-final-setup). After running the G29 E command, the Z-axis doesn't lower to the bed and remains floating […]

  • Amagnu

    Just want to say a BIG thanks mate, top stuff. as for all the other ‘it don’t work properly’ comments, worked for me first time, just take your time pause Zens video and change settings in config. A word of warning tho, made a bad mistake of probe wires to red n black on end stop ( Mine has 3 wires use yellow and red) or super WHITE lcd, iffy burning smell, increased heart rate and the quickest I have moved in 30 years. dont forget to change your slic3r settings. thanks again mate πŸ™‚

  • Franck

    Thanks for the excellent tutorial.
    I’m able to make a four points autolevelling calibration but when I launch the print process, the hotend touch hardly the bed and I have to power off my printer.
    I followed all the steps of your tutorial, where I’m wrong ?
    P.S x : -25.80 y: 52.80 z : 17.22 becomes : x:25.80 y:-52.80 z : -17.22 right ?

Leave a 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>