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:

#define X_PROBE_OFFSET_FROM_EXTRUDER -25
#define Y_PROBE_OFFSET_FROM_EXTRUDER -29
#define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35

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

#define X_PROBE_OFFSET_FROM_EXTRUDER 29.85
#define Y_PROBE_OFFSET_FROM_EXTRUDER -1.85
#define Z_PROBE_OFFSET_FROM_EXTRUDER -8.40

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:

#define LEFT_PROBE_BED_POSITION 50
#define RIGHT_PROBE_BED_POSITION 150
#define BACK_PROBE_BED_POSITION 150
#define FRONT_PROBE_BED_POSITION 50

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

  • Patrick

    Thanks for the tutorial. I’m using the new configuration with success. It’s so nice not to have to muck with the z-endstop screw any longer.

  • Chad

    Thank you so much, this helped immensely. I do have a problem though. Immediately after the auto-level finishes, the Z-axis will drive down for no reason, (with the servo switch still down. I, like most people, have found the servo cant swing back up until the carriage lifts), and will then raise back up to its normal spot where it does the 3mm extrusion before it begins the print. This is kind of annoying as not only is it pointless, it sometimes lifts the carriage off of one of the nuts. Here is my GCode setup:
    G28 ;home axis
    G29 ;z auto level
    G1 Z5 F5000; lift nozzle
    G1 Z15.0 F{travel_speed}

  • Samuel Benevenia

    Hey,
    I have setup auto bed leveling but I am running into a problem where my probe,upon retraction, makes contact with the bed and actually moves the bed. Also I noticed that in your video the prob remains extended throughout the leveling process where mine retracts after each probing measurement. In addition my firmware will not allow me to use numbers with decimals for the x and y offset. I have measured the probe offset 3 times and I’m consistently getting -20.5, -2.5, 0.6, for x, y, and z. One more thing when I use a G28 command my extruder moves close to the reference point where I was measuring the offset and not the back right corner where it used to home. I tried using a G92 command to reset the home but G28 seems to override it. I appreciate your videos and posts they have been helpful.I have a video of my auto bed leveling as well as a text file of my firmware ready to go if you would need to take a look at it.
    Thanks,
    Sam

  • Chip Kigar

    I wanted to let you know that your postings of your efforts have been a great help. I got a lot of information from your build and this discussion of ABL. Just want to say..

    thank you very much for sharing!

  • Hi,

    I’ve made an auto level for my Prusa i3.
    The only problem I have is the Z-offset is different depending on the machine temperature.
    The difference between cold setup (as taken measurements) and hot (heat soaked) condition can be as big as 0.8mm.
    In this case it is very hard to print anything as I need to either wait for some time (30 minutes or longer) so the printer and especially the bed can soak with heat, or adjust the z-offset every single time…
    Any advise? My Prusa I3 has MDF frame for X & Z axis. Y-axis is threaded type. Insulate/or encapsulate? During G29 and creation of the normalized plane – machine know exactly when the stop occurred vs the nozzle height – I think it would be possible to adjust the Z-offset with M851 after the G29 measurements ad-hoc?

  • dave

    Great article.

    1 small suggestion for those that will use this as a guide to setup their auto tramming.

    On my MendelMax 3, I found that if I did G28 followed by G29 in my start code, I could only use 1/2 of my print bed. The Y position counter would reset from the center of the build plate at the end of the G28 command.

    I was able to correct this by changing ‘G28’ to “G28 X Y” and no longer have the issue

  • Brad

    Does anyone know if these steps will work with the rumba board? I know that you plug into the exp3 header just don’t know if there are any other differnt steps involved.

  • Hadi

    Hi , I set auto bed leveling feature for my 3D printer but after that the Z axis started to have a problem , I think it’s from the firmware … the problem is ( when I raise it up some times the two motors go up together while other times they go in different directions ) Could you please help me … it’s a tough problem for me !
    Do you want my firmware to send it to you using email ?
    Thank you .

  • Gary Tonini

    Hi
    I enjoy your videos I have a question for you you mention to set the settings to probe at 50 150 150 50 how does this work lets say I wish to probe further out or closer do you increase the numbers or decrease them sorry for this question but I’m new to all this.

    Thanks
    Gary

  • Felix

    Thank you for the videos. It’s really helped immensely with getting auto bed leveling setup on my current configuration. Previously I was running an azteeg x5 mini with an inductive probe, but noticed that it was hit or miss with detecting the bed. I’ve since then rewired with a rambo 1.3 and did the servo setup like you showed. I’m always still paranoid about crashing into the bed…

    My Question: Do you normally do calibration before each print or do you calibrate once and save via M500 ?

    I’m looking to have the printer calibrate before each print so I don’t have to manually do bed leveling again.In my old start code i would home, then calibrate then prime and go. I was wondering if I could do the same, by homing, calibrate(G29) then prime and go ?

    Thank you again!!

  • Youngjedi

    Hello,
    I have built and installed the auto leveler. I have the Makerfarm 10. When I set up the configuration h file as per your video, I use the arduino program to flash the ramps. Problem I get is that it errors out when compiling. It says there is an unknown motherboard value. Can you point me in the right direction?

  • Youngjedi

    An update to my previous post. I found the Makerfarm Marlin with the auto bed level. Works fine except for one issue that I cannot solve. I went through the setup and got my offsets from placing the hot end in the center and programming center to be home (g92 x0 y0 z0). Now that I have those offsets, I want to program the home to be in the back right corner. I walked the X, y, z to the end stops, and did another g92 x0 y0 z0. When I tell the head to go home, X and y work perfectly, then the head goes to center of bed and touches off. I cannot figure out how to program z home to be in the back right.

    Any thoughts? Thanks.

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>