Bed leveling micro



  • I've created a simple bed leveling micro for my printer. This might be useful for some of you before we get the auto bed leveling feature. My z-axis is controlled by two ballscrews on either side of the bed alone the x-axis. My micro levels the bed by leveling two points on the bed on either side of the X axis. If you have 3 steppers controlling the z-axis you need to modify the micro to run alone both x and y axis one after another.

    I'm running 3 iterations of the leveling process in the micro. In each iteration the micro will output the heights of the two points you are trying to level. You'll know the bed is level when they are close to each other. You can run the micro multiple times, it takes 20 seconds each time for me. Here is an example, I intentionally moved one side 3mm higher than the other side.

    [[language]]
    Stopped at height 1.014 mm
    Stopped at height -1.276 mm
    
    Stopped at height 0.290 mm
    Stopped at height -0.403 mm
    
    Stopped at height 0.057 mm
    Stopped at height -0.102 mm
    
    

    Since the initial difference is large my bed is not level after the first run. Here is the second run, the two points are on the same height after second run:

    [[language]]
    Stopped at height -0.021 mm
    Stopped at height -0.024 mm
    
    Stopped at height 0.000 mm
    Stopped at height -0.011 mm
    
    Stopped at height 0.001 mm
    Stopped at height -0.003 mm
    
    

    Here is the code, you need to change the position of the the two points, z motor mapping, and possibly the feedrate of the movements :

    [[language]]
    ; Setup
    G91
    G1 Z5 F3600 ; Move the platform down. You might need to change the feedrate
    G90
    G1 X136 Y90 F3600 ; Move to center of bed
    M561 ; Disable bed compensation
    G30
    G92 Z0 ; Set Probe trigger point to 0 to make it easier for comparison, and you don't have to change the micro everything you change your trigger height
    
    ; Iteration 1
    ; Left Side
    G1 Z5 F3600  ; Move the platform down. You might need to change the feedrate
    G1 X72 F3600 ; Move to the left point
    
    G30 S-1 ;  Probe without changing the Z height
    M584 Z8 ; Unmap the left side motor, leave the motor on the opposite site of the point you are probing
    G1 Z0 
    M584 Z7:8 Restore Z motor mapping
    
    ; Right Side
    G1 Z5 F3600
    G1 X200 F3600 ; Move to the right point
    
    G30 S-1
    M584 Z7  ; Unmap the right side motor, leave the motor on the opposite site of the point you are probing
    G1 Z0
    M584 Z7:8
    
    ; Iteration 2 and 3 are identical to iteration 1
    ; Iteration 2
    ; Left Side
    G1 Z5 F3600
    G1 X72 F3600
    
    G30 S-1
    M584 Z8
    G1 Z0
    M584 Z7:8
    
    ; Right Side
    G1 Z5 F3600
    G1 X200 F3600
    
    G30 S-1
    M584 Z7
    G1 Z0
    M584 Z7:8
    
    ; Iteration 3
    ; Left Side
    G1 Z5 F3600
    G1 X72 F3600
    
    G30 S-1
    M584 Z8
    G1 Z0
    M584 Z7:8
    
    ; Right Side
    G1 Z5 F3600
    G1 X200 F3600
    
    G30 S-1
    M584 Z7
    G1 Z0
    M584 Z7:8
    
    ; Final Probe
    G91
    G1 Z5 F3600
    G90
    G1 X136 Y90 F3600 ; Move to center of bed
    G30 ; Probe again since the Z height is changed.
    
    

  • administrators

    I can't test this as I don't have a cartesian printer with two seperately driven Z motors however the output looks great!

    I am really impressed in general as it shows how much can be done with the macro system. Thanks Shen!


Locked
 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.