# How precise can your Smartrap print? - Alignment issues

Posted by cristian
 Re: How precise can your Smartrap print? - Alignment issues July 21, 2014 11:38PM Registered: 8 years ago Posts: 37
I haven't looked to much at inductive sensors on an aluminum plate, but an arduino can easily drive a hall effect sensor. I am thinking about a hall effect sensor on the bottom of the head and three magnets glued to the underside of the glass plate such that they form a right angle. The sensor might be useful for both bed leveling and skew. Wave the head in XY over where the magnets ought to be to search for the peak signal. Use Gaussian interpolation to estimate the position and amplitude of the peak. The XY position of the peak would be used to calculate skew. If the glass plate is of uniform thickness, the amplitude of the peak signal should also tell you how far the head is above the plate to estimate Z. Potential problems could be the noise from the fan magnets, the metal hot-end heater block, the temperature curve of the hall sensor, etc.
 Re: How precise can your Smartrap print? - Alignment issues July 21, 2014 11:43PM Registered: 9 years ago Posts: 791
Quote
CellJeffe
I haven't looked to much at inductive sensors on an aluminum plate, but an arduino can easily drive a hall effect sensor. I am thinking about a hall effect sensor on the bottom of the head and three magnets glued to the underside of the glass plate such that they form a right angle. The sensor might be useful for both bed leveling and skew. Wave the head in XY over where the magnets ought to be to search for the peak signal. Use Gaussian interpolation to estimate the position and amplitude of the peak. The XY position of the peak would be used to calculate skew. If the glass plate is of uniform thickness, the amplitude of the peak signal should also tell you how far the head is above the plate to estimate Z. Potential problems could be the noise from the fan magnets, the metal hot-end heater block, the temperature curve of the hall sensor, etc.

I have been using hall effect sensors for a while on my other machines and they are very accurate. ( and cheap too)
To use for ABL and use magnets are you have mentioned, the probing would have to be very accurate too, so that the probe would land exactly over the magnet.
If the magnets are mounted on the bed plate, that plate would also have to be positioned in exactly the same place each time as well, or there will be bed crashes for sure.
I guess all of these things can be worked out.

[regpye.com.au]
"Experience is the mother of all knowledge." --Leonardo da Vinci
 Re: How precise can your Smartrap print? - Alignment issues July 22, 2014 12:28AM Registered: 8 years ago Posts: 37
Quote
regpye
If the magnets are mounted on the bed plate, that plate would also have to be positioned in exactly the same place each time as well, or there will be bed crashes for sure.
I guess all of these things can be worked out.

Yes. The existing servoless Z enstop switch would probably need to be kept to sense head crashes. Of course an alternative would be a piezo-resistive sensor on one of the bed mounts (ala some of the Delta designs) to detect the head pushing on the plate. Luckily, the newer Z-axis floating mounts to the lead screw protect a little against tragic head crashes - so there is a little leeway. In other words, some existing method would be better to autolevel the plate before finding the skew.

Thinking about this a little further - It might also be easier and better for noise sensitivity to reverse the orientation. Put a magnet on the hot-end head and a couple of hall-effect sensors under the plate at two relative X positions. Hall sensors are quite cheap. Slide the bed back and forth along Y with the bed at one X position to find the best Y. Then slide the bed back and forth along Y with the head above the other hall sensor to find the proper Y at the other X position. You might even be able to mount two hall sensors on one of the Y arms - either the left or right side. One might also be able to integrate a piezo-resistive sensor into one of the Y axis glass attachment points and get rid of the sensors on the hot-end altogether. The problem with this arrangement would be insuring that the hall effect sensors lie along a line that is *exactly* perpendicular to the Y axis rods to make the measurement work.

I definitely agree with you that having perfectly aligned axes is ideal!

But I wrote the deskewing code because there was no way to get perfect axes with my skewed printed replacement parts. Some day soon I hope to have a backup printer... But designs are still in the works.

Edited 2 time(s). Last edit at 07/22/2014 12:31AM by CellJeffe.
 Re: How precise can your Smartrap print? - Alignment issues July 22, 2014 12:54AM Registered: 9 years ago Posts: 791
Quote
CellJeffe
Quote
regpye
If the magnets are mounted on the bed plate, that plate would also have to be positioned in exactly the same place each time as well, or there will be bed crashes for sure.
I guess all of these things can be worked out.

Yes. The existing servoless Z enstop switch would probably need to be kept to sense head crashes. Of course an alternative would be a piezo-resistive sensor on one of the bed mounts (ala some of the Delta designs) to detect the head pushing on the plate. Luckily, the newer Z-axis floating mounts to the lead screw protect a little against tragic head crashes - so there is a little leeway. In other words, some existing method would be better to autolevel the plate before finding the skew.

Thinking about this a little further - It might also be easier and better for noise sensitivity to reverse the orientation. Put a magnet on the hot-end head and a couple of hall-effect sensors under the plate at two relative X positions. Hall sensors are quite cheap. Slide the bed back and forth along Y with the bed at one X position to find the best Y. Then slide the bed back and forth along Y with the head above the other hall sensor to find the proper Y at the other X position. You might even be able to mount two hall sensors on one of the Y arms - either the left or right side. One might also be able to integrate a piezo-resistive sensor into one of the Y axis glass attachment points and get rid of the sensors on the hot-end altogether. The problem with this arrangement would be insuring that the hall effect sensors lie along a line that is *exactly* perpendicular to the Y axis rods to make the measurement work.

I definitely agree with you that having perfectly aligned axes is ideal!

But I wrote the deskewing code because there was no way to get perfect axes with my skewed printed replacement parts. Some day soon I hope to have a backup printer... But designs are still in the works.

Another problem to think about is the false triggering of the Z sensor. How can we stop it triggering when the printer is in use? Maybe some additional code within Marlin to turn off the sensing after the bed has been probed?

[regpye.com.au]
"Experience is the mother of all knowledge." --Leonardo da Vinci
 Re: How precise can your Smartrap print? - Alignment issues July 25, 2014 09:32PM Registered: 8 years ago Posts: 349
Alignment ainâ€™t a sin

I just happened to come across this video.

So alignment is a real feature and not just a thing to compensate 'inaccurate design'.

It's all about getting the best out of a machine.
Less is more. I agree, but in this case less hassle is more printing. :-)
 Re: How precise can your Smartrap print? - Alignment issues May 23, 2015 05:43PM Registered: 8 years ago Posts: 344
Finally I took some time to look into the issue, and found a minimal change (2 lines of code) to Marlin firmware to apply small skewness (more precisely: shear) corrections for XZ or YZ, to be applied on top of bed auto-tramming/leveling. It is not a proper fix, it is just an approximated workaround but works well enough if your axes are not totally screwed up. If somebody with the old smartrap is still interested, I will post it.
 Re: How precise can your Smartrap print? - Alignment issues May 23, 2015 06:04PM Registered: 8 years ago Posts: 814
Post it!
 Re: How precise can your Smartrap print? - Alignment issues May 23, 2015 07:57PM Registered: 8 years ago Posts: 344
Here we go.

Find the following code in Marlin_main.cpp, which should be around line 800:

`    plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);`

Actually, there should be two such lines, one in the function set_bed_level_equation_lsq() that you use for bed autotramming with the grid of points, the other one in the function set_bed_level_equation_3pts() that you use for the procedure with just 3 points. Depending on which procedure you use (or both if you use them both), add this code *immediately*after* the line that you just found:

```    plan_bed_level_matrix.matrix[6] += XZ_SHEAR;
plan_bed_level_matrix.matrix[7] += YZ_SHEAR;```

Then print the attached calibration model calibration_xyz.stl or calibration_xyz.scad for the parametric version, and measure the skewness for XZ and/or YZ with a (metric) square ruler and a ruler as shown in the attached picture.

You can see in the picture that the piece is not square: the angle is too wide so that at the end of the piece you have an error of about 2 millimeters. Do this measurement for both XZ and YZ, then open Configuration.h and find the following code, that should be around line 350:

`     #ifdef ENABLE_AUTO_BED_LEVELING`

After that line, add the following lines of code:

```      #define XZ_SHEAR      THE_MILLIMETERS_THAT_YOU_MEASURED_FOR_XZ_DIVIDED_BY_100
#define YZ_SHEAR      THE_MILLIMETERS_THAT_YOU_MEASURED_FOR_YZ_DIVIDED_BY_100```

Of course, you should replace the last part of the above instructions with what you measured before. So, supposing that in the picture I was measuring the error for XZ, to fix it I should add this line of code:

`      #define XZ_SHEAR   0.02`

You would have a negative sign there if the angle is acute instead of obtuse.

As I said, this is not a complete fix because the chord should be replaced with the angle, and the scale on the Z axis should also be adjusted. However the error is so small (some micrometers over a whole print) that nobody will notice (read: I was too lazy to add that too ).
 Re: How precise can your Smartrap print? - Alignment issues May 23, 2015 11:42PM Registered: 8 years ago Posts: 814
Thanks. This is good info no matter what printer your building.
 Re: How precise can your Smartrap print? - Alignment issues May 26, 2015 04:22AM Registered: 7 years ago Posts: 6
I had the same Problem and have designed a Bed Leveling system to compensate the whole think.