Our Location
304 North Cardinal St.
Dorchester Center, MA 02124
Automatic bed leveling helps improve first layer height above bed. That is very useful, because if the first layer does not stick, the rest of the print does not matter. It also lowers the bar for first times to get started, and it saves a bunch of time for old-timers that have moved their printer.
But bed probing, the pre-cursor to automatic bed leveling can be done in a lot of ways. There are a bunch of probes available for the actual probing, but choosing the right probe depends on the type of bed, the weight of the sensor, the cost etc. In addition, different printers have different ways of doing the probing.
Redeem has gotten some much needed attention on the bed probing, leveling and visualization of the process and results lately. This blog post aims to go over the new interface, including some helper G-codes for quickly getting started.
The interface (how to use the command) is pretty straight forward. The G29 code itself is only a macro, meaning that it does almost nothing except execute all the G-codes in it’s macro definition. The only parameter that can be supplied, is the letter “S”, for Simulate. If an S is added, all lines with the letters “RFS” (Remove For Simulation) is removed from the macro. The G29 macro is defined in the config file hierarchy, and can be generated using the G-codes G29S and G29C. See further down. Here is the interface definition.
Send: G29? Recv: Probe the bed at specified points and update the bed compensation matrix based on the found points. Add 'S' to only simulate and thus remove all lines containing the letters 'RFS' (Remove For Simulation).
You can put pretty much any G-code that is implemented in Redeem. The reason the G29 is implemented as a macro is to facilitate all the different ways 3D-printers, CNC mills and lasers are built, with all their quirky ways of probing. Here is a list of G-codes that might be useful.
This is a utility function for manipulating the bed matrix. M561 is defined to “reset the bed matrix” according to the reprap wiki. To maintain compatibility with that definition, the M561 without parameters will do just that. It has also been extended with some functionality. If a “U” is added as a parameter, the bed calibration matrix is updated based on the data from a probe. If “S” is added as parameter, show the current matrix. The reason for having this as a separate G-code and not as a part of the G29 inner workings is so that is can be removed during a simulation and also used in different places in the macro.
Send: M561? Recv: This cancels any bed-plane fitting as the result of probing (or anything else) and returns the machine to moving in the user's coordinate system. Recv: Add 'S' to show the marix instead of resetting it. Recv: Add 'U' to update the current matrix based on probe data
This is used to pre-define which points to probe. No probing occurs, just a definition of a probing point which can later be recalled using the G30 command.
Send: M557? Recv: Set the points at which the bed will be probed to compensate for its plane being slightly out of horizontal. The P value is the index of the point(indices start at 0) and the X and Y values are the position to move extruder 0 to to probe the bed. An implementation should allow a minimum of three points (P0, P1 and P2). This just records the point coordinates; it does not actually do the probing. Recv: P = Probe point number. Recv: X = X-coordinate Recv: Y = Y-coordinate Recv: Z = Z-coordinate. If missing, set to 0
The G30 command is used to perform the actual probing. In the G29 macro, this is the meat and potatoes of the routine. During a testing phase, this can also be a very useful command to try when just trying the probing to make sure it works.
Send: G30? Recv: Probe the bed at the current position, or if specified, a point previously set by M557. X, Y, and Z starting probe positions can be overridden, D sets the probe length, or taken from config if nothing is specified. Recv: F sets the probe speed. If not present, it's taken from the config. Recv: A sets the probe acceleration. If not present, it's taken from the config. Recv: B determines if the bed marix is used or not. (0 or 1) Recv: P the point at which to probe, previously set by M557. Recv: P and S save the probed bed distance to a list that corresponds with point P
Activate whatever probing mechanism you have. This is itself a macro, so typically you would put some G-code that will move a servo with a switch in place, apply power to a solenoid, or simply define an end-stop to be active through the M574 command.
This should reverse the action done by the G32 command.
The G29 command is implemented as a macro. That means that it is simply a bunch of G-codes read and executed in an orderly fashion. This is useful, because it makes it easy to adjust how the G29 code works for each individual printer. The downside is that it can be meticulous to write the G-codes by hand. Therefore a nifty G29 generator has been made and implemented in Redeem. It can be invoked by the command G29S (S is for Square) or G29C (C is for Circle).
A quick view of what the two pattern generators look like:
Send: G29C? Recv: Generate a circular G29 Probing pattern Recv: D = bed_diameter_mm, default: 140 Recv: C = Circles, default = 2 Recv: P = points_pr_circle, default: 8 Recv: S = probe_start_height, default: 6.0 Recv: Z = add_zero, default = 1 Recv: K = probe_speed, default: 3000.0
Send: G29S? Recv: Generate a square G29 Probing pattern Recv: W = bed depth mm, default: 200.0 Recv: D = bed depth mm, default: 200.0 Recv: P = points in total, default: 16 Recv: S = probe start height, default: 6.0 Recv: K = probe_speed, default: 3000.0
Here is visual representation of what that looks like.
For many users, using the pattern generator directly can work, but for users with special probing routines, they can work as starting points for further improvements to the macro.
There are several ways to visualize the results of a probing. Toggle will give an online (real time) view in 3D of the probing as it occurs using color coded pointers. This is useful to get a glimpse of the skewedness of the bed during a probing, and quickly determine if a probe point is registered as an outlier. That can happen if the probe is triggered too soon. It might be considered too coarse to do any optimization of the bed, but it’s good for getting an indication.
Looking at the results from the below probing for instance, done on my Thing Delta , it’s clear that the bed is really pretty slanted, having the highest point at +1 mm and the lowest at -1.94 mm. Still, looking at the pattern it appears to be pretty linear with the highest towards the front and the lowest towards the back.
Running the same probe with the command “G29 S” reveals the flatness of the bed using the currently implemented bed calibration matrix. The hight map generated by the probing points should now be more or less random, but with a much lower difference between the highest and the lowest probing point. In the testing probe run, the total height difference is only 0.17 mm, which is not great, but good enough for most prints.
Second is using the review website to view the results of the probing. After a probing routine has been completed, a small info box will appear in OctoPrint, with a prompt to view the result of the probing. This link will upload the probing data to a website for viewing in a 3D-preview. Historical data is kept and can be added as an overlay to the previous probing results, giving an indication of whether or not the probing is improving. The review app differs between probing and testing data, depending on whether or not the “S” was added during the probing, so it is easy to compare the results before and after.
Hi. This is neat! However, must we deviate even more from GCODE standards? “G29S” is not valid GCODE and likely not even be send by some CNC controllers — or if so, it will be sent (or expected to be translated as) “G29 S” (with the space).
Might I suggest sticking with the GCODE standard, which is this case would indicate using something like G29.1, G29.2 etc.
Cheers.
Yes! Thanks for the pull request, it should be accepted now : )
Thanks for being so welcoming of our input. It’s really great! 🙂 Such a freakin cool project all this too, if I didn’t say. 🙂
I am trying to get this to work on a Printrbot Simple Metal. I have made most of the adjustments to local.cfg and the machine moves properly, the extruder extrudes the right amount, ect. The problem is the auto-level routine. I’ve tried two approaches. First i tried to write my own, the result was that Redeem crashed and took the system with it. I had to reboot. Next I tried working with the routine in default.cfg. This runs without crashing, but fixes the bed level 10 mm above the bed.
The problem is that the Z sensor is fixed on a probe that is about a millimeter above the print head (it’s inductive). There is no need to deploy it and it’s always on, so G31 and G32 don’t do anything. The leveling routine lifts the printer head up some distance to make room for the sensor and that is why the bed level is too high when I run it. However, when I set that distance in G-code to zero, the system crashes. I don’t know why.
Has anyone tried to make Replicape work for Printrbot models?
What exactly happens when you do G29.2? I see that code is generated in the terminal, Is it stored somewhere or is it a cut and paste deal?