# Specific 3D Printers, Scanners, & Hardware > RepRap Format Printer Forum > MakerFarm Forum >  How do I set more calibration points for Auto Bed Levelling?

## TehStranger

Hi all,

I recently installed my 8x12 upgrade for my i3v and I would like to have ABL calibrate the entire bed instead of just the 9 points for 8x8 sized bed, how would I go about this?

Thanks.

----------


## Roxy

Things have changed based on the version of the firmware you are running.   But the first step in all cases is to edit your Configuration.h file to set the

#define AUTO_BED_LEVELING_GRID_POINTS 3

higher.   Maybe 5?

----------


## jasay

Assuming marlin firmware, find this section of configuration.h and change the "170" for y to something more appropriate for your 12" bed, e.g. "270".


```
//===========================================================================//============================= Bed Auto Leveling ===========================
//===========================================================================


. . .


  #define AUTO_BED_LEVELING_GRID


  #ifdef AUTO_BED_LEVELING_GRID


    #define LEFT_PROBE_BED_POSITION 15
    #define RIGHT_PROBE_BED_POSITION 170
    #define FRONT_PROBE_BED_POSITION 20
    #define BACK_PROBE_BED_POSITION 170

```

This will change the overall bounds of the autolevel function and the firmware will recalculate the points in the middle, but will not change the number of points.  To do that you can add a "N" command to your gcode.  Something like G29 N4 will do 4 points in each axis (16 total).  I'm not aware of a way to do uneven number of points in X&Y e.g. 3x4 points.

----------


## TehStranger

> Things have changed based on the version of the firmware you are running.   But the first step in all cases is to edit your Configuration.h file to set the
> 
>  #define AUTO_BED_LEVELING_GRID_POINTS 3
> 
>  higher.   Maybe 5?


 It is already set to 5 but it actually homes in 9 different spots.




> Assuming marlin firmware, find this section of configuration.h and change the "170" for y to something more appropriate for your 12" bed, e.g. "270".
> 
> 
> ```
> //===========================================================================//============================= Bed Auto Leveling ===========================
>  //===========================================================================
> 
> 
>  . . .
> ...


I will give that a shot.

Thanks.

----------


## Roxy

> It is already set to 5 but it actually homes in 9 different spots.
> 
> I will give that a shot.
> 
> Thanks.


OK...  You are running the enhanced code!   Then by specifying something like:   G29 n 4   or G29 n 5 you will get more points.

----------


## TehStranger

> OK...  You are running the enhanced code!   Then by specifying something like:   G29 n 4   or G29 n 5 you will get more points.


That's all I have to do? won't it try to home more points on the X axis too though? Sorry I'm still learning all this code  :Frown:

----------


## Roxy

Oh!   Yes, it will do a n x n grid.   We will have to make a small change if you want more points in one direction than the other.

----------


## TehStranger

> Oh!   Yes, it will do a n x n grid.   We will have to make a small change if you want more points in one direction than the other.


alright, where do I start?

----------


## Roxy

> alright, where do I start?


Well...   You just go into the G29 code in Marlin_main.cpp and make some changes.   But if you want somebody else to do that you should probably explain why it is beneficial to have more points taken on one axis than the other.

----------


## TehStranger

> Well...   You just go into the G29 code in Marlin_main.cpp and make some changes.   But if you want somebody else to do that you should probably explain why it is beneficial to have more points taken on one axis than the other.


It isn't beneficial it's just that my bed is 8x12 8 being the X axis so I can't really have it do more points. I don't need someone to do it I just need to be pointed in the right direction  :Smile: 

Thanks

----------


## jasay

I think what Roxy is saying is that the marlin codes does not allow for different number of points in x vs y right now.  Being code, it can of course be changed, but that would require a patch and a reason to accept the patch. That's somebody's work both now and for future maintenance and would need to be justified.  

Right now your 8"X12" bed with a 4x4 grid will have 4 points in X separated by ~2-2.5" and 4 points in Y separated by ~3.5-4".  Is that a problem?  Is there a strong use case for e.g. 3x4 probe instead of 4x4?  If so, maybe someone will help write the patch and argue for inclusion.

----------


## TehStranger

> I think what Roxy is saying is that the marlin codes does not allow for different number of points in x vs y right now.  Being code, it can of course be changed, but that would require a patch and a reason to accept the patch. That's somebody's work both now and for future maintenance and would need to be justified.  
> 
> Right now your 8"X12" bed with a 4x4 grid will have 4 points in X separated by ~2-2.5" and 4 points in Y separated by ~3.5-4".  Is that a problem?  Is there a strong use case for e.g. 3x4 probe instead of 4x4?  If so, maybe someone will help write the patch and argue for inclusion.


Nah that isn't a problem I just didn't think of that. So how exactly do I do that?

Thanks

----------


## jasay

Make sure the bed size is entered in configuration.h like I said above so it knows where to probe.  Then callout G29 NP where P is the number of points you want in each axis.  The software will figure out the gap between points and take care of all the math.

----------


## Roxy

Go get the latest 'Release' version of Marlin from GitHub:  https://github.com/MarlinFirmware/Marlin  (Do not grab the development version which is more 'current' than the last Release version!)    

Go find this code in Marlin_main.cpp.   This code controls the probing across both the X and Y axis.   Change it to be what ever you desire it does:



```

      for (int yProbe = front_probe_bed_position; yProbe <= back_probe_bed_position; yProbe += yGridSpacing) {
        int xProbe, xInc;


        if (zig)
          xProbe = left_probe_bed_position, xInc = xGridSpacing;
        else
          xProbe = right_probe_bed_position, xInc = -xGridSpacing;


        // If topo_flag is set then don't zig-zag. Just scan in one direction.
        // This gets the probe points in more readable order.
        if (!topo_flag) zig = !zig;


        for (int xCount = 0; xCount < auto_bed_leveling_grid_points; xCount++) {
          // raise extruder
          float measured_z,
                z_before = probePointCounter == 0 ? Z_RAISE_BEFORE_PROBING : current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS;
```

----------


## TehStranger

> Make sure the bed size is entered in configuration.h like I said above so it knows where to probe.  Then callout G29 NP where P is the number of points you want in each axis.  The software will figure out the gap between points and take care of all the math.


Tried that but Pronterface is saying [ERROR] Error line number is not last line number+1, last line: 0




> Go get the latest 'Release' version of Marlin from GitHub:  https://github.com/MarlinFirmware/Marlin  (Do not grab the development version which is more 'current' than the last Release version!)    
> 
> Go find this code in Marlin_main.cpp.   This code controls the probing across both the X and Y axis.   Change it to be what ever you desire it does:
> 
> 
> 
> ```
> 
>       for (int yProbe = front_probe_bed_position; yProbe <= back_probe_bed_position; yProbe += yGridSpacing) {
> ...


Can I use that Marlin_main with my configuration.h or do I have to replace all the files?

----------


## jasay

> Tried that but Pronterface is saying [ERROR] Error line number is not last line number+1, last line: 0


Did you just type the command into the terminal and get that error?  I've only ever seen that error when printing and the host software (pronterface) and firmware get out of sync.

----------


## TehStranger

> Did you just type the command into the terminal and get that error?  I've only ever seen that error when printing and the host software (pronterface) and firmware get out of sync.


yeah, the screen was all messed up when I connected it with pronterface but no matter what baud rate I used it still kept screwing up.

----------


## jasay

Hit the reset button on the electronics?  Baud rate must match in your firmware configuration.h.

----------


## TehStranger

> Hit the reset button on the electronics?  Baud rate must match in your firmware configuration.h.


That worked but the G29 N5 command is still not isn't working

----------


## Roxy

> That worked but the G29 N5 command is still not isn't working


First...  The Enhanced G29 that was published here is mostly folded back into the main code base.  Depending on what code you are using the options are different.  In the main code base 'P' is used to specify the number of points on each axis to probe.   In the Enhanced G29 code published here, 'n' (with a lower case) is used.    You can never use a capital 'N' with PronterFace.

----------


## jasay

Aw, crap.  That's right "N" is reserved for line number. That explains the error mentioned above.  My apologies, "n" is correct.  Thanks for the reminder Roxy.

----------


## TehStranger

> First...  The Enhanced G29 that was published here is mostly folded back into the main code base.  Depending on what code you are using the options are different.  In the main code base 'P' is used to specify the number of points on each axis to probe.   In the Enhanced G29 code published here, 'n' (with a lower case) is used.    You can never use a capital 'N' with PronterFace.





> Aw, crap.  That's right "N" is reserved for line number. That explains the error mentioned above.  My apologies, "n" is correct.  Thanks for the reminder Roxy.


I also tried lower case n and it didn't work either. I'm gonna go to bed now but thank you guys so much for taking the time to help me try and work this out, sorry for all this trouble I know it's frustrating helping out a noob haha.

----------


## AbuMaia

Doing a 3x3, 4x4, or 5x5 grid on a 8x12 bed will work just the same as on a 8x8 bed, only the Y points will be spaced further apart. ABL will still work, even if you don't have more Y probe points.

----------


## TehStranger

> Go get the latest 'Release' version of Marlin from GitHub:  https://github.com/MarlinFirmware/Marlin  (Do not grab the development version which is more 'current' than the last Release version!)    
> 
> Go find this code in Marlin_main.cpp.   This code controls the probing across both the X and Y axis.   Change it to be what ever you desire it does:
> 
> 
> 
> ```
> 
>       for (int yProbe = front_probe_bed_position; yProbe <= back_probe_bed_position; yProbe += yGridSpacing) {
> ...


I downloaded it and made the necessary changes in configuration.h but I get an error when I try to upload it.




> Arduino: 1.6.1 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
> 
> 
> In file included from Marlin.h:22:0,                  from BlinkM.cpp:5: Configuration.h:397:40: error: floating constant in preprocessor expression    #define X_PROBE_OFFSET_FROM_EXTRUDER 29.20                                         ^ Configuration.h:437:9: note: in expansion of macro 'X_PROBE_OFFSET_FROM_EXTRUDER'      #if X_PROBE_OFFSET_FROM_EXTRUDER < 0          ^ Configuration.h:397:40: error: floating constant in preprocessor expression    #define X_PROBE_OFFSET_FROM_EXTRUDER 29.20                                         ^ Configuration.h:442:13: note: in expansion of macro 'X_PROBE_OFFSET_FROM_EXTRUDER'        #if ((X_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))              ^ Configuration.h:398:41: error: floating constant in preprocessor expression    #define Y_PROBE_OFFSET_FROM_EXTRUDER -9.00                                          ^ Configuration.h:446:9: note: in expansion of macro 'Y_PROBE_OFFSET_FROM_EXTRUDER'      #if Y_PROBE_OFFSET_FROM_EXTRUDER < 0          ^ Configuration.h:398:41: error: floating constant in preprocessor expression    #define Y_PROBE_OFFSET_FROM_EXTRUDER -9.00                                          ^ Configuration.h:451:13: note: in expansion of macro 'Y_PROBE_OFFSET_FROM_EXTRUDER'        #if ((Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))              ^ Error compiling.
> 
> 
>   This report would have more information with
> 
>   "Show verbose output during compilation"
> ...

----------


## Roxy

This is a common error people make.   You are not allowed to use floating point numbers in the C preprocessor.  The lines you updated:

#define Y_PROBE_OFFSET_FROM_EXTRUDER -9.00 

should look like:

#define Y_PROBE_OFFSET_FROM_EXTRUDER -9

No Floating Point numbers!!!!

----------


## TehStranger

> This is a common error people make.   You are not allowed to use floating point numbers in the C preprocessor.  The lines you updated:
> 
> #define Y_PROBE_OFFSET_FROM_EXTRUDER -9.00 
> 
> should look like:
> 
> #define Y_PROBE_OFFSET_FROM_EXTRUDER -9
> 
> No Floating Point numbers!!!!


ohhhh

haha thanks

edit: That worked but why was -9.00 working on my previous version of Marlin? Also, how am I supposed to write the positions for Z and X?

After I flashed to the new version my LCD just has square blocks now, am I supposed to define which LCD I am using in one of the files?

Thanks.

----------


## Roxy

Oh wait!  I gave you bad advice.   You can #define floating point numbers.   You just can't use them in #if preprocessor blocks.     And yes, you have to configure the type of LCD display you have in Configuration.h for it to be used.

----------


## TehStranger

> Oh wait!  I gave you bad advice.   You can #define floating point numbers.   You just can't use them in #if preprocessor blocks.     And yes, you have to configure the type of LCD display you have in Configuration.h for it to be used.


Sorry for the late reply, been busy with work related crap :/

Yeah I'm pretty sure they are #define point numbers so it should work, right? They aren't in an #if block

  #define X_PROBE_OFFSET_FROM_EXTRUDER 29.20
  #define Y_PROBE_OFFSET_FROM_EXTRUDER -9.00
  #define Z_PROBE_OFFSET_FROM_EXTRUDER -1.60

----------


## Roxy

In the error output....   It was complaining about floating point numbers being used in an #if

#if ((Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))

----------


## TehStranger

> In the error output....   It was complaining about floating point numbers being used in an #if
> 
> #if ((Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))


Yeah that was fixed when I set the grid to 3 instead of 5 which is obviously a problem for me.

----------


## TehStranger

> In the error output....   It was complaining about floating point numbers being used in an #if
> 
>  #if ((Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))


You can see here I don't have any floating numbers:
ss+(2015-04-29+at+04_47_54).jpg

----------


## Roxy

So what's it doing?   What is the current set of error messages?

----------


## TehStranger

> So what's it doing?   What is the current set of error messages?


Nothing, with Grid points set to 3 and the floating numbers gone it uploads to the printer no problem. But I need to add those .20 and .70 numbers to the probe offsets and I need to increase the grid points.

----------


## TehStranger

I went back to my previous version of Marlin because it works perfect for me and I used g29 u7 instead of "n" and that worked beautifully, exactly what I wanted. Thanks to everyone  :Smile:

----------

