Friday, December 4, 2020

X Axis Wobble in UMMD

I was recently working on a smaller version of the sand table, called Arrakis, and noticed that when the magnet carriage was moving in X only, the ends of the X axis were moving back and forth about 1 mm as the magnet carriage reversed direction. I'm not sure what causes it, maybe some play in the magnet carriage on the X axis, belt stretch, flex of the X axis guide tube...


Sand table Arrakis test from Mark Rehorst on Vimeo.

Whatever the cause, it got me thinking about the possibility of the same thing happening in UMMD, also a corexy mechanism. I've never really paid attention to it, so I wrote a script to move the extruder in X only and ran it, as I had done on the sand table mechanism. I wasn't sure, but I thought I saw a tiny amount of movement. That has implications for print quality, so I wanted to test it further.

I decided to clamp a digital gauge to the Y axis guide rails, set Y to a specific value, then move the extruder carriage along the X axis and measure and movement that occurs at the ends of the X axis. I needed a custom clamp for the Accuremote digital gauge that I have used to test other aspects of mechanical performance on UMMD. I had an old DSM model of the gauge, but decided to make a new model using Fusion360 (that model is here). Once I had the gauge modeled, I dropped it into the UMMD XY stage model and designed a clamp to fit. 

Gauge and clamp models

I printed the clamp and mounted the gauge, then generated two gcode files that would move the extruder carriage in X as the gauge monitored the ends of the X axis at Y=-35 and Y=5. I started the measurements with the extruder carriage at the center of the X axis (X=0), then moved it to the right to X=145, then reversed and sent it back to the left, stopping every 5 mm and recording the gauge reading until the extruder got to X=-145. At the end the extruder returned to the center of the X axis.

The measurements were made with motion between points at 5 mm/sec, and a 3 second stop at each 5 mm test point.


Digital gauge mounted on the right side Y axis rail.


Here is the test setup with the gauge mounted on the right side Y axis guide rail. The extruder carriage is at (0,-35) where I zeroed the gauge at the start of the test runs.

 

Here is the gauge set to zero at the start of a run.

The Results

To see these graphs a little better, right click on them and select "open image in a new tab".

Graph 1: data from 3 runs with the gauge mounted on the right side Y axis guide rail at Y=-35.

Graph 2: data from 3 runs with the gauge mounted on the left side Y axis guide rail at Y=-35.
Graph 3: data from 3 runs with the gauge mounted on the right side Y axis guide rail at Y=5.

Graph 4: data from 3 runs with the gauge mounted on the left side Y axis guide rail at Y=5.


What does it all mean?

The gauge is rated for 0.03 accuracy and 0.01 mm precision. Precision applies when comparing specific data points at the different runs- i.e. comparing the value at X=50 from run 1, run 2, and run 3. So differences of +/-0.01 mm are noise and don't really mean anything. For most of the runs, most of the data at each point was within +/-0.01 mm. 

Accuracy applies to the overall position of the curves on the graph. The curve's real position may be as much as +/-0.03 mm from where they are drawn. The shapes of the curves and the differences between the maximum and minimum values should be accurate.

The waviness of each graph indicates that the ends of the X axis are moving back and forth slightly as the extruder carriage moves along the X axis, just like the sand table mechanism did, but to a much smaller degree. If you compare graph 1 and graph 2 (or graph 3 and 4) by drawing vertical lines between the two, you'll see that as one end of the X axis (one graph) moves in the negative direction, the other end (the other graph) moves in the positive direction, so the whole axis really is wobbling, with the ends of the X axis moving in opposite directions.

The X axis is maintained square to the Y axis by belt tension. The waviness of the graphs indicates that the X axis is moving slightly out of square with the Y axis as the extruder carriage moves along as if the belt tension were varying. What would cause that? Notice in each graph that the waviness moves through peaks and valleys at about 40 mm intervals. I don't think it's a coincidence that the drive pulleys move the carriage 40 mm per rotation (20 tooth pulleys and 2mm pitch belts). I suspect the main cause of the problem is crappy drive pulleys that are not accurately drilled, or it could be a bent motor shaft or two.

Notice that graph 1 and 3 ( and graphs 2 and 4) are similarly shaped with peaks and valleys occurring at approximately the same X values. I suspect that's because the measurements are made 40 mm apart on the Y axis (a full rotation of the drive pulleys) which represents one full rotation of the drive pulleys. Doh! It might have been more interesting if I had made the measurements maybe 25 or 30 mm apart instead of 40.

It's hard to say what this means for print quality. The most obvious effect should be waves in the X parallel surfaces of prints, with peaks spaced 40 mm apart. I can't say I've ever seen that in a print, but I never really looked for it. The fact that the magnitudes of the waves changes as a function of Y means that X parallel walls of prints at different Y ordinates will be slightly different. But can you see it or measure it? Of course, every surface printed will have some waviness as a result of off-center drilled drive pulleys.

Someone on a forum suggested that the waves might come from out of round idler pulleys. In UMMD the idlers are made from F608 bearings, 22 mm in diameter. If one of those was out of round I would expect the waves in the graph to show up with a period of 22xpi=69.1 mm. I can't see any 69.1 mm waves in the graphs, but maybe they are masked by the waves from the drive pulleys. There are 8 idler pulleys that turn when the carriage moves in X, so unless one of them was really bad, I'd expect any errors in roundness of those pulleys to show up as noise in the measurements.

I think I'm going to invest in some better drive pulleys and run the tests again, this time with the Y positions not 40 mm apart.

Here's the raw data that went into the charts.


Saturday, November 14, 2020

Here's What Happened When I Swapped Servomotors For Steppers In My 3D Printer

A little while ago, I replaced the steppers in The Spice Must Flow sand table with iHSV42-40-07-24 servomotors. The results were so impressive, I just had to try them in my coreXY 3D printer, UMMD.

Even though both use coreXY mechanisms, the sand table and 3D printer are two different animals. The sand table needs high speed and quiet operation over positioning precision and accuracy because sand is a very low resolution medium. The 3D printer doesn't need to be so fast, but does need to position precisely or print quality will suffer. 

It turned out that servos worked much better than steppers in the sand table. It was time to see if they would deliver similar or any performance improvements in a 3D printer.

Why would the servos have any advantage over steppers in a 3D printer? 


They run smoother and quieter since the motors don't have the detents that a stepper has. The particular servos I used are 78W motors, so can deliver much higher acceleration and jerk than the steppers can - much more than is necessary. The thing I mostly wanted to see was if they could deliver the kind of precision and accuracy that the steppers did, and that would show up in the print quality.



UMMD BS (Before Servos)


UMMD used two 64 oz-in, 400 step/rev, NEMA-17 motors to drive the XY mechanism. I ran them with 256:1 interpolated microstepping to keep them quiet. I typically ran the printer at acceleration of 2000 mm/sec^2, jerk speed of 30 mm/sec, and print speeds of around 80 mm/sec. Print quality was generally excellent, though some recent experimenting with non linear extrusion and pressure advance has it over extruding on top solid infill a bit- the tweaking never ends- sigh...

Installing Servos


The servomotors are also NEMA-17 size and have integrated encoders and drivers and accept step/direction/enable signals just like stepper drivers, so installing them in the printer was a pretty easy process, much easier than replacing steppers in the sand table.  All I had to do was remove the steppers and bolt in the servos, add the Duet expansion board to the controller, and connect the power supply and step/direction/enable lines, then tweak the config file for the Duet controller board.

I also added another 24V power supply to power one of the servomotors because I discovered in the sand table that the motors can draw a lot of current when accelerating and I didn't want the power supplies to limit the performance of the servomotors.

Setting the Motor Steps/Rev


The drive pulleys are 20 tooth*2 mm pitch, so move the mechanism 40 mm/rev. I want to be able to drive the mechanism up to 200 mm/sec with the servos, so 5 revs/sec = 300 rpm. The Duet can deliver 120,000 steps/sec. 120,000 step/sec / 5 rev/sec = 24,000 steps/rev. So jumpering the motors for anything less than 24000 steps/rev will allow the print speed over 200 mm/sec. 

I jumpered the motors for 20,000 steps/rev. which should give a top speed of 120,000 step/sec / 20,000 step/rev = 6 revs/sec. 6 revs/sec * 40 mm/rev = 240 mm/sec. 


Configuring the Duet Controller


20,000 steps/rev / 40 mm/rev = 500 steps/mm, which is more than an order of magnitude beyond the resolution needed in a 3D printer.

I set the Duet to drive X and Y with full steps, set steps/mm to 500, and left acceleration and speed settings as they were with the steppers. I also set the timing parameters to drive the servos as I did in the sand table.


M584 X5 Y6  ; remaps the X and Y motor drives to the Duet expansion board
M569 P5 S1 R1 T4.0:5.0:6.0:11.0 ; sets the timing parameters for the X motor servo drive signals
M569 P6 S1 R1 T4.0:5.0:6.0:11.0 ; sets the timing parameters for the Y motor servo drive signals
M92: X500 Y500 ; sets steps/mm for motors using 20 tooth drive pulley and 20,000 steps/rev
M350 X1 Y1 ; sets Duet to output full steps (microstepping is handled by the servomotor drivers)
M201 X10000 Y10000 ; set maximum acceleration limits for each axis
M204 P2000 T2000 ; set print and travel move acceleration
M566 X20 Y20 ; set maximum jerk speed for each axis
M203 X240 Y240 ; set maximum speeds for each axis

Configuring the Servomotor Drivers


Maximizing positional accuracy using the servomotors requires tuning the driver parameters for that purpose. I dug into some information on tuning servo motors and poured over the manual for the motors to glean what I could about the available parameters and their effects on positional accuracy.  

The first step in the process was to get my computer to talk to the motors. The motors need RS-232, not serial TTL, so look for a USB to RS-232 adapter based on a PL2303 chipset. It will provide real RS-232 voltage swings between +3.3V and -3.3V.  I ordered one of these.  This adapter has a male DB9 connector which is fine for some uses, but the motors have spring terminal connections, so I cut up an old serial cable that had a DB9 female connector at one end. I cut the male connector off the other end and stripped the Tx, Rx, and Gnd wires and connected them to the motor.


USB to RS-232 converter using PL2303 chip. I connected an old serial cable to the DB9 connector and used only the Tx, Rx, and ground wires to connect to the motors.

The manual says the default modbus speed of the motors is 9600 bps, but the RS-232 speed default is 57,600 bps, even parity, 1 stop bit. I'm not entirely sure what a modbus is in the context of these motors, but it doesn't matter- RS-232 is what you use to configure the drivers.

RS232 port settings in motor driver
I was able to read all the factory setting for the parameters which I immediately saved to a file in case I did something wrong later and needed to get back to the defaults.

The next page of the manual has the settings for autotuning the motor:

Autotune parameters


I ultimately used the built-in autotune function to tune the parameters automatically, while the motors were driving the printer mechanism. 

First Test Results


I knew before testing that the servos can run at much higher acceleration and jerk than the steppers, but I also knew that high acceleration and jerk lead to noisy operation as the mechanism will make a banging noise (and shake the printer) each time the movement direction changes. My first comparative tests kept the acceleration, jerk, and speed at the nominal stepper settings so I could compare noise levels and print quality.

Before I installed the servomotors, I ran a test print using the nominal settings I normally use in the printer. Specifically, acceleration 3k, jerk 20, and print speed 50 mm/sec.
 
After the servos were installed and the Duet was configured, I ran the same test print STL file at the same acceleration, jerk, and speed settings I had used for the test print with the steppers. Here are some photos and video of the two prints. I haven't done anything to alter the volume in the videos- what you hear is what I got.

First layer of print with servomotor.  It does not look promising!


first print with the servomotors
First attempt to print with the servomotors. Poor quality with 'salmon skin" effect at all 45 degree corners of the print.

test print with the stepper motors
Test print made with the stepper motors. Some ringing due to the relatively high acceleration (3k), but otherwise good quality.


Servo print.

Stepper print.



Servo print.

Stepper print.