Wednesday, February 8, 2017

Tweaking And Verifying the Mill

As said last week when I said the main construction phase on my CNC mill was complete, it was time to move from construction to optimizing, and that's what I've spent the last several days doing.

The first thing to go after was backlash.  I duplicated the measurements and started with backlash of .012 on X, .010 on Y and .004 on Z.  Going after the big one is the obvious way to do this, but there's another reason that's more practical: the X-axis has an exposed end that I can put a hand wheel on to crank.  That allows me to easily feel the movement of the wheel before the table moves and it allows me to hold the ballscrew motionless while tightening some nuts against the AC bearings.  The problem I had was that I didn't have anything that fit the shaft.  The shaft is 5/16" and I had a 1/4" handwheel from my micro mill.  I was going to make an adapter that fit over the 5/16" shaft and inside the 1/4", but realized there was an easier way.  I had the original handwheels from the mill and just needed to make a collar to take up the gap between the 5/16 shaft (.313) and the handwheel (.393).  The shaft has a flat, so I drilled and tapped it for a setscrew and put the handle on it.
This large handwheel (about 4" diameter) allowed me to get a good measurement of the backlash.  I took photographs of the wheel before starting to crank back in the direction it came from and then as soon as I saw some motion on the dial indicator.  I tried to maintain the same camera position, getting two very similar pictures, then imported them into Rhino3D.  Drew lines on the wheels and then measured the angle between the lines.  Worked out to be 13 degrees.  To how much precision?  No idea. There's clearly parallax in the picture so the camera wasn't positioned exactly the same.  
So what does that mean?  13 degrees is 13/360 of a circle or .03611.  If my program is counting the number of steps its going to apply (which is what they do) those steps are not going to move the system and I'll lose 0.3611 turn times 0.197 inch/turn or 0071 inch.

Despite my misgivings at having to take everything apart, I tore down the X axis and spent an hour or so trying to get it so that there was no wasted motion.  I cut my backlash down to .006" on X.

I repeated this as much as I could on Y, but while there's no place to put that handwheel, I could turn the stepper motor with the 1/4" shaft coming out the back of the motor.  This one moved less, and I could adjust Y down to .006 as well.  Strange how they match.

I didn't do anything to Z.  I think I can live with .004. 

Now I have to confess that I don't really know why zero backlash is pursued so exhaustively while other sources of errors are seemingly ignored.  I'd like it to be a better, but I don't really know what to fix now, and all the CNC controller software includes backlash compensation.  If I spent another week and reduced it to .002, would that really make a difference?  It all depends on what I'm going to be doing, of course, and I can't answer that exactly.  

For casual readers, backlash is lost motion in your system.  Many of us have tuned the knob in a radio and noticed the knob slipped backwards when we let go of it.  That's a form of backlash.  When you're running a machine manually, you can watch the dial or Digital Readouts (DROs) or even feel that it's not cutting until you crank out the backlash. Say you have the .006 backlash I have; you watch the DRO and when the machine starts moving, you can see the position changing.  When I encountered my first CNC backlash problem I was trying to engrave text on a cylinder and the machine had to go back and forth along the X axis hundreds of times.  If I recall correctly, I was going to engrave every degree around a cylinder, 360 passes (might have been more).  The effect of losing a few thousandths every cut over 360 passes was for the text to spiral along the long axis of the piece. (360* .006 is 2.16"!)  Once I put backlash compensation in place, it was fine.  I first got the CNC Sherline going because I wanted to carve waxes for lost wax casting.  I carved at least a dozen waxes to make rings out of (not that I ever cast one) with backlash compensation on the Sherline and they always looked fine. 

So for this sort of work, backlash was never a problem as long as I used the backlash compensation in the software.  On the other hand, I've heard from guys who are "real machinists" who say that if the backlash on their system gets about .0005", they can see the surface finish get worse.  I was not super critical of surface finish on the waxes I was carving because that step gets followed by more work that changes the surface anyway. 

After fighting the backlash, I started going after something that was more of a puzzle than anything.  During the setup of the LinuxCNC system, I had to tell the program some parameters of my system so that it can calculate how many steps it needs to go a required distance.  This could really get down in the weeds, so let me try to give the short version.  It asked for the number of turns per inch on the ballscrews, and a quick inspection said it was around 5 turns per inch (TPI).  Once it was running, when I commanded the system to go an inch, it went much, much farther.  I could scale that number back to make the distance what I commanded, but now the number for TPI was about 1/4 of 5!  In fact, it's 1/4 of the metric pitch, 1.27 TPI.  It turns out there's a property of the motor drivers that can make a screw act that way.  The motor drivers, all four of them, act like they're stuck set to one mode and the switch that's supposed to change it has no effect.

I've been trying to troubleshoot this for a few days, now, and I'm currently waiting to hear back from the hardware supplier I used, Automation Technologies.  This doesn't keep me from doing anything in particular, and it's not a big problem, but it's one of those things that just doesn't work like I think it should.

Finally, I commented in that piece last week that I didn't think I was getting the same rapid movements that Hoss gets on his DVD.  As part of troubleshooting that last problem, I resurrected one of my old Mach3 computers today and got it to run the Griz.  There's no problem with rapid movements.  I can move all three axes reliably at 260 inches per minute.  In most of what I've done on my Sherline, the Z-axis is the holdup because it can only go 15 IPM.  X and Y can go 40 ipm.  Being able to move everything at 260 IPM brings a massive improvement over that system. 


  1. My knowledge of CNC is zip-
    On a manual machine, always starting the cut with the backlash taken up is standard practice. IE, never back off and take a cut, always back off past the point you want to be then advance to the cut point. That takes up the backlash. Probably gets a lot worse if the ways are not fitting well. I was just reading pages of posts on the problems people were having parting off on less rigid lathes.

    1. On a manual machine, always starting the cut with the backlash taken up is standard practice. IE, never back off and take a cut, always back off past the point you want to be then advance to the cut point. That takes up the backlash.

      Exactly. There's no reason that couldn't be done in software. Backlash only applies at the start of a cut when changing direction. The holding torque of a stepper (the maximum torque is at lowest speed) will keep a motor from slipping backwards when you stop a cut, so no worries there. For example, say the machine is cutting a pocket. It can't go past the end of the cut because of the wall, but it can "know" that before it makes progress, it has to take out the backlash. It figures out how many steps it has to make before a movement really starts, and makes that number before it starts moving. If it needs to make 2000 steps to complete its cut and 12 steps to take out the backlash, it just makes 2012 steps. (totally PFA numbers)

  2. As Raven said, about backing past the setting on the dial and then advancing, and my father talked about ending the lathe work with a spring (springing?) cut.

    The troubleshoot between mechanical and software usually involves two separate groups of individuals pointing at each other and sometimes there are loud voices involved.
    At least you can have a quiet adult discussion with yourself!

    I will modify Raven's comment to say that by following your blog my theoretical knowledge of CNC has increased a lot.

  3. "Springing cut"- what is that?
    There is a lathe tool holder that is designed to flex, to reduce chatter IIRC. Very strange indeed.
    Here is a you tube link talking about the tool holder.

    1. Even if the gibbs are set right and you have taken out the backlash, the toolholder tends to flex or spring away from the work. My father, (the real machinist) said you stop just shy of the OD you want and then take another cut at the same setting. You will remove some metal.
      Two forums have better answers to the question than I can give.

      I watched the YouTube video and I still have that puzzled look on my face.

    2. I always heard it called a spring cut, but whatevs. Metal is elastic, and the pressure of the tool making the cut compresses it at the cutting edge, so that material springs back to its normal size after you shave back some of it. If you leave your lathe locked down and move the tool back and forth, you get some very fine chips. Chances are your work piece has gotten larger due to the heat of cutting, unless you're flood cooling it, and that's part of the spring cut.

      One of my early lathe experiments was to cut something to be press fit. Don't even remember what the fit was, but the piece needed to be about 1.245 diameter. It measured perfectly. Came back 10 minutes later and it had shrunk while cooling. It wasn't a press fit anymore.

  4. Yes,
    we read about people talking about how they can "hold a tenth"-
    BS unless they have a very good lathe, tool, temperature controlled environment etc. Very similar to AGW sycophants-we can't even measure the raw data to the level they claim authority over.

  5. backlash compensation and minimal backlash are critical for circular interpolation. For anything else, you can get good results simply by unidirectional positioning.

    1. If you should come back, I wonder if you could try to explain that. It seems to me circles should be just about as easy anything can get. Backlash only gets cranked out at the start of a move when the axis changes direction, and no matter where I start on a circle, neither axis changes direction more than twice. It's not like I'm changing direction a bunch of times and I get a cumulative error.

    2. Indeed. How many ties when cutting a circlr does a ballscrew change direction? Four. Two in x and two in y. Evh time direction changes, theres a bobble. You get lobed circles

    3. This is the type of deviation you get during circular interpolation (The scale is exxagerated to show the lash)

    4. Man, I have straight up lost my ability to type today.

    5. Thanks for that. I've puzzled over this a lot and simply don't see why a system can't overcome this with the right software and hardware.

      A problem I see with my system is that the ballscrews go essentially one mil per step. Ignoring microstepping. Microstepping may reduced that to 1/8 mil, but nobody guarantees the size/uniformity of those steps. It smooths motion rather than increases resolution. In fact, the stepper motor makers guarantee those 200 steps will be within 3-5% of the same size. If there's 1-3/8 mils of backlash, the system can deliver "one-ish or two-ish" but not 1-3/8. The way to improve that is to go to screws that have more TPI, so that one step doesn't go as far. My guess is that will slow down machining or make motors run too fast for another parameter.

      This could get long enough to be a white paper, but there's probably already 20 out there that say the same basic thing!

    6. Sorry to be gone so long, the new gig takes a load of my time. Yes, software will fix it, if as you say you have the correct resolution. AC servomotors (And some DC) have either encoders or resolvers that have upwards of 2000 counts per revolution; some of them more than 100,000. So yes, it is possible to use software to take that out, but it is never the preferred method, it is the very definition of "Kluge" to make software compensate for inaccuracy in the machine.Properly constructed, a ballscrew has almost no backlash of it's own- on an industrial machine tool it can be measured in millionths of an inch. Then the ballscrews are stretched and preloaded between two bearings, and the ballnut (Which is factory preloaded) is locked in place. In circular interpolation, if yoiu have a lobe, you cannot simply add the backlash of the screw, you'd just get an inverse lobe. You have to add in the backlash slowly, and it has to be added to the circle so it stops being added when it gets to the point where it changes direction again. And it is not a linear scale, of course. And while you're doing that you have to do the same thing with the other axis. This is why it is important to get it as close as possible mechanically, so there is very little compensation for the software to do.

  6. You may be overlooking another factor that will influence accuracy on your system. You are using just the motor's movement for tracking location. This has no way to see movement in those ballscrews. Depending on various factors, cutting bits can impart torque into the stages, and may be able to push into the slop they have. This can happen on either or both stages at seemingly random moments. Not reading actual stage locations may leave you with a system that can't hold tolerances as tightly as you would wish.

    1. I've made the argument elsewhere that we measure backlash with just a dial indicator on the table, and nothing moving. We read the indicator at both ends of a convenient move. During use, we get additional errors from the cutter deflecting if we feed too hard for the amount of cutter extended, we get turn to turn inaccuracies (ballscrew drunkenness) in the position and we can get deformation of both the balls and the ballscrews under load. Some of these things are resolved by going to higher grade (read more expen$ive) ballscrews and some by being smarter about feeds and speeds.

      It may not be clear from this post or its followup that I only use the motor for convenience and its removed when I'm measuring during testing. Of course, the motor has to be in place when the results are for real. The system runs with the motors in place, after all.