# Specific 3D Printers, Scanners, & Hardware > RepRap Format Printer Forum > Firmware Enhancements to Marlin >  Varying results from G29, inconsistent with M48

## MichaelBrock

First time post to these forums!  I have been lurking/posting in the reprap.org forums but this seems a much better place for marlin questions.  I will be digging through the enhanced G29 thread as soon as I have posted this.

I have been having bed leveling issue since updating to Marlin 1.0.2 (and they were even worse when I tried the 1.1 release candidate).  The height of the first print step varies a great deal. I'll have the z probe offset tuned in, and then the next print it will be printing  too far above the glass or grinding into the plate.

My start code has in it:

G28
G29

and I'm printing with a SmartRap Core (corexy) on plate glass with aluminum foil tape underneath. I'm using an inductive sensor that triggers almost 2cm above the glass/foil bed.

I ran a series of G29s (after a G28) to check on consistency and found that it varies quite a bit, certainly enough to explain the differences I'm seeing:

Bed x: 40.00 y: 40.00 z: 3.09
Bed x: 115.00 y: 40.00 z: 3.18
Bed x: 190.00 y: 40.00 z: 3.53
Bed x: 190.00 y: 115.00 z: 3.59
Bed x: 115.00 y: 115.00 z: 3.98
Bed x: 40.00 y: 115.00 z: 3.98
Bed x: 40.00 y: 190.00 z: 4.03
Bed x: 115.00 y: 190.00 z: 3.91
Bed x: 190.00 y: 190.00 z: 4.04
Eqn coefficients: a: 0.00 b: 0.00 d: 3.13
planeNormal x: -0.00 y: -0.00 z: 1.00
echo:endstops hit:  Z:4.05

Bed x: 40.00 y: 40.00 z: 2.83
Bed x: 115.00 y: 40.00 z: 2.97
Bed x: 190.00 y: 40.00 z: 3.32
Bed x: 190.00 y: 115.00 z: 3.38
Bed x: 115.00 y: 115.00 z: 3.78
Bed x: 40.00 y: 115.00 z: 3.77
Bed x: 40.00 y: 190.00 z: 3.81
Bed x: 115.00 y: 190.00 z: 3.72
Bed x: 190.00 y: 190.00 z: 3.82
Eqn coefficients: a: 0.00 b: 0.00 d: 2.89
planeNormal x: -0.00 y: -0.00 z: 1.00
echo:endstops hit:  Z:3.83

Bed x: 40.00 y: 40.00 z: 3.15
Bed x: 115.00 y: 40.00 z: 3.24
Bed x: 190.00 y: 40.00 z: 3.60
Bed x: 190.00 y: 115.00 z: 3.65
Bed x: 115.00 y: 115.00 z: 4.03
Bed x: 40.00 y: 115.00 z: 4.05
Bed x: 40.00 y: 190.00 z: 4.10
Bed x: 115.00 y: 190.00 z: 3.98
Bed x: 190.00 y: 190.00 z: 4.09
Eqn coefficients: a: 0.00 b: 0.00 d: 3.20
planeNormal x: -0.00 y: -0.00 z: 1.00
echo:endstops hit:  Z:4.10

This suggests quite a bit of slop in the sensor reading.  The probe itself is held quite rigidly .   So I ran a series of M48 Z-probe repeatability tests at various points around the bed and they were very consistent.  Measurements made in the same spot were very consistent.  For example:

M48 Z-Probe Repeatability test.   Version 2.00
Full support at: http://3dprintboard.com/forum.php
Positioning probe for the test.
1 of 10   z: 4.045954 mean: 4.045954   sigma: 0.000000
2 of 10   z: 4.039710 mean: 4.042832   sigma: 0.003122
3 of 10   z: 4.033466 mean: 4.039710   sigma: 0.005098
4 of 10   z: 4.033466 mean: 4.038149   sigma: 0.005177
5 of 10   z: 4.033466 mean: 4.037212   sigma: 0.004995
6 of 10   z: 4.039710 mean: 4.037629   sigma: 0.004654
7 of 10   z: 4.039710 mean: 4.037926   sigma: 0.004370
8 of 10   z: 4.033466 mean: 4.037369   sigma: 0.004345
9 of 10   z: 4.033466 mean: 4.036935   sigma: 0.004277
10 of 10   z: 4.039710 mean: 4.037213   sigma: 0.004142
Mean: 4.037213
Standard Deviation: 0.004142
echo:endstops hit:  Z:4.05
M48 Z-Probe Repeatability test.   Version 2.00
Full support at: http://3dprintboard.com/forum.php
Positioning probe for the test.
1 of 10   z: 4.027223 mean: 4.027223   sigma: 0.000000
2 of 10   z: 4.033466 mean: 4.030344   sigma: 0.003122
3 of 10   z: 4.033466 mean: 4.031385   sigma: 0.002943
4 of 10   z: 4.033466 mean: 4.031905   sigma: 0.002704
5 of 10   z: 4.027223 mean: 4.030969   sigma: 0.003059
6 of 10   z: 4.033466 mean: 4.031385   sigma: 0.002943
7 of 10   z: 4.027223 mean: 4.030790   sigma: 0.003090
8 of 10   z: 4.027223 mean: 4.030344   sigma: 0.003122
9 of 10   z: 4.033466 mean: 4.030691   sigma: 0.003103
10 of 10   z: 4.033466 mean: 4.030969   sigma: 0.003059
Mean: 4.030969
Standard Deviation: 0.003059
echo:endstops hit:  Z:4.04

The repeatability tests are showing much less variance than I'm seeing with G29.   Any ideas why?

----------


## Roxy

The G28 and G29 use different probe methods.  You can safely ignore the differences between the two functions.   It does appear your bed has a significant tilt to it.   The less that the Auto Bed Leveling has to correct, the better the job it will do.     If you can't get the latest Release Candidate (Actually...  You are better off with the Bug Fix version of it...)  to work for you over at https://github.com/MarlinFirmware/Marlin/tree/RCBugFix  you might want to consider this fork:   https://github.com/beckdac/Marlin   This fork has most of the good stuff folded into it and it is very very stable.   It is not suitable for Delta's however.

----------


## MichaelBrock

Roxy,

Thanks for the quick reply. I guess I am not making sense of the numbers returned by G29 and G48, or they don't mean what I think/thought they do.

I'll add some bed leveling capability to my bed to reduce the tilt.  

My auto-bed leveling attempts with the release candidate were so bad I'm reluctant to try it again.  I have been following the issue threads  at github but  I haven't seen any that appear to address the auto bed leveling (or maybe they are fixed issues by now).  Ironically, ABL seemed to work better when I was running 1.0.1 and my bed had an even more significant tilt to it than it does now!

----------


## MichaelBrock

I just realized that you said that "G28 and G29 use different probe  methods" but my question was pertaining to the difference I am seeing  between G29 and M48.   

To reiterate and to pick a particular measurement point:  in my testing I ran a series of  G29 and the z measured at x:190, y:190  varies (cut/paste just the last line of the G29 results):

Bed x: 190.00 y: 190.00 z: 3.86
Bed x: 190.00 y: 190.00 z: 4.04
Bed x: 190.00 y: 190.00 z: 3.82
Bed x: 190.00 y: 190.00 z: 4.09

So z is varying from 3.82 to 4.09

If I do M48 at that same position:

M48 Z-Probe Repeatability test.   Version 2.00
Full support at: http://3dprintboard.com/forum.php
Positioning probe for the test.
1 of 10   z: 4.045954 mean: 4.045954   sigma: 0.000000
2 of 10   z: 4.039710 mean: 4.042832   sigma: 0.003122
3 of 10   z: 4.033466 mean: 4.039710   sigma: 0.005098
4 of 10   z: 4.033466 mean: 4.038149   sigma: 0.005177
5 of 10   z: 4.033466 mean: 4.037212   sigma: 0.004995
6 of 10   z: 4.039710 mean: 4.037629   sigma: 0.004654
7 of 10   z: 4.039710 mean: 4.037926   sigma: 0.004370
8 of 10   z: 4.033466 mean: 4.037369   sigma: 0.004345
9 of 10   z: 4.033466 mean: 4.036935   sigma: 0.004277
10 of 10   z: 4.039710 mean: 4.037213   sigma: 0.004142
Mean: 4.037213
Standard Deviation: 0.004142

Here z is varying considerably less.   Running M48 after each G29 results in consistent values (i.e. the M48 is not varying by whatever is causing G29 to vary)    Maybe I should look into rewriting G29 to use the probe test from M48  :Big Grin:

----------


## Roxy

First...  Your M48 numbers look good!  You should be able to do Auto Bed Leveling!

Second...  On those multiple G29 runs...  You should do a G28 immediately before a G29.   The reason is you don't want to be running G29 in a 'corrected' coordinate system.  There is debate on this point but right now, do a G28 before a G29.  And if you compare the G29's at that point I suspect they are going to correlate better.

M48 doesn't care about the Z=0.000 point.   It just gets close to the bed and measures what the current coordinate system is giving.   M48 is only measuring the repeatability of the Z-Probe (under different circumstances).  I am fixing the M48 code to work for Delta's.   And one of the things that might carry over for the Cartesian printers is this:  M48 probably should operate in an 'UnCorrected Coordinate' system.  That is not the case currently.   It doesn't really matter but it does cause confusion like this.

G29 is trying to construct a new coordinate system that will result in 'flat' moves across the bed for a given Z number.  There is a lot of discussion about how G29 should do that.  But at the end of the day, G29 needs to add in the values probed to its offset.   You get debate whether it should be a point from the center of the bed or the mean of all points.  You also get debate about whether the Z-Probe Offset should be factored into the Z equals 0.000 point.  It is a very complicated subject.   And in fact, Delta's do Auto Bed Correction differently because they have extra issues with the bowl shaped coordinate system.

Did you try applying your Configuration.h file to the BeckDac fork?   I suspect it is going to work very well for you.  If you bring up the BeckDac fork you can ignore all the other Auto Bed Leveling talk until things get resolved.

----------


## MichaelBrock

I had not been running G28 between the G29s.  I ran into a discussion, either here or in the Marlin github issues, discussing whether or not it was needed for a succession of G29s.   I think you were likely a part of that conversation  Roxy and I'd like to thank you for discussing your work with Marlin with the rest of us!  I have delved into the issues discussion in Marlin's github but often times I feel like I'm missing half the conversation.

I'll give the BeckDac fork a try.  One nice thing about Arduino is that changing the firm ware couldn't get much simpler!

----------

