Jump to content
Sign in to follow this  
stevegt

Calibration utility: leveling-rings.gcode

Recommended Posts

Posted · Calibration utility: leveling-rings.gcode

Hi All,

I wrote a little snippet of g-code that helps greatly when checking bed leveling, and gives you a chance to twist the thumbscrews in real time for fine-tuning. I wrote this while troubleshooting a Z homing bug in Ultimaker2Marlin 14.03, and it's become my standard quick "warm-up" print at the beginning of each session.

What it does is lay down a concentric set of rings, 150 mm diameter, in a single .1 mm layer. When your printer is calibrated correctly, you'll see these rings' edges touching, or nearly so. Glass too high means you mash the glass into the nozzle and get little or no plastic, glass too low means you get dribbles.

You'll quickly get good at twiddling the bed height thumbscrews screws while it's slowly circling; your goal is to make the rings nice and even all the way around, like the photos below.

The gcode is actually generated by a python script -- I've uploaded both to https://github.com/stevegt/UltimakerUtils.

In case you're wondering if that Z homing bug affects you, this is a good way to check; level your bed, then print these rings, then turn the power off, gently push the bed all the way down if it doesn't fall on its own, then power on and print these rings again, then print them again without cycling the power. If the bug affects you, then you'll have the devil of a time getting consistent results -- in my case, it kept printing about .7 mm too high or too low. For more information about the bug, as well as both a workaround and a firmware patch, see http://umforum.ultimaker.com/index.php?/topic/5935-z-axis-homing-inconsistent-on-um2-workaround-and-patch/.

leveling rings

leveling rings closeup

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

Oh yeah baby! Printer porn! It's beautiful! It's perfect!

leveling rings closeup

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

Another quick test to see if you have the leveling bug - turn off power, push the bed all the way down until it stops. Then twist the Z screw and count how many clicks you feel until you hear the Z level switch click off. I get 16 or 17. Take that result and divide by 6.25 and that's how many mm that distance is. If that distance is > 3mm then you have a leveling problem (won't be repeatable). If you get 19 or more, then fix by bending the Z limit switch arm slightly.

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

LOL, my gcode needs a little work.... Unless I just invented the gcode spirograph....

 

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

Python code to generate circle gcode for UM1.

NOTE: someone needs to check my calculations especially around the extrusion amount.

 


#!/usr/bin/python
filament_diameter = 2.89
build_area_width = 205.0
build_area_depth = 205.0
rings = 10
wide = 0.4
thick = 0.2925 / 2
temperature = 230
bed_temperature = 60
base_dia = 180
pi=3.1415927
center_x = build_area_width/2.0
center_y = build_area_depth/2.0
filament_area = (filament_diameter / 2) ** 2 * pi
head = '''
M107 ;start with the fan off
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
G1 Z15.0 F9000 ;move the platform down 15mm
M140 S{bed_temperature:.2f} ;set bed temp (no wait)
M109 T0 S{temperature:.2f} ;set extruder temp (wait)
M190 S{bed_temperature:.2f} ;set bed temp (wait)
G92 E0 ;zero the extruded length
G1 F200 E3 ;extrude 3mm of feed stock
G92 E0 ;zero the extruded length again
G1 F9000 ;set speed to 9000
;Put printing message on LCD screen
M117 Printing...
;Layer count: 1
;LAYER:0
'''
loop = '''
G0 F9000 X{x:.2f} Y{y:.2f} Z{z:.2f}
G2 F1000 X{x:.2f} Y{y:.2f} I{r:.2f} E{total_mm3:.2f}'''
tail = '''
;End GCode
M104 S0 ;extruder heater off
M140 S0 ;heated bed heater off (if you have it)
G91 ;relative positioning
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more
G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
M84 ;steppers off
G90 ;absolute positioning'''
total_mm3 = 0
body = ''
cross_section = thick * wide
z = thick
for i in range(rings):
dia = base_dia - ((wide * 2) * i)
circumference = pi * dia
r = dia/2.0;
x = center_x - r
y = center_y
mm3 = (circumference * cross_section) / filament_area
total_mm3 += mm3
body += loop.format(**vars())
print head.format(**vars())
print body
print tail.format(**vars())

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

Python code to generate circle gcode for UM1.

NOTE: someone needs to check my calculations especially around the extrusion amount.

 

Very cool. I'll see if I get a chance to check the math for you tomorrow -- where did the 0.2925 number come from? Or is that one of those black magic UM1 potions that wood machine masters keep under wraps? ;-)

Is it okay if I add that script to the github repository alongside the UM2 version? Or even -- horrors -- merge the two scripts? I'd want to credit you either way (GPL okay?).

Steve

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

Hey Steve,

Yeah the .2925 is one of those magic numbers which is a multiple of the Z steps. It's probably better to change it to .3 so people don't wonder about it.

You did most of the work, I just added the UM1 start and end gcode and the adjustment for the extrusion amount.

I don't need credit and you can incorporate it as you see fit.

The only thing is I accept NO liability for any damage done but using either version or any derivatives. USE AT YOUR OWN RISK.

(lawyers..... sigh).

 

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

Anon, haha good work. Love your style!

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

If Steve is going to host the UM1 version in the same place or combine them, may I suggest that the moderators change the thread title to not be specific to the UM2 with Steve's permission?

Then delete my other thread as it is both redundant and duplicative....

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

That sounds great but should I do that now or wait until steve finishes with combining?

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

I'll defer to Steve because it's his thread, I don't what to tell you to change somebody else's thread. Assuming he is OK with it, change the thread title immediately since the UM1 info and discussion is already here even if it never is merged with the UM2 version and gcode in github and then delete mine (it was stupid to make it... sorry, I was riding high on the UM1 circle pr0n).

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

Hey George,

Go ahead and change the thread title (just delete the "UM2"?).

Thanks anon, I'll get it into github, probably add some docs there as well.

Steve

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

Okay, it's all in github, I've renamed the repository on github as well, added a README, and adjusted the URL in my first post above accordingly.

Still haven't gotten around to checking that math. ;-)

Steve

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

I've finally gotten around to try this and it's fantastic! Thank you so much for writing this. Managed to perfectly calibrate my poor neglected printer within minutes.

Since I have a UM1 without a heated bed, I used the https://github.com/markdeklerk/UltimakerUtils/blob/712ca4432df42e686d093931bc2c515927c6e630/leveling-rings-UM1.gcode by markdeklerk.

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

I'm definitely not an expert and only have a UM1 but to me it looks like the circles aren't touching and that indicates a problem. When cooled, the print should be on piece and not come about into threads easily.

I would do the test and let the print cool then carefully remove it. Then measure it's thickness with calipers. It should be the same as the layer height in the script. If the thickness is too high, twist the bed screws such that the bed moves up towards the nozzle and retest.

If the thickness is about the same as the layer height then you have under-extrusion. With the calipers, measure the width of the filament in various locations and orientations (rotate the calipers around the filament) and average the results. Then set that average as the filament diameter in the printer and retest.

If the current setting is about the same as what you measured, you'll need to wait for others to help as you have an issue with the feeder or nozzle which are too different from the UM1 for me to help.

If that is the case, I suggest you start a new thread.

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

since i don't have a python box running ATM, is there a GCODE we can use for the UM2 as well?

 

Share this post


Link to post
Share on other sites
Posted · Calibration utility: leveling-rings.gcode

This remains one of my favorite (and most printed) gcode scripts :)

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Our picks

    • Ultimaker Cura 4.0 | Stable available!
      Ultimaker Cura 4.0 is mainly focused on the improved user interface and cloud integration.
      As always, we want to collect your user feedback for this release. If there are any improvements you can think of, feel free to mention it here and help us to shape the next release.
      • 98 replies
×
×
  • Create New...

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!