Return to Forum
Return To Mainsite
  1. Makertech 3D Forum
  2. AXIS 3D Printer
  3. 3D Printing
  4. Bed Leveling - An Advanced Discussion
Search
Michael G
Aug 19, 2020

Bed Leveling - An Advanced Discussion

I write "advanced" but that doesn't mean this discussion isn't for the uninitiated or those who have just started printing. I hope this discussion can be an in-depth and beyond-the-basics type of topic.


Let me state up front that I own another printer with a BLTouch probe and have been working with it and a BTT SKR 1.4 Turbo board to level an Ender 3 Pro. Most of my knowledge of the Marline firmware and bed leveling come from the setup of this probe and printer.


Current State of Bed Leveling with the Makertech Axis

The AXIS printer uses an inductive probe with a PNP normally open transistor switch. This probe will close or trigger when it is at 4mm from a metal object. Materials commonly used as build surfaces which are not conductive, such as masking tape, glass, etc, will not be detected by this probe.


In the Configuration.h file that is provided by Makertech ABL (automated bed leveling) is configured to use a 20 point grid in a 5, 4 configuration to achieve leveling using the bilinear method. The bilinear ABL configuration is, from my observation, the most common way to use a probe to create a mesh of the height of the bed at various points. The printer's firmware alters the z-axis height according to this mesh to produce a uniform set of initial layers onto the build surface. The limit in height that this mesh affects the z-axis is known as the Fade Height. The amount of leveling applied is gradually faded until this height is reached where the printer will then assume the print is level. The Fade Height is adjusted with g-code and is set to 4mm. The g-code for the AXIS printer is found in the printer profile in Cura, M420 S1 Z4.


In the Marlin firmware there is a setting RESTORE_LEVELING_AFTER_G28. Having this defined (uncommented) means that after the printer does its homing routine that the bed leveling mesh is restored. With the current configuration of the Marlin printer a leveling g-code command is sent to the printer, G29, which causes the bed to be probed and the mesh stored. During printing a G28, home the printer, command is sent followed by the Fade Height command.


Questions and Thoughts on Current Configuration

I have had a few thoughts on the current configuration of bed leveling that I was hoping we could discuss. These are mainly around the g-code sent to the printer.


First, I'm new to an inductive probe. With a probe such as a BLTouch physically touching the surface I find it important that the bed leveling mesh be generated often as a bed's surface can change over time. Since our beds are most likely covered by some non-conducting material it doesn't make as much since to do this. However, I still feel that a pre-print leveling routine should be performed. I have added a G29 command after the G28 command in the printer's configuration within Cura.


Next, since the mesh is reloaded after G28 and the G29 command comes after it I do not believe the Fade Height command is necessary. This value can be set once via Pronterface or the LCD and then stored in the EEPROM. It should be recalled automatically. Therefore, I've removed it from the slicer's configuration of the printer.


Something I've noticed, and this is where I'd like feedback, is that I can see a valid mesh get returned by the G29 command, I can see the z-axis move during the print, but I don't feel like it is correct or by enough. There are spots on my bed that I know the nozzle will hit even after a level command. What I don't know is if this is caused by the non-conductive surface on the flex plate. I can also see this on my other printer which has a similar configuration. Is there some incorrect assumption that I made above? Please share your thoughts.


Improvements to the Current Firmware Configuration

There are several configuration changes that I feel make the process of getting a level bed much easier. Some of these will require the LCD to be installed on your printer in order to take full advantage of the feature.


Babystepping is a change that is probably helpful to all users which have the LCD installed. Here's the comments from the Marlin firmware: "Babystepping enables movement of the axes by tiny increments without changing the current position values. This feature is used primarily to adjust the Z axis in the first layer of a print in real-time." What this is essentially saying is that you are able to adjust the nozzle height from the bed using your LCD and knob.


The configuration of babystepping is done in the Configuration_adv.h file. The following is an example of a configured babystepping section:

#define BABYSTEPPING #if ENABLED(BABYSTEPPING)   //#define INTEGRATED_BABYSTEPPING         // EXPERIMENTAL integration of babystepping into the Stepper ISR   //#define BABYSTEP_WITHOUT_HOMING   //#define BABYSTEP_XY                     // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false           // Change if Z babysteps should go the other way   //#define BABYSTEP_MILLIMETER_UNITS       // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps #define BABYSTEP_MULTIPLICATOR_Z 10       // (steps or mm) Steps or millimeter distance for each Z babystep #define BABYSTEP_MULTIPLICATOR_XY 1       // (steps or mm) Steps or millimeter distance for each XY babystep #define DOUBLECLICK_FOR_Z_BABYSTEPPING  // Double-click on the Status Screen for Z Babystepping. #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) #define DOUBLECLICK_MAX_INTERVAL 1250   // Maximum interval between clicks, in milliseconds.                                             // Note: Extra time may be added to mitigate controller latency.     //#define BABYSTEP_ALWAYS_AVAILABLE     // Allow babystepping at all times (not just during movement).     //#define MOVE_Z_WHEN_IDLE              // Jump to the move Z menu on doubleclick when printer is idle. #if ENABLED(MOVE_Z_WHEN_IDLE) #define MOVE_Z_IDLE_MULTIPLICATOR 1   // Multiply 1mm by this factor for the move step size.     #endif   #endif   //#define BABYSTEP_DISPLAY_TOTAL          // Display total babysteps since last G28 #define BABYSTEP_ZPROBE_OFFSET          // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET)     //#define BABYSTEP_HOTEND_Z_OFFSET      // For multiple hotends, babystep relative Z offsets     //#define BABYSTEP_ZPROBE_GFX_OVERLAY   // Enable graphical overlay on Z-offset editor   #endif #endif


Unified Bed Leveling - UBL

There exists a more advanced method of leveling the bed, UBL. Unified bed leveling is described in the Marlin firmware as "a comprehensive bed leveling system combining the features and benefits of other systems. UBL also includes integrated Mesh Generation, Mesh Validation and Mesh Editing systems."


The idea of UBL is to make a very, very detailed mesh of the bed. By default it will try to probe 100 points. This mesh can then be manually adjusted and then validated through a special print. When the printer goes to print it loads this mesh and can then be instructed to pick a few points for validation. This will help adjust the mesh if minor changes have occurred.


The steps for enabling and configuring UBL are much more involved than the bilinear setup that is enabled by default. The first thing which is necessary is to change the configuration in the firmware.


Enable UBL in Configuration.h by uncommenting "#define AUTO_BED_LEVELING_UBL" and commenting out bilinear "//#define AUTO_BED_LEVELING_LINEAR". Next you'll want to enable the G26 mesh validation tool by uncommenting "#define G26_MESH_VALIDATION". For an ultra-precise grid you should validate that "#define GRID_MAX_POINTS_X 10" is set.


If you have an LCD I highly suggest configuring babystepping as shown above.


Once you've compiled the firmware and sent it to the printer it is then necessary to perform the initial calibration of the mesh. If you have an LCD you will likely stumble onto the UBL configuration section. There is a procedure in the menu for creating, editing, and validating the mesh. I have never been able to successfully use these menu options. Beware that it is possible for the printer to be put into a state where the nozzle will collide with the bed. I do not know if this is because of how z-offset is factored in or if there are bugs. I suggest using Pronterface to send the commands manually.


I have found the best way to configure UBL is through following the commands in Marlin's topic on UBL: https://marlinfw.org/docs/features/unified_bed_leveling.html#synopsis In the Synopsis section is a box showing the g-code for initializing, fine tuning, and validating the mesh. It basically works like this:


  1. After sending the firmware to your printer you should reset things.

  2. M502 ; reset EEPROM

  3. M500 ; save EEPROM

  4. M501 ; load EEPROM

  5. Prepare the printer for initial mesh creation. The printer should be brought to typical printing temperature.

  6. M190 S65 ; heat the bed

  7. Home the printer

  8. G28 ; must be performed before other commands are issued

  9. Perform the initial mesh creation

  10. G29 P1 ; Probe the bed

  11. After the automated probing is completed it will likely be the case that there are points in the mesh that couldn't be probed.

  12. G29 T ; print the current map, there will likely be a bunch of 0,0 entries

  13. G29 P3 T ; smart fill empty points and print the map. if there a bunch of 0,0 entries this should be run until all are filled in

  14. Save the mesh to slot one. There are multiple slots if you have multiple build surfaces you wanted to level.

  15. G29 S1

  16. Set the fade height to 4mm (4mm is from the Makertech configuration)

  17. G29 F 4.0

  18. Activate the UBL system

  19. G29 A

  20. Save the configuration to EEPROM

  21. M500 ; Save current setup. UBL will be active at power up, before any G28. (Which is what we want)

  22. Before you print the validation mesh get your z-offset set (remember you cleared your settings after the firmware was flashed)

  23. Print the validation mesh

  24. G26 L0.2 B60 H200 S0.3 ; Prints mesh with a layer height of 0.2mm, bed heated to 60, hotend to 200, and is using a 0.3mm nozzle.


If after you print the validation mesh you have bad areas you'll need to adjust them. I haven't had to do this, but following the guide in the link should get you there.


In your slicer you'll want to edit the printer so that you can change the g-code that's executed before the printer starts printing the model. This is referred to as the "start g-code" in many slicers. After the G28 command we no longer need the M420 command, it can be removed. During our setup we activated the mesh and in the firmware the mesh should be loaded after G28, but it is good to add in "G29 L1 ; Load the mesh stored in slot 1 (from G29 S1)" after the G28. Next, it is a good practice to quickly check 3 points on the build surface to help modify the mesh for small deviations. Follow the previous command with "G29 J ; Probe 3 points for mesh alteration". You can modify the command by appending an integer after "J" to define more than 3 points if you wish. Generally, 3 should be enough but if you wanted to do more you're only adding to the time before the actual printing starts.


This should get your UBL system up and running. Hopefully the overall mesh, having more points, is more accurate. Adding the 3-point check before printing should help with any small deviations. Revisiting creating the mesh is necessary if any large changes to your build surface occur.


Where Do We Go From Here?

Hopefully this gives us a great starting point for discussing bed leveling for not only the AXIS printer but all 3D printers running on the Marlin (or derivative) firmware. I tried to best describe what the AXIS printer is actually configured to do and what it does. I've also tried to provide an example of a configuration change to help people with leveling their beds and talked about a different method of leveling the bed. The section on UBL should provide you with enough to get up and running with a much more comprehensive bed leveling technology.


I want to open up a discussion regarding the aspects of leveling. Please feel free to correct my explanations if they're incorrect. Also help clarify if things stills seem murky. I don't know everything but I am hoping that by talking among ourselves that we can all gain a better understanding of how this process works.

30 comments
andrew leroy
Aug 20, 2020

That's quite a post, wow. Thank you.


I'll surely tinker with this in the near future. Then, I'll have to research some more before I can respond in full.

0
Michael G
Aug 20, 2020

Don't quote me as the definitive source. This is what a lot of trial and error along with scouring Reddit and other forms for information has gotten me to. PLEASE, if you find something that contradicts this please post as I'm trying to learn as much as I can.

0
Johannes L
Sep 6, 2020  ·  Edited: Sep 7, 2020

The fade height setting will be disabled with the M420 S0 command (bed leveling off) so if you follow the procedure to do the Z-Offset correction after bed leveling the fade height setting will stay off as well. I think that's one of the reasons why the M420 S1 Z4 command is in the start G-code settings of the printer in Cura.


I'm currently still using the bilinear bed leveling but configured the grid to 7x5 instead of the original 5x4 mesh points. The denser grid provided some better results for me. I haven't tried UBL yet.


Edit: Correct M420 command (M240 is to trigger a camera)

0
Michael G
Sep 7, 2020

Here's my start code:


;----------AXIS Start G-code----------

T0

M104 S{material_print_temperature_layer_0} ;Set hotend temp.

M140 S{material_bed_temperature_layer_0} ;Set bed temp.

M109 S{material_print_temperature_layer_0} ;Wait for hotend

M190 S{material_bed_temperature_layer_0} ;Wait for heated bed

G28 ;Home

G1 F8000 X10 Y36 Z5 ;Move to where skew calc

G29 J ;ABL

M420 L0 S1 Z4 ;Activate auto-level and set Z-fade.

G1 F8000 X10 Y3 Z5 ;Move hotend to bottom left corner

G1 Z{layer_height_0} ;Set to first layer height

M82 ;absolute extrusion mode

G92 E0 ;Zero Extruder

G1 F1500 X290 E12 ;Prime Hotend

; ----------AXIS start G-code----------


I left the M420 in. I changed it to add the "L0" to load the mesh from the EEPROM. I've always wondered if the M420 loaded after the G29 canceled the skew/tilt compensation.

0
Johannes L
Sep 7, 2020

Ok, you have already switched to UBL. My comment was referring to your initial comments and would mainly apply to the default bilinear ABL method.


The UBL seems to have its own way of saving fade height so it might not be necessary to use M420 Z. You could check the values with M420 V1 and compare this with the UBL G29 T results. According to the documentation, G29 L<index> would be sufficient for UBL. Don't know if the M420 would overwrite the G29 J results but this should be easy to check with the commands on a printer console.

0
Quodesh
Sep 11, 2020

After enabling UBL and tweeking the edges and 2 trouble spots my prints look soooo much better now. Thank you so much for this thread.


Just a word of warning with UBL while it's running the mesh probing and you have the flex plate, make sure the flexplate is under the probe at the edges. Otherwise it will probe down to the plate and if a print gets anywhere near the edges it will gouge down into your flex plate.



0
Michael G
Sep 11, 2020

That's an interesting mesh. I think you need to go into the bed mesh visualizer and modify the command it uses to get the bed mesh.

0
andrew leroy
Sep 13, 2020

G29 T

... or ...

M420 V

0
andrew leroy
Sep 13, 2020

So I finally got around to doing this. I managed to get a decent looking validation print. It was stringing all over the place, but there were only a few points that needed adjustment. (btw, add Q6.5 to the G26 command to correct the stringing) I saved everything with G29 S1; and again with M500.


When I turned on the printer the next morning to correct the few bad spots, suddenly it was mashing the nozzle into the bed at every point. It seems like it applied the z-probe offset (M851) twice.


That was yesterday. Today I tried the bug-fix-2.0.x branch of the Marlin firmware and had the same issue.


So has anyone else made UBL work?


maybe m206 instead of m851 ...

0
Rai
Sep 14, 2020

I carry out the following steps before each print- On the printer itself-(1) auto-home (2) then switch on auto-levelling (3) then auto-level.

This steps have been working great for me. I dont bother with the pronterface anymore.

0
Michael G
Sep 13, 2020

Except for my really bad bed it is working fine for me. 8mm inductive probe will be here today. Will have to relevel after I install it and the glass bed.

0
Johan
Sep 14, 2020  ·  Edited: Sep 14, 2020

have spent a lot of time trying to get this right combined with the heated bed, but I don't seem to fully understand it, I still get high and low spots on my bed when printing the first layer with such high differences that some parts the nozzle starts burying itself in the bed and on other parts the filament doesn't even stick... That combined with the X-axis motion has started to wear me down, already haven't touched the printer for a week now... Am wondering if I just started out with too many features...

0
Michael G
Sep 14, 2020

My opinion is that the combination of the heated bed, flex plate, and sheet make it too uneven for the inductive probe to measure out. That is what I was trying to fix when I fried my mainboard.


There's a couple things you may want to try. Get a BLTouch. They work by physically touching the surface. This is what's on my Ender 3 Pro. It works marvelous. You could go get the 8mm inductive probe and a sheet of borosilica glass. This is the route I chose because the sensor is cheap, $11. The glass isn't expensive either, something around $30. However, you'll need to figure out how to wire it. The probe I had wouldn't run on 5v like the one that came with the kit. I attempted to give it 24v from the power in. I didn't realize that it would feed that back to the signal pin for the probe. I'm pretty sure that killed the board. Removing the step-down circuitry that was on the original probe and moving it over to the new one might have avoided this. I'm not going to possibly fry my spare board to see if this is the case.

andrew leroy
Sep 14, 2020

The platform is 2mm aluminum. It bends easily. Check out my thread here:



www.forum.makertech3d.com
Check Your Platform | makertech3d
It was straight as an arrow out of the box. (the screws you see aren't causing this bend, they don't hit the ground ... they're just holding the drill template for my T-Track linear rail mod) The T-Track, thankfully, pulled my platform back into shape. My thinking here is that the belt pulls slight

Johannes Helm
Sep 23, 2020

After enabeling baby stepping and ubl i cannot comply the marlin file. it says Error compiling for board Arduino/Genuino Mega or Mega 2560... did i messed up the file ?


0
Johannes L
Sep 23, 2020

Depends on the error I guess. If it's an error in the program (firmware) it should give you a description and location of the specific error. It might also error because of either the compiled firmware being to big to fit in the flash or the the memory consumption being too large for the available amount of memory on the board. Additioally, you could enable more printouts for compiling in the Arduino UI options.

0
Johannes Helm
Sep 23, 2020

thanks, right now i downloaded the marlin file agian and started with configuration again. This time complying after every step. So far i got the baby stepping complyd. Will continue tomorrow. Why im doing this- i found that my bed is off more then 1mm with the fwd side of the bed being up and the gantry side being down :S

0
Johannes Helm
Sep 25, 2020  ·  Edited: Sep 25, 2020

Yet again i seek knowledge from Axis and Marlin wisemen. I managed to enable babystepping and UBL, even managed to get the pobe count from 57/100 to 91/100. But i got stuck in the last point

11 - Print the validation mesh -G26 L0.2 B60 H200 S0.3 ; Prints mesh with a layer height of 0.2mm, bed heated to 60, hotend to 200, and is using a 0.3mm nozzle.

to be more precise with the combination of the above and Z axis offset. As i print the validation mesh i can see that its not lowering the nozzle as low as Z axis offset is.


when i type "M501" in pronterface should i see from that data also Z axis offset?


First i tried to do the Z offset from the Axis itself and thought that was a problem, but then i also did it like Makerteh advises from pronterface but the outcome is still the same.




0
Michael G
Sep 25, 2020

What does G29 T return?


It should show all 100 points filled in.

0
Johannes L
Sep 25, 2020

M503 and M501 will give you a couple of infos

- M206: this should show you the z-offset

- M420: this will tell you if bed leveling is of (S0) or on (S1)

- G29: these are the bed leveling offsets, you can also show them with 'M420 V' command


BTW, using M501 will re-load settings from flash and overwrite the settings from the active session. So any unsaved settings will be lost. It will also de-active bed leveling. Better use M503 which shows settings from SRAM. And don't forget to save any changes with M500, e.g. bed leveling, z-offset etc.

Johannes Helm
Sep 26, 2020

@Johannes L thru pronterface i can see m206 has a value of 1.15 but when i go to axis > configuration > Probe Z Offset - it shows 0.000 :S

0
Load more replies
Johannes Helm
Sep 26, 2020  ·  Edited: Sep 26, 2020

@Michael G First it probed only 57 points after setting the non probe are to 15mm it got to 91 points. As u move the Y axis to max u can see that the probe is unable to probe like 25-30 mm from the front side of the X axis.


is there a way to know if my UBL actually is working? In my slier i have removed the M420 command. I have G28 > G29 L1 > G29 J... before the print i can see printer probing 3 spots. But during print, at least for me it seems that the Z axis is moving less




0
Michael G
Sep 26, 2020

Doing G29 T in pronterface will show you a matrix for the mesh. It will show you where there are gaps the G29 P3 T will fill in the missing spots using "smart fill". The docs say that all 100 points might not be touched. This is ok.


Next make sure you save the mesh, G29 S1, then G29 F 4.0 to set the fade height. Activate UBL by G29 A and finally save it all with a M500.


When you G29 J in your code the default functionality is to probe three spots for bed skew.


The movements might seem smaller because your mesh is now finer. Visualizing it in Octoprint is the best way to see what's going on. You might have to change how the mesh bed visualizer gets the matrix with UBL. I haven't set it up.


My other printer is dead at the moment (shorted thermistor took out the board) so I can't really give a demo.

0
andrew leroy
Sep 26, 2020  ·  Edited: Sep 26, 2020

@Johannes Helm 3 Things:

  1. Are you using the magnetic flex plate? If so, you will have to be careful where you probe. If you probe directly over (or too near) a magnet, you will get a bad reading.

  2. Make sure you heat up your bed when you probe, edit your mesh, and test for your z-offset. The heat can expand your bed, and the current running through the bed can induce magnetic fields that may affect the probe reading.

  3. Use M851 instead of M206 to set your z-offset. M206 sets the offset for the entire coordinate space. M851 is specific to the z-probe. They have essentially the same effect; but, I think there might be some internal stuff in the UBL code that doesn't jive with M206.

  4. ...okay, 4 things... don't bother with G26. That whole thing is way too slow. Just make a simple 10x10x0.2mm cube, drop it into Cura, position it on the first UBL mesh point (nearest X:0, Y:0). There's a Cura plugin that will let you layout an object in a pattern. Just specify the spacing.

  5. Better yet ... just use the "mesh edit" function on your LCD (assuming you have one). MOVE -> Unified Bed Leveling -> EDIT MESH. Scroll through the mesh points until you get to the one(s) that are bad. Then press the button. It will bring the nozzle down onto the selected point so can you manually adjust the mesh point with a piece of paper. It will make you adjust all the adjacent points as well. When you're finished, just select a point and click the button; but, instead of adjusting it, hold the button in. It will take you back to the info screen. Make sure you G29 S1 and M500 (or "save settings" on the LCD configuration menu). Oh, and you have need be sure UBL is active 1st. You can do that in the UBL menu or pronterface/octopi: G29 L1 (load mesh in slot 1); G29 A (activate UBL).

Jay M
Oct 16, 2020

I tried this. I evidently just have no clue what I'm doing. My grid looked like this...



I wasn't even sure what to do with that. SOOOO...


I backed those config changes out and decided to increase the measurement points and increase the measurement points to 7x5 and added in 3 extra points between...


I meant to EXTRAPOLATE_BEYOND_GRID but forgot evidently.


#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)

  // Set the number of grid points per dimension.
 #define GRID_MAX_POINTS_X 7
 #define GRID_MAX_POINTS_Y 5

  // Probe along the Y axis, advancing X after each column
  //#define PROBE_Y_FIRST

 #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
    // Beyond the probed grid, continue the implied tilt?
    // Default is to maintain the height of the nearest edge.
    //#define EXTRAPOLATE_BEYOND_GRID

    // Experimental Subdivision of the grid by Catmull-Rom method.
    // Synthesizes intermediate points to produce a more detailed mesh.
 #define ABL_BILINEAR_SUBDIVISION
 #if ENABLED(ABL_BILINEAR_SUBDIVISION)
      // Number of subdivisions between probe points
 #define BILINEAR_SUBDIVISIONS 3
 #endif

#endif

Anyway (wow, how do I get out of this color)... with this and BabyStepping I'm happy enough with the FlexPlate Heated Bed now. I'll post another thread with some result pictures.


Jay

Copyright © Makertech 3D Ltd. 2020 - All Rights Reserved. - U.K. Company No. 10715504 - U.K. VAT No. GB 273781181

Return to main site here.