Sunday, March 29, 2020

Testing UMMD's New Z Axis Optical Endstop and Differential Screw Adjuster

I recently posted about the optical endstops in put into the X and Y axes and a couple prints that I ran to test them. I also installed an optical endstop in the Z axis, and now it's time to test it.

Two Tests

The new Z axis optical endstop is a unique design that uses a differential screw to enable fine adjustment of the bed position. I devised and ran two tests to see how well it performs.

The first test is simply to check the precision, meaning the repeatability, of the optical endstop. I wanted to know if the bed goes to the same position every time it is homed and if it doesn't, how much the position varies.

The second test is of the differential screw mechanism. It is designed to move the bed 100 um for each full turn of the thumbwheel adjuster over a 2 mm range. The thumbwheel has 10 bumps on it, so if the screw behaves perfectly, each bump represents a 10 um movement of the home position of the bed.  I wanted to find out how accurate it is.

Test 1: Precision of the Endstop

I tested the X and Y endstop precision by running two identical prints, one homed only at the start of the print, and the other rehomed at each layer change. If the precision were poor, the layers of the rehomed print would not stack on each other very well and the print quality would be bad. The result of that test was nearly identical prints indicating that the precision of the X and Y endstops is very high. I expected no less from the Z axis endstop.

For the Z axis homing precision test I mounted a gauge on the printer's frame and moved the endstop down the frame so the print bed wouldn't smash the gauge, then homed the bed, zeroed the gauge, and then moved the bed down different distances and rehomed the bed, checking the home position each time.

Here's video of the test:

As you can see, 8 out of 10 times, the gauge went right back to 0.00 mm, and the other 2 out of 10 times it went to 0.01 mm. That is the excellent performance I expected.

My gauge has a basic accuracy spec of 0.03 mm and a precision spec of 0.01 mm.  Assuming those specs are to be believed, the readings made are at the limit of the gauge's ability to differentiate the position of the bed. 

Test 2 : Accuracy of the Differential Screw Adjuster

For this test, I positioned the endstop and backed out the adjuster screw, homed the bed, zeroed the gauge, then turned the adjuster one full turn and rehomed the bed multiple times.  Each full turn of the adjuster should move the bed 100 um. The thumbwheel on the adjuster screw has 10 bumps, one of them proud of the surface so it is easy to tell when the screw has made a full turn.

This is the differential screw adjuster and optical endstop.  Notice the one tall bump on the thumbwheel that makes it easy to index the amount of rotation applied.

Here is video of that test:

03290007 from Mark Rehorst on Vimeo.

As you can see, when I turn the screw one full turn the home position of the bed moves by about 100 um. I used an ordinary M5 screw that I modified using a lathe and a standard M4 die to cut new threads. The thread pitch probably varies slightly in both the M5x0.8 and M4x0.7 portions of the screw, and the printed plastic parts flex a bit whenever I adjust the screw, which explains the not exactly 100 um behavior, so I am pleased with the result. This makes small adjustments to the bed position very easy compared to trying to do the same with an ordinary M4 or M5 screw that would move the bed 700 or 800 um per turn.

A couple people have suggested that a differential screw would be a great way to move the levelers of a kinematic printbed mount.  You usually have to make very fine adjustments there to tram the bed to the printer's X and Y axes.

Sunday, March 22, 2020

Testing UMMD's XY Optical Endstops

Something Strange

We had a MarkForged printer demo at the Milwaukee Makerspace last year.  The print they demoed had the extruder rehoming in X and Y at every layer. I noticed that the machine had optical endstops and that the print quality was very good, even with re-homing, something I would not have expected.

I'm not sure why they would re-home at every layer change. Unless the printer skips steps during printing, which should never happen in a well adjusted and configured printer, there should be no need to re-home between layers. Maybe it has something to do with the cost of their filament. Re-homing might save having to print sacrificial objects when they are small and you want to maintain print quality. Re-homing between layers would slow down the process and allow the print to cool between layers.

I never tried re-homing when UMMD had snap-switch endstops- it seemed likely to result in poor print quality because I would not expect the snap-switches to be especially precise.  Errors as small as a few 10s of microns should be pretty obvious in print surfaces.

New Endstops, New Tests

I recently converted UMMD from snap-switches to optical endstops, mostly because they light up when the endstop has been triggered and I like not having to look at the controller when I'm setting up the machine. I also expected that they would be higher precision than the snap switches- they certainly have much lower hysteresis.  

Today I tested that idea by copying the MarkForged technique. I set up two identical prints, one that homes the machine only at the start of the print and the other homing at every layer change (in PrusaSlicer, go to Printer Settings > Custom G-Code > After Layer Change G-Code and enter G28 X Y which re-homes the X and Y axes after the bed drops for a layer change).

UMMD test print- rehoming X and Y with each layer change from Mark Rehorst on Vimeo.

I ran the prints and to my great surprise, they came out essentially identical.  There's just a tiny bit of stringing in the print that re-homes at every layer, otherwise, they look identical.  See for yourself:

First, the standard prints:

Now the prints that were re-homed at every layer change:

This makes me wish I had tested re-homing when UMMD still had snap-switch endstops.

The standard print took about an hour and the re-homed print took 1:42, a drastic increase in the print time.  Needless to say, I won't be using this technique all the time, but I might try it the next time I need to print some very small parts that would ordinarily require printing multiple copies and/or a sacrificial object.

This type of precision would allow restarting an interrupted print, assuming you could somehow store the XY coordinates of the fail point.

UPDATE 3/26/20

I did some digging at the MarkForged website and found this:
"The Mark Two is capable of detecting dislocations and will stop itself from wasting material or potentially damaging itself by aborting a dislocated print."

This leads me to believe that the re-homing on each layer may be done for the purpose of detecting a shifted print. The controller always knows the coordinates of the extruder carriage, assuming everything is working normally. So if it re-homes, it knows exactly how far the X and Y axes have to go to bump the endstops. If it moves the extruder carriage toward the endstops and one of them triggers early or late, the extruder carriage did not end the last layer where it was supposed to, meaning that the print has shifted and it's time to stop printing.  

The cost for the hardware to implement this is miniscule- my endstops cost about $3 each. The real cost is the increased print time required to do all that re-homing. If you assume re-homing adds about 20 seconds per layer, and there are 5 layers per mm, that's about 100 seconds per mm height of the print.  If your print is 150 mm tall, that's 15,000 seconds added, or about 4 hours and 10 minutes!  Ouch!

If you were printing expensive materials, like MarkForged's carbon fiber stuff, or PEEK, etc., it might be worth the extra time to ensure that material doesn't get wasted on shifted prints.

I hope that the feature can be turned off...

... or maybe I'm wrong and that isn't the purpose of rehoming at every layer...

Coming soon: test Z-axis precision with the new optical endstop.

Note: the photos were taken with my Samsung NX500 camera and a Canon New FD 50mm macro lens and adapter.

Sunday, March 8, 2020

A Differential Screw Based Z Axis Optical Endstop Design for UMMD

The Old Z Axis Endstop

I'm kind of old-school in my printer designs. I like things to be as close mechanically perfect as I can figure out how to make them, instead of putting sensors everywhere and hoping the controller's firmware can compensate for poor materials or construction.  If you've followed any of my blog posts on UMMD you'll know I prefer to use a flat print bed, accurately trammed instead of putting a bed sensor on the extruder carriage.  I also prefer to use endstop switches in all axes.

When I built UMMD one of the things I put some extra effort into was a finely adjustable Z=0 endstop.  I used a lever and cam to effectively reduce the adjusting screw movement to approximately 100 um per rev of the screw. It has worked well and reliably for a few years but during recent work on the machine I noticed some things I didn't like, leading me to redesign the whole thing.

The main problem is that the switch is mounted solidly on the frame of the printer and the adjuster/lever/cam are mounted solidly on the moving part of the Z axis.  Over the last few years as I've swapped out hot-ends and extruders, changed a few things in the Z axis, and rezeroed the bed a number of times, the adjuster has crashed into the switch a few times.  The result is that the switch has put some dents in the cam so adjustment isn't as smooth and reliable as it was when the whole thing was new.

This is the lever/cam assembly that used to bump the microswitch.  It has become a problem to set the Z=0 position because the dents in the cam no longer trigger the switch the way the smooth surface used to.

I could print a new lever and cam but that wouldn't prevent the problem from happening again, and making it out of metal seems like a lot of trouble.  The way the switch is mounted is a big part of the problem.  It should not be set in opposition to the motion of the Z axis.  After changing to optical endstops in the X and Y axes, I decided to do the same in Z with the intention of mounting the endstop so that if the bed moves up beyond the endstop it won't damage anything.

I could just mount the switch on a spring that would allow it to move a bit if the cam bangs into it too hard, but there are other considerations as well. The original lever and cam design worked pretty well, but it wasn't really linear so I could never be sure of the exact amount of movement I was getting when I turned the adjuster screw.  I wanted to get 100 um per rev of the adjuster screw so that I could accurately move the bed in small amounts like 20-50 um.  I decided to look for an alternative and discovered something called a "differential screw".

How It Works

There are different ways to implement a differential screw.  The one I chose has two different thread pitches along its length.  One end of the screw turns in a fixed nut, the other is in a sliding nut.  If you turn the screw clockwise, it moves into/through the fixed nut and into/through the sliding nut.  The net movement of the sliding nut is the difference between the two pitches.  The sliding nut movement is in the direction of the screw movement if the larger pitch screw is the one threaded through the fixed nut.

This video illustrates the concept:

A more compact approach is to have a screw inside a threaded tube that has one pitch on the inside and a different pitch on the outside.  Like this:

If you have deep pockets you can buy off-the-shelf differential screws from specialty mechanical parts companies. Beware the ~$20 "differential screw micrometers" being sold on ebay.  They appear to be simple 0.5 mm pitch screws with a nice knob.  I don't have the deep pockets for a real differential screw, and since I wanted 0.1 mm per turn of the screw, I looked for standard screws that had 0.1 mm difference in their pitches.  A look at a metric thread pitch table reveals multiple possibilities.

Size - Nominal Diameter
Clearance Drill
Tap Drill
Tensile Stress Area
M 1.60.351.81.25
M 20.402.41.60
M 2.50.452.902.00
M 30.503.402.50
M 3.50.603.902.90
M 40.704.503.308.78
M 50.805.504.2014.2
M 61.006.605.0020.1
M 101.5012.008.5058.0
M 121.7514.0010.2084.3
M 142.0016.0012.00
M 162.0018.0014.00157
M 202.5022.0017.50245
M 222.5025.0019.50
M 243.0027.0021.00353
M 273.0030.0024.00
M 303.5033.0026.50561
M 364.0040.0032.00817
M 424.5046.0037.501120
M 485.0053.0043.001470
M 565.5062.0050.502030
M 646.0070.0058.002680
M 686.0074.0062.00

1) For metric threads pitch is the distance between threads.

There are multiple pairs of screws that could be used to get 100 um per turn sensitivity (M3/M3.5, M3.5/M4, M4/M5), and even some that could give 50 um per turn (M1.6/M2, M2/M2.5, M2.5/M3), but those screw sizes are relatively uncommon, especially in the long lengths (70 mm or so for my application) needed.

I selected the M5/M4 combo.  Every turn of the M5 screw moves the screw forward 0.8 mm and moves the sliding M4 nut back 0.7 mm leaving a net forward motion of 0.1 mm at the sliding nut.  If I use the sliding nut to activate my endstop switch, I'll have a very finely adjustable endstop, and unlike my previous lever/cam arrangement, every turn of the screw should give exactly 100 um with accuracy limited by the screw thread quality.  This technique can be used to bump a mechanical switch or to trigger an opto interruptor.

One problem with this arrangement is limited range of motion at the output.  If I turn the M5 screw 10 times, the screw will move 8 mm.  The sliding nut will move 1 mm in the same direction as the screw.  So if I want 10mm adjustable output range, the 5mm screw would have to be at least 80mm long and the 4mm screw at least 70mm long. Not even UMMD has room for a 150mm long Z=0 screw.  Nope, I won't be adjusting the screw over a 10 mm range.

UMMD's opto endstop mounts on the Z axis vertical T-slot frame so the endstop can easily be repositioned within the adjustment range of the differential screw, so I settled on a reasonable differential screw adjustment range of 2 mm.  The 5mm screw has to move 16mm and the 4mm screw 14mm.  That means the exposed thread length of the screw has to be 30 mm plus the thicknesses of the fixed nut, the thumbwheel, the sliding nut and the mount.

Making a Differential Screw

I tried printing a jig to hold two screws, one M5 and one M4 butted end to end, with a spherical space inside the jig at the joint.  I screwed one screw into the jig, then inserted a drop of epoxy, then screwed in the other screw until it stopped against the first screw.  After the epoxy set, I cut off the jig.  The force required to cut off the jig resulted in breaking the epoxy joint between the screws.  Hmmm.

Someone at the makerspace suggested that I could drill holes in the ends of the screws and use a pin to hold them together, but I couldn't figure out a good way to accurately drill a ~1 mm hole in the axial center of a screw.

Another suggestion was to make a coupling nut that was threaded for M5 on one side and M4 on the other and then just screw it together with locktite or epoxy to ensure it can't easily come apart.  This is probably the easiest way to go, but adds the length of the coupling nut to the screw.

Finally, someone else at the makerspace suggested that I drill and tap a block of metal, then split it with a saw and use it as a clamp to hold the screws for welding.

In the end, I mounted a 50mm long M5 screw in a collet on a lathe and turned the end 20 mm down to 4 mm diameter, then threaded it with an M4 die.  It was actually pretty quick and easy, mostly because I had help from an expert lathe operator at the makerspace.

Turning the M5 screw on the lathe.  M5x0.8mm threads have a minor diameter that is about 4 mm, so essentially, all you have to do is turn it down until the threads disappear.  I made four or five passes making very shallow cuts so that the cutter wouldn't deflect the screw too much as it was cutting it.  After the screw was turned down to about 4 mm diameter, I rotated the cutter and beveled the end of the screw.

Once the M5 threads were removed and the end of the screw was beveled, I used a die to manually cut the M4x0.7 mm threads into the end of the screw.  The end of the tailstock on the lathe (not visible in the picture) was used to ensure that the die was started square to the screw.
Testing the M4 threads after cutting them.  Yup, it works!
The almost finished differential screw.  I still have to grind flats on the head so I can turn the screw with a printed thumbwheel.

The Rest of the Parts

Once I had the screw, the rest was easy.  I designed and printed a thumbwheel with 10 evenly spaced bumps to make it easy to set the position - just turn the screw by 1 bump for every 10 um of movement.

The base of the part (the red block under the bracket in the image below) is the fixed nut that the M5 screw threads into.  I used a block of PTFE, 5mm thick, because it works well for that type of operation in the kinematic mount for the bed.  I drilled an undersized hole and let the M5 screw roll its threads in the plastic.  It is gripped firmly but still easily adjustable.

CAD rendering of the differential screw and opto endstop mounted on t-slot.

The flag is a printed part (blue) with a hole to fit an M4 nut.  I found a spring in my junk box that pushes the flag up against the nut and minimizes backlash. The flag spring and screw fit into a printed square tube (yellow) that prevents the flag and nut from rotating as the adjuster screw is turned.  When the adjuster is turned 20 times, the screw moves 16 mm and the flag moves 2 mm in the same direction as the screw.

You can't tell from the picture, above, but if the opto endstop should fail and the bed keeps moving up, the square tube tube will have room to pass by the opto interruptor, so nothing will get damaged.  The bearing blocks on the Z axis will eventually hit the physical stops.

The Fusion360 CAD file is here and the STL files of the printable parts are here.

Here are the pieces of the new Z=0 adjuster.  The PTFE fixed nut (white) mounts on the belt clamp bracket as does the square tube (blue).  The differential screw goes through the fixed nut and the bracket.  The spring goes inside the square tube to keep the flag and M4 nut pushed against the screw threads.

The opto endstop is screwed to a printed bracket that is held on the printer's Z axis vertical frame with a bolt and t-nut.


This is what it looks like when it's assembled.

And this is what it looks like when it is installed.

Other Uses for Differential Screws

A few people on the 3D printing forums have suggested that a differential screw would be a good thing to use in a kinematic printbed mount since the adjustments in those are usually very small.

People make focus-stacking rigs for macro photography using linear guides and stepper motors to move the camera or object being photographed in small steps as they capture a series of images that are later processed using stacking software to greatly increase the depth of focus in the final image. The typical way to do it relies on the relatively inaccurate microstepping to reposition the camera or object 10-50 um between images.  It would be pretty easy to couple a differential screw to a sliding carriage.  With a differential screw made using M5x0.8 mm and M4x0.7 mm threads, a full turn of the motor (200 steps, typically) will move the camera or object 100 um, so each full step of the motor will move the camera or object 0.5 um.  That means you can use the relatively accurate full steps of the motor for fine positioning instead of relying on "iffy" microstepping.

If you wanted to make a laser engraver to make very small markings, or even a 3D printer to make very small parts, differential screws could be used to position the laser/extruder.

How about a motor driven microscope stage?

UPDATE  3/30/20

I have run some tests on the precision of the opto endstop and tested the differential screw adjuster.  New post here.