Notifiche
Cancella tutti

How the bed leveling algorithm works?  

  RSS
YigalB
(@yigalb-2)
Eminent Member
How the bed leveling algorithm works?

Does anyone know how the bed leveling algorithm works? 

I assume the first step is to lower the head down until the nozzle is touching the bed, and then the value reported by the NIMDA is registered.

Later, 16 pints are measured and compared to this value. What is the criteria for success for this measures?

Best Answer by Bob:

 

Posted by: @yigalb-2

Got you. So it is the user's responsible to "tell" the system where the absolute zero is (when the nozzle actually touches the bed"), while the rest is just to check if the bed is leveled. 

If so:

1- Why wouldn't the nozzle touch the bed automatically? 

2- The sensor is not being read during the actual print afterwards, right?

 

To answer your first question, the Mk2, Mk3, and Mini use a probe to identify when the nozzle is close to the bed.  Using Z-offset calibration you tell the printer how many steps it needs to move AFTER the probe detects the bed to get the nozzle within an appropriate distance from bed surface.  This must always be 0 or a number less than 0.  Since the steppers are incapable of providing proper feedback to the Buddy board and the Buddy board isn't built or programmed to look for that feed back, there is never any value for the nozzle to physically come in contact with the bed.  YOU are telling the printer where the nozzle is by setting your z-offset.  After z-offset is set and when a print is begun a G28 is sent to the printer to home all axis, this identifies and sets where 0 is for X, Y, and Z.  Then it issue a G80 to initiate bed leveling.  Since the printer knows where all 3 axis are, it can count how many steps it needs to go to place the nozzle where it wants it to be.  As it probes the bed it identifies at each of the 16 points how many steps from 0 it is when it detects the bed and puts this value in a table.  All it's doing here is identifying delta Z from 0.  It then can add or subtract this delta from the Z-offset you set when you calibrated the nozzle to keep the nozzle the right distance from the bed.

To answer your 2nd question, you are correct, once bed mesh leveling is complete the probe just goes along for the ride.  The G28 auto homing has identified where 0 is, the G80 mesh leveling has built a correction map for the printer to use and from that moment on the printer knows where to set each axis by counting the number of steps your stepper motor turns.  The printer is then sent a G90 code which means it's to trust 0 and to interpret all motion values it receives in relation to 0 rather than to the last location the axis was set to.  Lastly the printer receives an M83 which tells the extruder to use relative distance, the delta values established during the probe, to raise or lower the extruder slightly at that point on the bed so that the layer is uniform.  Everything after mesh leveling is based on mathematical calculations determined by how far an axis will travel based on rotations, or partial rotations of the stepper motors.

This is why you can get layer shifts, since the steppers can't tell the Buddy that it's encountered resistance, if your axis hits an obstacle and causes it to skip a few steps, the printer won't know and when it next sets that axis it sets it relative to the error that was introduced by the obstacle.  That's why layer shifts are consistent from the  shift on up, at least until the next shift.  The printer is setting the nozzle where it THINKS it should be based on mathematical calculations.  The Mk3 and above have crash detection which allow the printer to detect if the axis has met resistance and possibly shifted and instructs it to re-home that axis.  This re-home feature only works with X and Y though as the print could interfere with the Z axis if it tries to re-home to the bed. 

I hope that helps.

-Bob

Postato : 13/03/2024 8:15 pm
Bob
 Bob
(@bob-2)
Reputable Member
RE: How the bed leveling algorithm works?

I don't know the precise algorithm, but it goes something like this.  You adjust the z-offset to tell the printer where the nozzle is in relationship to when the Minda/SuperPinda probe detects the print surface.  When the printer receives a G29 gcode it begins to probe the bed, for the mini its the 4x4 or 16 points on the bed.  What each probe is measuring at what Z elevation the probe initiates.  It measures the variation at each point and builds an internal map then calculates the delta between all adjacent points so that during the print it can make slight adjustments to the z-offset in the first layer to keep the first layer level on the top, after that it can maintain the elevation for each subsequent layer.

On the Mini, Mini+, Mk2 and its variants, and the Mk3 and it's variant the nozzle never touches the bed, only on the Mk4 and the XL does the nozzle physically touch the bed surface to calculate the first layer.

Not sure if that's what you're looking for, but that's how I understand it.

Cheers

-Bob

Prusa I3 Mk2 kit upgraded to Mk2.5s, Ender3 with many mods, Prusa Mini kit with Bondtech heat break, Prusa I3 Mk3s+ kit

Postato : 14/03/2024 11:22 pm
YigalB hanno apprezzato
YigalB
(@yigalb-2)
Eminent Member
Topic starter answered:
RE: How the bed leveling algorithm works?

Got you. So it is the user's responsible to "tell" the system where the absolute zero is (when the nozzle actually touches the bed"), while the rest is just to check if the bed is leveled. 

If so:

1- Why wouldn't the nozzle touch the bed automatically? 

2- The sensor is not being read during the actual print afterwards, right?

Postato : 16/03/2024 12:36 pm
JoanTabb
(@joantabb)
Veteran Member Moderator
RE: How the bed leveling algorithm works?

Prior to the MK3.9 and mk4.

The MK2 and MK3 series printers used an inductive, non contact sensor to sense where the build plate is relative to the extruder .

This required subsequent homan intervention to set liveZ.

The MK3.9 and mk4 use a load cell embedded in the extruder heatsink to sense when the nozzle actually touches the build plate to set the Z height

I try to make safe suggestions,You should understand the context and ensure you are happy that they are safe before attempting to apply my suggestions, what you do, is YOUR responsibility. Location Halifax UK

Postato : 16/03/2024 4:12 pm
YigalB hanno apprezzato
Bob
 Bob
(@bob-2)
Reputable Member
RE:

 

Posted by: @yigalb-2

Got you. So it is the user's responsible to "tell" the system where the absolute zero is (when the nozzle actually touches the bed"), while the rest is just to check if the bed is leveled. 

If so:

1- Why wouldn't the nozzle touch the bed automatically? 

2- The sensor is not being read during the actual print afterwards, right?

 

To answer your first question, the Mk2, Mk3, and Mini use a probe to identify when the nozzle is close to the bed.  Using Z-offset calibration you tell the printer how many steps it needs to move AFTER the probe detects the bed to get the nozzle within an appropriate distance from bed surface.  This must always be 0 or a number less than 0.  Since the steppers are incapable of providing proper feedback to the Buddy board and the Buddy board isn't built or programmed to look for that feed back, there is never any value for the nozzle to physically come in contact with the bed.  YOU are telling the printer where the nozzle is by setting your z-offset.  After z-offset is set and when a print is begun a G28 is sent to the printer to home all axis, this identifies and sets where 0 is for X, Y, and Z.  Then it issue a G80 to initiate bed leveling.  Since the printer knows where all 3 axis are, it can count how many steps it needs to go to place the nozzle where it wants it to be.  As it probes the bed it identifies at each of the 16 points how many steps from 0 it is when it detects the bed and puts this value in a table.  All it's doing here is identifying delta Z from 0.  It then can add or subtract this delta from the Z-offset you set when you calibrated the nozzle to keep the nozzle the right distance from the bed.

To answer your 2nd question, you are correct, once bed mesh leveling is complete the probe just goes along for the ride.  The G28 auto homing has identified where 0 is, the G80 mesh leveling has built a correction map for the printer to use and from that moment on the printer knows where to set each axis by counting the number of steps your stepper motor turns.  The printer is then sent a G90 code which means it's to trust 0 and to interpret all motion values it receives in relation to 0 rather than to the last location the axis was set to.  Lastly the printer receives an M83 which tells the extruder to use relative distance, the delta values established during the probe, to raise or lower the extruder slightly at that point on the bed so that the layer is uniform.  Everything after mesh leveling is based on mathematical calculations determined by how far an axis will travel based on rotations, or partial rotations of the stepper motors.

This is why you can get layer shifts, since the steppers can't tell the Buddy that it's encountered resistance, if your axis hits an obstacle and causes it to skip a few steps, the printer won't know and when it next sets that axis it sets it relative to the error that was introduced by the obstacle.  That's why layer shifts are consistent from the  shift on up, at least until the next shift.  The printer is setting the nozzle where it THINKS it should be based on mathematical calculations.  The Mk3 and above have crash detection which allow the printer to detect if the axis has met resistance and possibly shifted and instructs it to re-home that axis.  This re-home feature only works with X and Y though as the print could interfere with the Z axis if it tries to re-home to the bed. 

I hope that helps.

-Bob

Questo post è stato modificato 8 months fa 2 tempo da Bob

Prusa I3 Mk2 kit upgraded to Mk2.5s, Ender3 with many mods, Prusa Mini kit with Bondtech heat break, Prusa I3 Mk3s+ kit

Postato : 16/03/2024 5:06 pm
YigalB hanno apprezzato
Larswaden
(@larswaden)
Utenti
RE:

I might as well tag along on this thread, no need to do a new thread.

My mk3s+ prusa since I built it always do a 3x3 bed level probing at print starts. This seems to be the default in the firmware.

BUT, the mesh is actually 4x4 if one includes the far right of the bed.

Just curious, why isnt't 4x4 the default, and should I change it?

Questo post è stato modificato 2 months fa da Larswaden
Postato : 29/08/2024 3:59 pm
Condividi: