Auto bed leveling questions

Thanks Banabybeer,

With that site i am working the hole day.
I have the printer running now, but the offset is not working
i have adjust the sensor by hand.

In all tutorials i have seen, things are not working on my printer, and i don’t know why

edit:
the first print are made, but it is not good.
the first 3 to 4 layers are ugly, i think the distance is to big.

What lead screw do you have on the Z axis, Standard?
I could not make the auto leveling work with the standard screw. It would move up during the layer then stick when it was supposed to lower. It would have random bad layers then work realy well for a time.
I’m just in the middle of a twin trapeziodal modification at the moment then I will try the auto leveling again.
The left side is fitted and has made a fantastic differance. On the right, the nut holder and bearing support have been printed and fitted. Need to print a motor mount.
Even if you disable the auto leveling, the sensor is a brilliant modification. I used to find that I was constaintly adjusting the Z endstop to get the first layer thickness correct. The first prints of the day (with the previous end of print settings) would be to thick and not stick, then as the day went on they would become thiner. With the sensor the first layers are bang on every time.

I use a TR8x1,5 leadscrew, but is was not a big improvement.
I never had any problems with adjusting the z axis, it was always good.

The auto bed leveling look to me as a nice upgrade.
the installed sensor is working well, i think

the distance from nozzle to bed is to high, that’s why the first layers are not good.
in my opinion i have to lower the offset, but for some reason it doesn’t work.
maybe i am doing something wrong.

this evening i will work on it again.

After a lot of reading it looks like you may need to use M851 and not M206.
Quote form this forum http://forums.reprap.org/read.php?344,443292
"When your Z endstop switch/probe/whatever triggers, your hotend’s tip is (hopefully) at some distance from the bed.
By adjusting the Z offset (with M555 when using smartrap’s Marlin version, or M851 if using the official Marlin release), you 're actually telling Marlin how much away your hotend tip is from the bed.
So by setting the Z offset as, say -0.55, you 're saying that after the homing process, the bed is 0.55 mm down from where it stopped (that’s why you use a negative number when setting the offset: to indicate “down”).

After you tweak the Z offset and set the correct value, don’t forget to send a M500 too to store this value in the EEPROM"

Extract from configuration.h
//===========================================================================
//============================= Additional Features =========================
//===========================================================================

// Custom M code points
#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15
#define Z_PROBE_OFFSET_RANGE_MAX -5
#endif

Update:
Another quote, from plus.google.com/108624439407822 … qwmg6CiRH7
“quick marlin question, Is there a M code to change the
" #define Z_PROBE_OFFSET_FROM_EXTRUDER -7.0”
from say octoprint terminal? Its a headace to re uppload the firmware every time…"
Reply:
“In standard Marlin with Auto bed leveling enabled it’s M851. ”

It is starting to look like auto leveling only uses the “#define Z_PROBE_OFFSET_FROM_EXTRUDER -7.0” value.
But on the plus side, if the setting can be changed with M851 -?.?? & M500 thats easier than compiling & uploading each time.

It looks like that the M851 command may work.
This evening i will check it.
Thanks for your research, i am happy with it.

I hope it will work, i will let you know.

I have tried the M851 command, but no offset.

I did a homing, with Octoprint i measured the distance to the Bed with the controls.
then i do a M114 command, and see the values that were measured.

then i do a homing again.
Then M851 Z-0.7
then M500

Then M501 with the following result:

[quote]Send: M501
Recv: echo:V16 stored settings retrieved (327 bytes)
Recv: echo:Steps per unit:
Recv: echo: M92 X80.17 Y80.15 Z2133.33 E759.68
Recv: echo:Maximum feedrates (mm/s):
Recv: echo: M203 X500.00 Y500.00 Z5.00 E500.00
Recv: echo:Maximum Acceleration (mm/s2):
Recv: echo: M201 X9000 Y9000 Z100 E10000
Recv: echo:Accelerations: P=printing, R=retract and T=travel
Recv: echo: M204 P1000.00 R1000.00 T1000.00
Recv: echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)
Recv: echo: M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
Recv: echo:Home offset (mm):
Recv: echo: M206 X0.00 Y0.00 Z0.00
Recv: echo:PID settings:
Recv: echo: M301 P25.85 I3.06 D54.64
Recv: echo:Filament settings: Disabled
Recv: echo:Z-Probe Offset (mm):
Recv: echo: M851 Z0.00
Recv: ok[/quote]

The last you see that the Offset is still Z0.00

It looks like the software is completly ignoring the offset.
When i do a homing, G28, G29 every time the extruder stops when the sensor is triggerd.

Try a number between 5 & 15.

#define Z_PROBE_OFFSET_RANGE_MIN -15
#define Z_PROBE_OFFSET_RANGE_MAX -5

If that works you might have to change the above settings in firmware.

Also have you disbled the software endstops?

#define min_software_endstops false
#define max_software_endstops false

[quote]Also have you disbled the software endstops?

#define min_software_endstops false
#define max_software_endstops false[/quote]

I didn’t, they were true.
i have changed this.
but in the mean time i have changed the sensor height, so that the sensor triggerd on a paper height.
on that moment i didn’t need a offset, so i make a print. that print was ok.

than i would mak another print but that print stops suddenly.
started the printer again, did a homing, and the nozzle almost broke trough the glass, just in time i pulled out the power supply.

so i set the sensor lower and then tried if i can make the offset again with M206.
the offset is sored in momory but again, after a homing no offset is added.

then i tried the M851 with a vallue between -5 an -15, and yes this value was stored in memory, but again i has no effect at all.
i have tried different values.

I think tommorow i am gonna build back the switch.
I don’t know what to do anymore.
i have searched the net, but can not find the same issue.

Thanks for all your help Barnabybear

Ok, I’m printing my motor mount at the moment so I’ll get that fitted and takeover the cause. With any luck we’ll have this cracked by the weekend. You don’t have to put the switch back on. Just load up V2.1 disable the pull up resistors, invert the Z axis endstop and make sure that endstops are disabled during printing (default I think). Set up the sensor to paper thickness and off you go. Thats how I’ve been running for about 6 weeks now.

it is very frusstrating that i can not find the problem.
I want to find it :slight_smile:

i have tried something different.
i have set the z-probe offset back to 0

#define X_PROBE_OFFSET_FROM_EXTRUDER 47 // -left +right #define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // -below (always!)

uploaded the firmware.

and again there was nothing changed.
there was a difference of 9mm between the settings, i think i must have seen that in the distance to the bed.
but after a homing the distance to the bed stays the same as before.
very strange.

i post my mechanical settings in the configuration.h file
maybe you see somthing strange

[code]//===========================================================================
//============================= Mechanical Settings =========================
//===========================================================================

// Uncomment this option to enable CoreXY kinematics
// #define COREXY

// Enable this option for Toshiba steppers
// #define CONFIG_STEPPERS_TOSHIBA

// coarse Endstop Settings
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors

#ifndef ENDSTOPPULLUPS
// fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
//#define ENDSTOPPULLUP_XMAX
//#define ENDSTOPPULLUP_YMAX
//#define ENDSTOPPULLUP_ZMAX
//#define ENDSTOPPULLUP_XMIN
//#define ENDSTOPPULLUP_YMIN
//#define ENDSTOPPULLUP_ZMIN
#endif

#ifdef ENDSTOPPULLUPS
// #define ENDSTOPPULLUP_XMAX
// #define ENDSTOPPULLUP_YMAX
// #define ENDSTOPPULLUP_ZMAX
#define ENDSTOPPULLUP_XMIN
#define ENDSTOPPULLUP_YMIN
// #define ENDSTOPPULLUP_ZMIN
#endif

// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
// const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
// const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
// const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
#define DISABLE_MAX_ENDSTOPS
//#define DISABLE_MIN_ENDSTOPS

// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
#define X_ENABLE_ON 0
#define Y_ENABLE_ON 0
#define Z_ENABLE_ON 0
#define E_ENABLE_ON 0 // For all extruders

// Disables axis when it’s not being used.
#define DISABLE_X false
#define DISABLE_Y false
#define DISABLE_Z true
#define DISABLE_E false // For all extruders
#define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled

#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true
#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false
#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true
#define INVERT_E0_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E1_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E2_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E3_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false

// ENDSTOP SETTINGS:
// Sets direction of endstops when homing; 1=MAX, -1=MIN
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1

#define min_software_endstops false // If true, axis won’t move to coordinates less than HOME_POS.
#define max_software_endstops false // If true, axis won’t move to coordinates greater than the defined lengths below.

// Travel limits after homing (units are in mm)
#define X_MAX_POS 200
#define X_MIN_POS 0
#define Y_MAX_POS 200
#define Y_MIN_POS 0
#define Z_MAX_POS 220
#define Z_MIN_POS 0

#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
[/code]

and this are the auto bed level settings.

[code]//===========================================================================
//============================= Bed Auto Leveling ===========================
//===========================================================================

#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
#define Z_PROBE_REPEATABILITY_TEST // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled.

#ifdef ENABLE_AUTO_BED_LEVELING

// There are 2 different ways to specify probing locations
//
// - “grid” mode
// Probe several points in a rectangular grid.
// You specify the rectangle and the density of sample points.
// This mode is preferred because there are more measurements.
//
// - “3-point” mode
// Probe 3 arbitrary points on the bed (that aren’t colinear)
// You specify the XY coordinates of all 3 points.

// Enable this to sample the bed in a grid (least squares solution)
// Note: this feature generates 10KB extra code size
#define AUTO_BED_LEVELING_GRID

#ifdef AUTO_BED_LEVELING_GRID

// Use one of these defines to specify the origin
// for a topographical map to be printed for your bed.
enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
#define TOPO_ORIGIN OriginFrontLeft

// The edges of the rectangle in which to probe
#define LEFT_PROBE_BED_POSITION 50
#define RIGHT_PROBE_BED_POSITION 190
#define FRONT_PROBE_BED_POSITION 10
#define BACK_PROBE_BED_POSITION 170

#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this    

// Set the number of grid points per dimension
// You probably don't need more than 3 (squared=9)
#define AUTO_BED_LEVELING_GRID_POINTS 2

#else // !AUTO_BED_LEVELING_GRID

  // Arbitrary points to probe. A simple cross-product
  // is used to estimate the plane of the bed.
  #define ABL_PROBE_PT_1_X 15
  #define ABL_PROBE_PT_1_Y 180
  #define ABL_PROBE_PT_2_X 15
  #define ABL_PROBE_PT_2_Y 20
  #define ABL_PROBE_PT_3_X 170
  #define ABL_PROBE_PT_3_Y 20

#endif // AUTO_BED_LEVELING_GRID

// Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER 47 // -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // -below (always!)

#define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case

#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min

#define Z_RAISE_BEFORE_PROBING 5 //How much the extruder will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 3 //How much the extruder will be raised when traveling from between next probing points

//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you’d like.

//If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
//The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
// You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.

// #define PROBE_SERVO_DEACTIVATION_DELAY 300

//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!!!

#define Z_SAFE_HOMING // This feature is meant to avoid Z homing with probe outside the bed area.
// When defined, it will:
// - Allow Z homing only after X and Y homing AND stepper drivers still enabled
// - If stepper drivers timeout, it will need X and Y homing again before Z homing
// - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
// - Block Z homing only when the probe is outside bed area.

#ifdef Z_SAFE_HOMING

#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)    // X point for Z homing when homing all axis (G28)
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)    // Y point for Z homing when homing all axis (G28)

#endif

#endif // ENABLE_AUTO_BED_LEVELING

// The position of the homing switches
//#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)

//Manual homing switch locations:
// For deltabots this means top and center of the Cartesian print volume.
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.

//// MOVEMENT SETTINGS
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {5060, 5060, 4*60, 0} // set the homing speeds (mm/min)

// default settings

#define DEFAULT_AXIS_STEPS_PER_UNIT {80.17,80.15,2133.33,759.68} // default steps per unit for K8200
#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 500} // (mm/sec)
#define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.

#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration in mm/s^2 for retracts
#define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves

// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
// #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
// #define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis

// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
#define DEFAULT_XYJERK 20.0 // (mm/sec)
#define DEFAULT_ZJERK 0.4 // (mm/sec)
#define DEFAULT_EJERK 5.0 // (mm/sec)

[/code]

That all looks good.
Can you run through exactly the commands your are using for homing and auto leveling and the results please.

I sent the command with octoprint, connected to a raspberry pi.

On the control tab i push the home x-y axis button (G28 X0 Y0)
after that i push the home Z axis button (G28 Z0)

the autolevel is started with G29

ok, with your current settings that should:

Move the Z axis +4mm (up), move the X axis 0 postion bounce off the end stop then stop, move to the Y axis 0 postion bounce off the end stop then stop.

This should move the Z axis (nozzle towards the bed) & when the sensor is triggered (about 8mm form the table) bounce off the end stop then stop.

This should move the Z axis up 5mm, travel to the first of 6 measurment points, lower the nozzle / probe detect the bed at approx 8mm then raise 3mm to travel to the rest of the points before returning to the X,Y home postion stopping with the Z at about 8 mm above the table.

If all offsets are zero, (#define Z_PROBE_OFFSET_FROM_EXTRUDER 0, M206 Z0 & M851 0) then a G1 Z0 should not move the Z axis.
However, if there is an offset set G1 Z0 should move the Z axis by the total value of all offsets (#define Z_PROBE_OFFSET_FROM_EXTRUDER ?? + M206 Z?? + M851??). Note M206 may not work but the other 2 should.
I only used Z_PROBE_OFFSET_FROM_EXTRUDER ?? as I didn’t know about the others.

Test that and see how you get on.

I think now you have removed the software limits, everything should work now. I think when it hit the bed in your previous test it was a combination of two offsets added together (M851 correctly set the zero point & M206 took you past it).

With a sensor, don’t think of home as touching the bed (as it was with the switch), can be anywhere. It is simply a known postion.
So your home is X 0, Y 0, Z +8 which is where a G28 will send the nozzle to (that is the postion that all 3 switches are activated).
If you want the nozzle to touch the bed as it did before. You would need to G28 X0 Y0 Z-8 (but that wouldn’t work as G28 = switch close, so you can’t have 8mm past the swicth close). So you set an offset from the home postion to the X0,Y0,Z0 postion. Any of the methods above (idealy only one).
A start of print gcode would be somthing like (as you have most of):
G28 // home all axis, will end up at (X0,Y0, Z+8).
G29 // auto level bed
G1 X0 Y0 Z0 // now moves the nozzle to the postion that G28 did before auto leveling, will end up at (X0, Y0, Z0) if offsets correct.

Sorry if that is stating the obvious, but I wanted to ensure you understand that G28 will not postion the nozzle touching the bed as as we normaly do to stop it ozing before the print starts, G1 X0 Y0 Z0 is needed to do that.

Now i understand, i thought all the time that a home of the z axis moves the nozzle 0.2mm above the bed.

i did the whole thing again, and think now it works as you say.
i have included a offset with M206 Z2.6

what codes do i have to include in the start G code?
now i have:

G28 ; home all axes G29 ; Auto bed leveling G90 ; use absolute coordinates G21 ; set units to millimeters G92 E0 M82 ; use absolute distances for extrusion M109 S230 ; wait for temperature to be reached G1 E10 F400 ; prime the nozzle

do i have to include the G1 X0 Y0 Z0 in the start G-code?
with the above settings the print starts at 2.8mm above the bed

You sound much happier tonight.

You don’t need G1 X0 Y0 Z0 as the slicer gcode will set the height for the first layer of print, something like this:
G1 Z0.350 F12000.000

I would put one in though, just before (M109 S230 ; wait for temperature to be reached) for 2 reasons:

  1. As the hot end heats up the filament is likley to ouze out of the nozzle, by placing it touching the bed the filament is kept in the nozzle. This means that you don’t get a hard mess of filament for the nozzle to hit as it moves down to its print height (0.2 → 0.35mm depending on settings).
  2. Before the start of the print filament is extruded to prime the nozzle, some of this cools and sticks to the bed. With the nozzle close to the bed it is pushed up around the hot nozzle and cleans the outside of the nozzle (any old bits of filament that were picked up during the last print become part of the blob left at the start).

If starting from cold it’s important to make sure that the underside of the nozzle doesnt have any old filment that ouzed out at the end of the last print as this will hit the bed (but that is the same as non-auto leveling).

Cool it sounds like you have cracked this. Thats made life easy for my reinstall later this week & tought me a few tricks (I didn’t know about M206). Just a thought, I don’t know what your sensor it like, but mine gets unreliable if I get within about 15mm of the edge of the bed.

Yes, i am a bit happier tonight :slight_smile:

I have made the first print, and they look good.
i have added the G1 X0 Y0 Z0 command to the start code, then the printer starts at the good height.
if i leave the G1 command the printer starts at the home height, and prints in the air.

in the slicer i have configured the first layer at 0,35mm

when i added G1 Z0.350 F12000.000 before M109, the printer starts again on home height and was printing in the air.

with this settings the printer starts at the good height.

G28 X0 Y0 Z0 ; home all axes G29 ; Auto bed leveling G28 X0 Y0 Z0 G1 X0 Y0 Z0.3 F12000.000 G90 ; use absolute coordinates G21 ; set units to millimeters G92 E0 M82 ; use absolute distances for extrusion M109 S230 ; wait for temperature to be reached G1 E10 F400 ; prime the nozzle

I have to set a second G28 after the auto bed leveling, if i do not, the nozzle is not going to the Z0.3 position

Not sure why that is, but I’ll test it on mine later this week.
Good to know your printing again :slight_smile:

Uhm, doesn’t M109 S230 wait for the temoperature to reach 230 degrees?
If you want to use your set temperature (e.g. 200) you need something like [temp1] or something.

Yes it does, but i print always with PLA on this temperature.
With my old hotend (standard velleman) i printed on 190 degrees

Just another question about auto bed leveling with a proximity switch.

When i give the command G28 and also with the level command G29, the probe moves to a corner, the probe goes down till the sensor is triggered, then it goes up, and then it goes very slow down, this takes on every corner 20 to 30 seconds, and also with a homing command of the z-axis.

with the old firmware it was the same, but the second time the probe goes down, it was very quick.
Is it possible to get this speed back?
and what are the settings to do this?