Okay, I've been delving into the mysteries of the grid-based tramming in Smoothieware today, and made much progress.
As mentioned some posts ago on this thread, I just did my best to fill in the relevant values in the configuration file for the Smoothie, and then ran the z-grid tramming ("G32" command), and ended up with an immediate head crash. I then went on vacation, followed by moving to a new house, and so it has taken me some time to get back to looking into it in more detail.
Today I stared at the source code to figure out what it was doing for the z-grid, and found a few hidden features plus a few errors. I have submitted an error report for the errors I found to Arthur Wolf, and hopefully my fixes will get merged into the Smoothieware code base on github soon.
The root of the problem turned out to be that normally, the Z-grid calibration wants to start at position (0, 0) and mark off the board in a grid, to the limits. It will do this by putting the sensor at each of those grid points. But the sensor is offset from the extruder head, so depending on where the sensor is located, the value (0, 0) may not be possible to reach. With the sensor to the right of the nozzle, it's to the left of where the X endstop stops the extruder assembly (in fact, I didn't suffer a head crash after all; it was just the X motor trying to ram the extruder assembly into the left side of the frame. A little hard to tell what was going on with all the noise and shaking, and the immediate reaction to go for the kill switch).
Even if you could get the sensor to position (0, 0), you wouldn't want it there, because it's an inductive sensor and needs enough metal underneath to induce a loop current. Being at the very corner of the metal plate isn't going to do it. So the Z grid to calibrate to is going to have to be smaller than the heated bed plate.
The "hidden features" was the configuration options "cal_offset_x" and "cal_offset_y":
Code: Select all
leveling-strategy.ZGrid-leveling.cal_offset_x 26
leveling-strategy.ZGrid-leveling.cal_offset_y 20
These happen to be undocumented anywhere that I could find, but they do exactly what I was looking for: They make the grid calibration start at a point other than (0, 0). There is also "bed_x" and "bed_y":
Code: Select all
leveling-strategy.ZGrid-leveling.bed_x 169
leveling-strategy.ZGrid-leveling.bed_y 196
These are "lightly documented" and don't actually tell you that they do not represent the length and width of the bed, but rather the length and width of the calibration area. So the values shown above allow me to reduce the calibration area so that the entire area can be reached with the probe, and without the probe running off the plate or crashing into my binder clips.
My entire Smoothieware configuration section for the Z-grid calibration looks like this:
Code: Select all
leveling-strategy.ZGrid-leveling.enable true #
leveling-strategy.ZGrid-leveling.bed_x 169 # Reduced by 2x probe head width
# plus X offset
leveling-strategy.ZGrid-leveling.bed_y 196 # Reduced by Y offset and
# Addition for clips
leveling-strategy.ZGrid-leveling.bed_z 180 # Unused, manual probe only
leveling-strategy.ZGrid-leveling.cal_offset_x 26 # Add offset + probe head width
leveling-strategy.ZGrid-leveling.cal_offset_y 20 # To clear clips
leveling-strategy.ZGrid-leveling.rows 7 # X divisions (Default 5)
leveling-strategy.ZGrid-leveling.cols 9 # Y divisions (Default 5)
leveling-strategy.ZGrid-leveling.probe_offsets 15.55,-19.0,0.0 # Offset from nozzle
leveling-strategy.ZGrid-leveling.slow_feedrate 100 #
leveling-strategy.ZGrid-leveling.wait_for_probe false #
leveling-strategy.ZGrid-leveling.home_before_probe homexyz # home-Z uses Z-min stop
The probe offsets measure the distance between the probe and the left nozzle. The probe is to the right of the nozzle and slightly forward (thus the negative Y value). The last line shows that I have kept the Z-min stop switch. I think this is pretty critical. Since at Y=0, the Z probe is hanging off the front edge of the heated bed plate, you can't do a normal "Home all" using the proximity sensor. I decided it works much better to use the Z-min switch for "Home all". Keeping the Z-min switch allows the "Home all" to keep the same meaning/function as before, and prevents crashing the extruder nozzle into the heated bed plate. It no longer has to be precisely aligned, though. The Z-grid calibration takes care of that. To get both functions at the same time, I left the Z-min switch connected to the Z-min socket on the controller board, then connected the probe to the Z-max socket. In the configuration file, I set up the two pins as:
Code: Select all
gamma_min_endstop 1.28^! #
gamma_max_endstop nc #
zprobe.probe_pin 1.29!^ # pin probe is attached to
This setup is in contradiction to the instructions on the Smoothieware web site and the source code, which suggest that you cannot use the Z-min endstop and the Z-probe at the same time. Not true.
With this hardware setup and configuration, it is possible to do the Z-grid calibration correctly, and finish with real results (which can be reported back with command "G31"). It's quite fast, although it remains to be seen how accurate it is at the speed I'm running it. Now I mentioned up at the top of this post that I found some errors. Neither error causes obvious problems. One of them is an unnecessary travel during calibration so that for every calibration point, first the nozzle moves to the position, then it corrects itself and moves the probe to the position, then makes the probe measurement. It's awkward and it wastes time, but it's harmless. The other error is that the correction routine returns a zero correction value for any point outside the calibration grid. That will tend to mess up any print that extends outside the boundary defined by the grid, especially if the bed is fairly out of level. I have a code fix for both problems.
Since I spent all evening submitting bug reports and doing this writeup, print tests will have to wait until tomorrow. Stay tuned.