1. Got a question or need help troubleshooting? Post to the troubleshooting forum or Search the forums!

Auto Bed Leveling

Discussion in 'Mods and Upgrades' started by Peter Krska, Jan 13, 2014.

  1. Peter Krska

    Peter Krska Active Member

    Joined:
    Nov 30, 2013
    Messages:
    766
    Likes Received:
    229
    I found some stuff on Auto Bed Leveling. Since we are also using Merlin, can this be possible to do on the Robo 3D printer? The following was made for Ultimaker. But I am sure it could be modified for any printer.

    =======================
    https://github.com/Bevaz/Marlin/tree/Joysmaker_auto_level_1.00
    =======================
    Uncomment the "ENABLE_AUTO_BED_LEVELING" define (commented by default)
    You will probably need a swivel Z-MIN endstop in the extruder. A rc servo do a great job. Check the system working here: (Enable English subtitles) Teasing ;-) video:
    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º)
    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 ;-)
    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)
    • #define X_PROBE_OFFSET_FROM_EXTRUDER -24.3
    • #define Y_PROBE_OFFSET_FROM_EXTRUDER 31.4
    • #define Z_PROBE_OFFSET_FROM_EXTRUDER -5.1
    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:
    • #define LEFT_PROBE_BED_POSITION 30
    • #define RIGHT_PROBE_BED_POSITION 140
    • #define BACK_PROBE_BED_POSITION 140
    • #define FRONT_PROBE_BED_POSITION 30
    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.
    • #define Z_RAISE_BEFORE_PROBING 10
    • #define Z_RAISE_BETWEEN_PROBINGS 10
    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.
    That's it.. enjoy never having to calibrate your Z endstop neither leveling your bed by hand anymore ;-)

    ==========================================
    http://www.thingiverse.com/thing:225584/#instructions
    ==========================================
    To build it you need
    1) Servo sg90 or similair.
    2) Microswitch
    3) Connectors
    4) Wires
    5) Printed parts
    Build steps:
    1) Printed parts: servo mount and probe mount
    2) Wire servo. Connect it to the board (see picture)
    3) Wire microswitch. Replace min z-endstop with it.
    4) Mount everything to the print head.
    5) Note that upper point of the probe is the maximum clockwise position of the servo. Attach the probe accordingly.
    6) Download Marlin firmware from https://github.com/Bevaz/Marlin/tree/Joysmaker_auto_level_1.00 and upload to the board. It is derevative from Ultimaker firmware. So it will work with original Ultimaker.
    7) Modify start GCODE in Cura:
    ...
    G28 X0 Y0 ;move X/Y to min endstops
    G28 Z0 ;move Z to min endstops
    G29 ;probe Z to min endstops
    G1 X0 Y0 Z15.0 F{travel_speed} ;move the platform down 15mm
    ...
    8) To align the offset of the probe from the nozzle adjust macro Z_PROBE_OFFSET_FROM_EXTRUDER in Marlin Configuration.h
    Or use LCD module. Menu->Control->Motion->Z-Offset. You can also save this settings in EEPROM.
    9) Enjoy and forget about bed-leveling nightmare.
     
    6 people like this.
  2. tompeel1

    tompeel1 New Member

    Joined:
    Apr 18, 2013
    Messages:
    78
    Likes Received:
    17
    Anyone have a the Gcode for the initial extrude to clear the hot end?
     
  3. tonycstech

    tonycstech Active Member

    Joined:
    Dec 16, 2013
    Messages:
    561
    Likes Received:
    187
    G1 F200 E10 ;extrude 10mm of feed stock
     
    2 people like this.
  4. EddyBorja

    EddyBorja New Member

    Joined:
    Nov 28, 2013
    Messages:
    33
    Likes Received:
    3
    Anybody done this? I'm going to implement auto level in my printer soon.
     
  5. Peter Krska

    Peter Krska Active Member

    Joined:
    Nov 30, 2013
    Messages:
    766
    Likes Received:
    229
    I would be interested in seeing your leveling idea.
     
  6. Ziggy

    Ziggy Moderator
    Staff Member

    Joined:
    Feb 20, 2013
    Messages:
    707
    Likes Received:
    530
    I have Auto Bed Leveling working on my Robo. The function really should be called Auto Bed Height Compensation.

    Anyway I now have a simple, rock solid, accurate Z Probe using an opto endstop. However I had to modify the standard Marlin code to be able to use an opto endstop in this mode.

    At some point I will put the files on Thingiverse and put a Marlin change request to the Github team. Won't be able to do that for a while as I'm traveling 6 weeks in sunny France :)

    I think the Robo guys are going to use a Z nut contact for the Z Probe. I'm interested to see if that can be made accurate and precise.

    IMG_0151.JPG




    EDIT: Raised an issue on github. Hopefully they will get to it while I'm away

    https://github.com/ErikZalm/Marlin/issues/882
     
    4 people like this.
  7. Ziggy

    Ziggy Moderator
    Staff Member

    Joined:
    Feb 20, 2013
    Messages:
    707
    Likes Received:
    530
    For anyone thinking about adding the Auto Leveling (Bed Height Compensation) mod.....

    IMO this function in the new Marlin absolutely transforms the way the Robo works. And no more fiddling with that @#$%^&* Z Axis screw height adjuster.

    The bed height compensation is a great feature but..

    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 simply changing the Z Offset value on the LCD controller motion control menu. And this can be done to 0.xx mm precision!! Pretty much at the limits of the machine dimensional repeatability.

    I've now done quite a few prints with the mod. I just hit print now. Don't even need to watch the skirt loops anymore. Best $10 and few hours I've ever spent on this Robo.

    A word of caution though.. The mods in Marlin to make this work are reasonably complex. And you need to understand that with the Z probe there is no Z Min Limit switch anymore and no Z homing function. All of the software mods required are not yet in the stock Robo Marlin.
     
    3 people like this.
  8. Peter Krska

    Peter Krska Active Member

    Joined:
    Nov 30, 2013
    Messages:
    766
    Likes Received:
    229
    I wonder if an auto leveling system can be made in real time? Why not have a probe right next to the nozzle end that moves along the print bed and gives feedback back to the system moving up or down accordingly?

    That way you could print on dirt for all intensive purposes!!!


    Sent from my iPhone using Tapatalk
     
  9. tesseract

    tesseract Moderator
    Staff Member

    Joined:
    Feb 20, 2013
    Messages:
    1,924
    Likes Received:
    533
    I doubt it cus the probe would be impacting the print after the first layer
     
  10. Jay

    Jay New Member

    Joined:
    Jan 18, 2014
    Messages:
    12
    Likes Received:
    5
  11. SteveC

    SteveC Well-Known Member

    Joined:
    Jun 12, 2013
    Messages:
    894
    Likes Received:
    316
    Ziggy,
    Nice, I looked through the code and it is a pretty straightforward change. I will need to figure out another mounting scheme because my E3D fan will be in the way. Is that a sub micro or nano size servo?
     
  12. Ziggy

    Ziggy Moderator
    Staff Member

    Joined:
    Feb 20, 2013
    Messages:
    707
    Likes Received:
    530
    There's more to the change than just the Marlin_main.cpp code, the handling of the Z min endstop is quite complex throughout Marlin and it is far too easy to create unintended consequences. If you look at the other issues on github, there are some bugs in the auto leveling code as well. I am not saying wait. Just be aware that some Mxxx and Gxx commands don't always work as you might expect.

    The servo is a 9g (ie 9 gram) often called model SG90. There are 100's of them on eBay for < $4 delivered.

    The mounting scheme with the two spare screw holes on the side of the x carriage is absolutely perfect for the job. If you have to find another mount, ideally the tip of the probe needs to be close as possible to the hotend nozzle.
     
  13. Ziggy

    Ziggy Moderator
    Staff Member

    Joined:
    Feb 20, 2013
    Messages:
    707
    Likes Received:
    530
    6 people like this.
  14. EddyBorja

    EddyBorja New Member

    Joined:
    Nov 28, 2013
    Messages:
    33
    Likes Received:
    3
    Hey guys, while building my Kossel 3D printer, I came across this
    http://3dprintingindustry.com/2014/...esistors-make-auto-bed-levelling-3d-printers/

    This technique uses force sensors under the glass bed so that the hotend itself can act as a z probe. This seems a lot more accurate and simpler than having another dedicated z probe.

    Anyone have any good ideas on how this could be incorporated into a robo3d, or does it require a fixed bed?
     
  15. Ziggy

    Ziggy Moderator
    Staff Member

    Joined:
    Feb 20, 2013
    Messages:
    707
    Likes Received:
    530
    Obviously this technique could only be accurate if the nozzle is hot and there is no gunk on the nozzle.
     
  16. EddyBorja

    EddyBorja New Member

    Joined:
    Nov 28, 2013
    Messages:
    33
    Likes Received:
    3
    The hotend does not need to be hot, only clean. It's a lot easier to ensure the hotend is clean than to precisely measure the distance between the tip of the z probe and the hotend.
     
  17. Mike Kelly

    Mike Kelly Volunteer

    Joined:
    Mar 11, 2013
    Messages:
    6,967
    Likes Received:
    2,274
    Well he's saying that if there's a piece of plastic on the hot end it'll affect the calibration. In principle you could do that on a moving bed, but that's a much bigger challenge.
     
  18. EddyBorja

    EddyBorja New Member

    Joined:
    Nov 28, 2013
    Messages:
    33
    Likes Received:
    3
    Maybe if the moving bed rested on top of some kind of supports that hold it in place rather than bolted, then perhaps it could be possible to place the sensors between the bed and the support to get readings.
     
  19. Ziggy

    Ziggy Moderator
    Staff Member

    Joined:
    Feb 20, 2013
    Messages:
    707
    Likes Received:
    530
    The hotend would need to be hot, otherwise any cold hard plastic on the nozzle will stuff up the readings.

    I am not sure I would agree that cleaning the nozzle every time you start a print is easier than calibrating the Z probe position measurements once.

    Nevertheless using force sensors is an interesting idea.
     
  20. warlocke

    warlocke Active Member

    Joined:
    May 10, 2013
    Messages:
    127
    Likes Received:
    58
    I always clean my nozzle after a print. I just use a pair of needle nose to nip off the final ooze as it cools and its clean.
     

Share This Page