G29 mesh probing & bed compensation with 4 Z-motors



  • Hello,

    I am having trouble performing a bed compensation with 4 Z-motors.

    Currently, I use a capacitive NPN NO sensors (Henschen) which works fine. Also I am able to probe the bed using a grid of points through G29. Results are stored in "heighmap.csv".

    What I cannot figure out is how my Duet 2 will then adjust each motor to level the bed (X & Y). "G29 S1" does nothing and when I repeat bed probing the sensor will generate pretty much the same results.

    This is what I have in "config.g" to enable bed leveling:

    ; Axis Limits
    M208 X0:390 Y0:365 Z0:350 S1                         
    
    ; Bed leveling geometry & leveling
    M671 X470:470:-70:-70 Y400:-40:400:-40 	
    M557 X10:380 Y10:355 S185:172.50
    

    This is "bed.g":

    ; Bed calibration
    G28 	
    G29 S1	
    

    This is the output of "heightmap.csv":

    RepRapFirmware height map file v2 generated at 2020-08-12 13:46, min error -1.688, max error 1.053, mean -0.036, deviation 0.832
    xmin,xmax,ymin,ymax,radius,xspacing,yspacing,xnum,ynum
    10.00,390.00,10.00,360.00,-1.00,190.00,175.00,3,3
     -0.039,  1.053, -0.478
      0.504,  0.396, -1.069
      0.464,  0.534, -1.688
    

    I would appreciate a nudge in the right direction. I am getting closer here, everything is working as expected, it's just this last piece that is missing. 🙂

    Thank you!



  • You are missing the G30 steps in your BED.G that needs to come between the G28 and the G29

    see this



  • @Dougal1957 said in G29 mesh probing & bed compensation with 4 Z-motors:

    You are missing the G30 steps in your BED.G that needs to come between the G28 and the G29

    see this

    Thank you. I was under the impression that M557 in "config.g" would suffice to define the mesh size & spacing. That information is stored in "heightmap.csv" would could be used for bed compensation.

    Is G30 therefore really necessary when the mesh size, etc. is already there? I may be missing something here.



  • Leveling and Mesh are 2 totally different systems if you have a bed that is inherently flat then you don't need a mesh but will still need to level it G30 tells it to probe a point near to a leadscrew and then move to another one and repeat till you get to the last one where you need a Sx where x is the number of motors so in your case your last G30 will be G30 Xxxx Yxxx S4.

    You need to define your probe points to be in the same sequence as your motors are defined.

    I am sure someone with a lot more experience of this will come forward soon enough (I have yet to implement the system in a Cube style printer)


  • Moderator

    @wieman01 I think you're confusing 'mesh compensation' and 'bed levelling'. Ideally you level the bed physically with 'bed levelling' first, which adjusts the bed to create a level plane. Then any anomalies in bed shape/height are compensated with the mesh compensation. If you have independently connected Z motors, you can do the bed levelling automatically rather than manually.

    For bed levelling with independent Z motors, see https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors

    It sounds like you already have your mesh compensation sorted. You don't need to have this running from bed.g; it would be more normal to have the bed levelling running in bed.g, and called by G32, then run mesh compensation afterwards.

    Bed levelling should run every time the printer is turned on, because it's possible for Z motors to move, or jump to different full steps, each time they are turned on. Mesh compensation should be more consistent, so once a mesh map has been created, it can be loaded after the bed has been levelled, rather than redoing the mesh compensation every time.

    Ian



  • @droftarts That Ian is a very common mistake made by those coming from the marlin community



  • @Dougal1957 & @droftarts

    Thank you both for your explanation, it does make more sense to me now. In fact I was not aware of the difference between bed leveling and mesh compensation, you are spot-on.

    Mesh compensation should be okay then, I will now try to figure out how to level the bed as @Dougal1957 has explained. That is a good starting point.

    I'll let you know how it goes.


  • Moderator

    @wieman01 This link I posted https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors explains it all, and has code examples (admittedly for 2- and 3-motor Z axes, but a 4th motor shouldn't be difficult to add).

    Ian



  • @droftarts same link as I posted Ian


  • Moderator

    @Dougal1957 Ah, yes, I didn't see the 'see this'!

    Ian



  • Thank you, I saw the post earlier and followed it to the letter. Bed leveling now works and I'll post my "bed.g" later.

    Is there any way I can increase the maximum correction of 1mm? This is a clay printer with a wooden bed, so my tolerances are of very different nature. 🙂

    The web interface displays an error message because of the set limit of 1mm.

    Other than this I think I am done thanks to your help.



  • @wieman01 said in G29 mesh probing & bed compensation with 4 Z-motors:

    Thank you, I saw the post earlier and followed it to the letter. Bed leveling now works and I'll post my "bed.g" later.

    Is there any way I can increase the maximum correction of 1mm? This is a clay printer with a wooden bed, so my tolerances are of very different nature. 🙂

    The web interface displays an error message because of the set limit of 1mm.

    Other than this I think I am done thanks to your help.

    On the M671 the S parameter set the adjustment amount (if left of it defaults to 1mm) but remember that with 4 screws you run a serious risk of warping the bed you can of course run the routine several times and it will converge.



  • @Dougal1957 said in G29 mesh probing & bed compensation with 4 Z-motors:

    @wieman01 said in G29 mesh probing & bed compensation with 4 Z-motors:

    Thank you, I saw the post earlier and followed it to the letter. Bed leveling now works and I'll post my "bed.g" later.

    Is there any way I can increase the maximum correction of 1mm? This is a clay printer with a wooden bed, so my tolerances are of very different nature. 🙂

    The web interface displays an error message because of the set limit of 1mm.

    Other than this I think I am done thanks to your help.

    On the M671 the S parameter set the adjustment amount (if left of it defaults to 1mm) but remember that with 4 screws you run a serious risk of warping the bed you can of course run the routine several times and it will converge.

    Thank you, my friend. That is perfect. Warping won't be an issue, my printer is designed such that it should withstand greater differences well enough. If not, I will try again. 😀

    This is a working copy of my "bed.g":

    
    ; Bed calibration
    G28 							; home
    
    M401 							; deploy Z probe
    
    G30 P0 X380 Y355 H0 Z-99999
    G30 P1 X380 Y10 H0 Z-99999
    G30 P2 X10 Y10 H0 Z-99999
    G30 P3 X10 Y355 H0 Z-99999 S4
    
    M402 							; retract probe 
    

    Here is the relevant section from "config.g":

    ; Bed leveling geometry & leveling
    M671 X470:470:-70:-70 Y400:-40:400:-40 S5	
    

Log in to reply