Mesh bed leveling for your CNC

Before I start I want to thank “UnLtdSoul” for his contributions to “CNC leveling” a few years back. I looked at his mods to Marlin, but they no longer worked with the latest release 1.1.9. I always thought this should be possible, his work showed me where to start. Thank you!

As many of you know Marlin has the ‘bed size’ hard coded in ROM in configuration.h. G29 would only work with those values, and it also no longer accepted X and Y inputs in ver 1.1.9. I modified the behavior of G29 as follows: Allow X and Y inputs to specify how many points to sample in x and y planes, and also to specify the size of the work piece using the L, F, R, B input parameters. I also added a new gcode command; G24, which makes the machine think it’s been homed. This allows machines without endstops to do ‘bed leveling’.

I posted a video on the Facebook V1 forum and I posted files there as well. I’ll post files here too. In the video I show a vbit making a perfect large circle with one side of the work raised by half an inch.

Gcode example:

  1. position router either manually or with controls or with gcode in your file.
  2. G90 ; absolute positioning
  3. G21 ; metric mode
  4. G24 ; psuedo ‘home’ command (no motion)
  5. M0 Connect Touchplate ; message and pause to user
  6. G28 Z ; home to your touchplate
  7. G92 xx ; set xx=your touchplate height
  8. M0 Begin Level Probe ; message and pause to user
  9. G29 S5000 X5 Y5 L10 F10 R350 B425
    ; S5000 is the speed to move point to point
    ; sample X5 and Y5 points (25 points total)
    ; left front position of workpiece 10,10
    ; right back position of workpiece 350,425 (substitute your values)CNC-Marlin-Level-mods.zip (129.7 KB)
  10. M500 ; save the mesh
  11. M420 S1 ; turn on leveling
  12. M0 Remove Touchplate ; message and pause to user
  13. Turn on router/spindle and insert your project gcode here
3 Likes

That looks like a neat setup. I would love for Marlin to get this feature and keep it. Why do this on v1.1.9 and not 2.0.x?

Easy answer! I’m running 1.1.9! As far as 2.0.x goes I’m waiting for the bug levels to die down a bit. I haven’t even tried it. If there is a lot of interest I may look at 2.0.x as well. But right now I’m happy with 1.1.9. It’s solid!

Are you running 2.0.x?

Yeah. Ryan started following it a long time ago, when it was just “bugfix-2.0.x”. Most people here have it, if they flashed their controller in the last two years.

I am mostly wondering because Marlin has been pretty receptive to the pull requests we’ve given them. So I am wondering if we could make a PR to make these gcode and mesh leveling features a permanent part of future releases.

I also don’t really follow their development that closely, so I wonder if one of the leveling strategies supports something functionally similar.

I mostly did this mod for myself and others that might be interested. I hadn’t thought about getting it added as a permanent feature. I have talked with ‘thinkyhead’ ([Scott Lahteine) briefly about my mods, but I’ll bring it up to him, see what he thinks!

1 Like

Hi

Did this PR ever get done and accepted?

Thanks

Rob

Hi, I came over this because I’m having some problems using bed leveling.
I implemented it in a similar way. I’m using vac to get things down to bed.
Leveling is done with by Auto Leveling Bilinear. In Firmware I defined a grid of 18x5 Points, that I can level with a probe (mounted to the tool, so it’s driving around). If you have questions about this, just ask :wink:

I’m using this on a big old mpcnc with ramps 1.4. I know, I shouldn’t do big, but for my task it’s ok anf for future I plan to switch to LR3.
Now I’m having the problem, that leveling doesn’t work as expected. After the first row it doesn’t take the correct way back. Sometimes it moves e few mm, sometimes it doesn’t move between probe pionts. I can repeat this, it’s always after the first row of points, where machine changes direction.
I checked cable connections, endstops and switched to current firmware.

Any idea what else I can check?
Could it be a Ramps problem? As I’m planning my LR build with other board, I could switch.

Thanks