# So Who Is A Computer Programmer?  I Got A Thought.



## Keith Foor (Apr 8, 2016)

I had a thought for those that are trying to put a CNC project together and having problems with the idea of buying ball screws for their mill / lathe and fitting them to the machine.  If a CNC program was created that took the output of some of the less expensive DRO scales that are being used with a tablet or other device and actually looked at the table position for making a cut, the backlash of the standard screws wouldn't be relevant.  It would simply go to a position on the DRO scale and be in the correct position as long as the scale was accurate.  By this I mean if the X axis was to make a cut of 1 inch from left to right then back up .5 inches and then the Y axis was to cut in some distance.  the backlash on the machine lets say is .1 (alot but easy math).  The machine will return to .6 and not .5 due to the take up of the back lash.  If the DRO was referenced then the table would return to .5 because your not counting turns on a stepper motor, you are actually referenceing table location. 

I think this would get alot of people past the hump of converting machines due to the cost and complexity of ball screws and a machine tear down and retrofit of the ball screws.
I realize that there are specific kits for Bridgeport mills that the screws are a straight forward direct drop in, but something like an Excello 604 (what I have) is not gonna have a direct fit, no modification needed ball screw kit to convert it.  
I know there is Moglice (or something like that) to use to drill out the threads on the nuts and rebuild the nuts on the machine but that frankly is scarier than the ball screw retrofit as drilling and ruining nuts that can't be simply replaced off eBay for a few bucks.

Don't know if there is a programmer out there that would want to take this on, but if so, there's your concept for it.  If you choose to take it on I claim no patent on the idea, but would ask for a copy for personal use.


----------



## JimDawson (Apr 8, 2016)

You are correct Keith.  The backlash is self correcting to a point when the scales are on the load (table), it just depends on how fast the servo loop updates and how sensitive the amps are as to what the accuracy is if there is backlash in the system.  That is exactly the way I set up my mill, my router, and Alloys mill.  In those cases using 1 micron magnetic scales rather than glass scales, but standard DRO 1 or 5 micron glass scales would work fine and do exactly the same job as the magnetic scales.

Most glass DRO scales output a standard 2 or 4 channel quadrature signal that a motion controller can read.
.
.


----------



## Steve Shannon (Apr 8, 2016)

In answer to to question posed in the subject line, I used to be, using primarily C to program realtime systems and editors for realtime systems. Then I programmed mapping systems (GIS). Then I went back to programming a realtime special protection system for a 500kv electric transmission network. 
Using DROs for feedback in positioning an end mill makes perfect sense when you can wait until you're at the correct location before engaging the cutter, such as positioning holes, but if you need to precisely follow a path while the cutter is cutting, such as cutting a circle, having backlash introduces mechanical hysteresis which makes it impossible to follow the path with precision. 


 Steve Shannon


----------



## JPigg55 (Apr 8, 2016)

I'm no programmer, but have had a little introduction lately while attempting to hack my iGaging Absolute DRO scales for use with the Touch DRO App.
I'd asked a similar question to a friend who's helping me do this and is a programmer.
My idea was to use a record function to record stepper/servo info like revolutions/steps, direction along with position feedback and use that info to reproduce manually inputted commands.
I won't say it isn't possible, but there are many issues to overcome.
First, electronic components like this use clock cycles and refresh rates. My scales, for instance, has a 2.5 khz clock cycle which is fast enough, but only a 10 hz refresh rate meaning the position only update 10 times per second. May seem fast to you and me, but would be slow to electronics if your trying to hold to a couple thou.
Second, unless you're willing/able to write a program to your specific set-up, trying to write a program that would work with all the different scales, drives, and motors would be a daunting task to say the least.

I'd still like to try my idea someday for simple projects not requiring close accuracy. It would be a lot cheaper  and easier than going full on CNC for reproducing simple items.
This will only work for simple, single axis commands unlike CNC which provides multi-axis control for complex designs.
In my concept, scale position input would only be used for error detection and could probably be ignored all together.


----------



## JimDawson (Apr 8, 2016)

JPigg55 said:


> Second, unless you're willing/able to write a program to your specific set-up, trying to write a program that would work with all the different scales, drives, and motors would be a daunting task to say the least.




I would say this this is more a function of the hardware rather than the software.  If you have the hardware (motion controller) to connect to the field devices (motors, drives, encoders) and the field devices are up to the task, the software is pretty easy.  This is off-the-shelf equipment.

Edit:  In this case encoders include both rotary, linear, and any other types that could be hung on a system.  From the controller perspective it makes no difference.


----------



## Steve Shannon (Apr 8, 2016)

Steve Shannon said:


> In answer to to question posed in the subject line, I used to be, using primarily C to program realtime systems and editors for realtime systems. Then I programmed mapping systems (GIS). Then I went back to programming a realtime special protection system for a 500kv electric transmission network.
> Using DROs for feedback in positioning an end mill makes perfect sense when you can wait until you're at the correct location before engaging the cutter, such as positioning holes, but if you need to precisely follow a path while the cutter is cutting, such as cutting a circle, having backlash introduces mechanical hysteresis which makes it impossible to follow the path with precision.
> 
> 
> Steve Shannon


After thinking about this I'm pretty sure you didn't mean the kind of programming experience that I have, but rather about CNC programming, of which I have virtually none. I shouldn't have said it would be impossible to follow a path; I'm probably wrong. I can see how it might be possible to have CNC controller firmware wait for backlash to be taken up in order to compensate, then, when the sensors detect movement to resume movement along that axis. I really look forward to learning about such things from people like Jim Dawson.


----------



## wrmiller (Apr 8, 2016)

I've designed similar systems and one (of many) of the critical requirements is sampling rate from your position monitoring device. A cheap dro or digital caliper scale won't have the necessary frequency of updates (sampling rate) necessary to monitor real-time positioning with any useful accuracy. The laser interferometers I used updated thousands of times a second, which was necessary to calculate ramp up/down profiles and at-speed positional monitoring in real-time.


----------



## JimDawson (Apr 8, 2016)

Steve, there are many books written on this subject.  It's really a matter of understanding the general theory of closed loop systems of which CNC machines are a subset.  I'm sure you have a lot of experience with this in your power grid programming.


----------



## Keith Foor (Apr 8, 2016)

Steve Shannon said:


> In answer to to question posed in the subject line, I used to be, using primarily C to program realtime systems and editors for realtime systems. Then I programmed mapping systems (GIS). Then I went back to programming a realtime special protection system for a 500kv electric transmission network.
> Using DROs for feedback in positioning an end mill makes perfect sense when you can wait until you're at the correct location before engaging the cutter, such as positioning holes, but if you need to precisely follow a path while the cutter is cutting, such as cutting a circle, having backlash introduces mechanical hysteresis which makes it impossible to follow the path with precision.
> 
> 
> Steve Shannon



You bring up a good point that I had not considered.  I was looking at it in a 2 dimensional way and not taking into consideration that a circle or other curve would require the screws to reverse at some point.  Well that shoots that squarely in the foot.  But I at least have an answer.

Looks like I may be looking for a bridgeport at some point to convert, or just bite the bullet and find a used CNC mill of some sort. 
I can't bring myself to CNC my Excello 604.  Odly because it's such a good manual mill and is in terffic shape for the fact I only paid $1200 for it.  
I actually believe the size of it scared folks away from it.  I see Bridgeports selling in this area for twice that, and actually selling.


----------



## Steve Shannon (Apr 8, 2016)

JimDawson said:


> Steve, there are many books written on this subject.  It's really a matter of understanding the general theory of closed loop systems of which CNC machines are a subset.  I'm sure you have a lot of experience with this in your power grid programming.


Yeah, everything was closed feedback with lots of PIDs. My lack of experience is with the CNC controllers, their features, and their algorithms. I intend to fix that. 
Thanks!


----------



## strantor (Apr 8, 2016)

I've been having synapse firings along these lines for a long time now. "Poor man's DRO." If you havent seen it already, there's a method to pull the position data out of the calibration port on even the cheapest (think harbor freight) of digital calipers. 

http://m.instructables.com/id/Reading-Digital-Callipers-with-an-Arduino-USB/

There are more elegant poor man solutions like machine mountable "DRO scales" (calipers with the teeth cut off) for sale on cdcotools.com. 

But I think we can do better than all that, and cheaper.

Check out the LDC1000 from Texas Instruments. It's a 24bit Inductance to digital converter. It can measure position change via a change in inductance. That means a spring can now be a position sensor. Think about that; no fragile Glass scales, impervious to dirt (not necessarily metallic debris, kind of a gotcha but not insurmountable ), not affected by temperature,  lots of "pros" most importantly "cheap" - if you can't afford a spring just rob one off your screen door.

I've purchased the LDC1000 development kit and screwed around with it. Pretty awesome, but I noticed it's pretty sensitive to external reluctance (if you grab the spring, or just act like you're about to grab it, the position reference changes). But I think this can be cured with external metallic shielding (put it inside a pipe). I'll try that when I get a chance and let you all know how it goes.

Failing that, I think something as simple as a length of nichrome wire could potentially be a reliable position sensor. Think about a potentiometer, open it up, stretch it out the length if your lathe bed (or mill table) and attach the wiper to your carriage. The main problem with nichrome is the temperature coefficient. Differences in temperature from one end of the wire to the other can skew the reading. But take 2 pieces in parallel and apply opposite polarity to each, sum the outputs, and I think that should cancel out the nonlinearity. Or use AC excitation. By my math, on my lathe with 36" of carriage travel, I could get position resolution of .0005" with a run-of-the-mill mill 16 bit ADC. For a few bucks more, a 20 bit ADC gets me down to .00003". Only problem is keeping it clean. It would have to be shielded from debris which might be problematic. 

I'm going stop talking and start testing any year now, stay tuned.


----------



## chevydyl (Apr 14, 2016)

It's a good idea but what about interpolation? That's where your gonna have an issue making radii that are I think tangent to one another, like Jim said the rate at which it can compensate for the backlash, how long does the other axis have to wait for it to comp so they can move together again, and will you see that step? most likely, but it could be very minute


----------



## Firebrick43 (Apr 16, 2016)

The issue of back lash is not programming.(drive/control programming)

  Large machines use scales (similar to what your thinking) and encoders.  But it's not for backlash. It for thermal compensation (growth,movement of ball screws and ways as they heat up and cool).  Some really large machines can be laser measured in a grid pattern and the coordinates loaded in the controller so even if the machine is not perfectly in alignment the tool path (as controlled) will be.  So the basis of you idea is out there, just not for the problem your trying to solve. 

The problem with back lash is going from plain milling to climb milling.  Doing complex curves, pockets, or radius past 90 degrees is going to result in a reversal of directions.  When back lash rears it's head in the middle of a cut the tool get broken, parts scrapped, and even machines destroyed. 

Even the best of servos and drives can not react to the sudden and violent forces when thrust reverses and backlash is present. 

While technically possible to program a machine to put up with backlash, it unnecessarily complicates the cnc program, and takes away many of the possibilities of cnc.   You would be better suited just to put power feeds on a manual mill.


----------

