Thread: Mill with digital scales
I had a notion that if I fitted cheap Chinese digital-scales to my mill I could stop worrying about backlash, stalled steppers, losing my zero etc. I could fit an automatic tool height detector and that positioning pendant I have always wanted, maybe leave it open ended so I could add other input devices I haven't thought of yet.
I now have a little computer board which the PC can talk to. It reads 3 digital scales, drives 3 stepper motors, has a serial port to talk to the digi phase converter. Also SSR relay outputs to switch the suds and the main motor, plus 3 auxilliary ports for plugging in additional doo-dads.
I've got the scales reading, haven't done their end sensors yet but that should be easy. Now working on the stepper control algorythm which sits on a timer interrupt...
Anyone still with me? Or am I the only one who does this kind of stuff? :D
Current plan is that each axis has two main variables, 'Where we are' WWA and 'Where we want to be' WTB. When the timer interrupt fires it does one axis out of 3. It compares WWA to WTB and if necessary steps in the appropriate direction.
May seems complicated for a stepper algorythm, until you remember that WWA can change at any moment should the digital scale for that axis chime in with a new absolute position. I have the scales hard wired for speed, a complete 24 bit location received interrupts the CPU and gets read as 3 pre-digested bytes.
On the last axis interrupt it does a more exhaustive test for position. If any axis is outside tolerance I don't update WTB for the next position so it does remedial steps until tolerance is satisfied. I think I have to allow a tolerance or it will get stuck. The screw resolution is .005 mm/step. The scale resolution is .00496mm, close enough that I can let the motors get a bit ahead of the scales. The scales report about 50 times a second, I usually do 300 steps/second so there has to be some leeway. If I can cut the tolerance to 3-4 steps I will be well within 1 thou accuracy.
Quite enough for now. Did anyone read this far?
On your algorithm, you need to think about acceleration and deceleration and predictive placement since what you are creating is a closed loop servo system with a lag. Given that your scales read slower than the step speed if you are not to end up with a completely overdamped and sluggish solution you need to be considering the rate of change of scale value ds/dt as well as the actual value s.
I like the idea of a automated 'go to location' but how will this integrate with EMC2 or Mach3 or are you planning to treat the stepper/scale combo as a big servo?
I've heard glowing reports of Mach3 but I do like to be in control so I avoid commercial software as much as possible. If you write your own you can add features and fix bugs. My next software will be version 3, so I have some experience to draw on. Has to run under Windows XP and cut from an AutoCad dxf file. I want vast amounts of memory and the thought of 32 bit integers has become almost irresistable. The GUI is good to :D
Going to stick with L297/L298 at 40v/2A for now as my steppers and 2mm ACME screws don't need any more, but have a 4-axis design on the drawing board using a PIC processor, 2109 hi/lo drivers and discrete MOSFETs for 80v, 5A/coil, 1/8 microstepping capability for the future.
Where do you source your electronic parts from? I use Radiospares, Farnell (rarely, since mostly seems to be US-stock now), Maplins (even less so), and Cricklewood Electronics all online - the days of the great electronics shops have long gone :(
I've done the read a dxf, pick out lines arcs and circles then stitch lines and arcs together into shapes (fudging the ends slightly so they meet up properly). Also the expand/contract it bit to get the tool path.
No G-Code planned, it goes straight to my box of tricks and turns the handles. I have a wicked arc drawing algorythm my brother wrote, any start point, any end point, either direction. I just call it and it gives the next pixcel on the arc. I tried it drawing circles on screen, then had to add a delay between pixcels so you could actually see where it started and which way it was going :D
My preferred small quantity supplier has to be Rapid Electronics.
40 volts is very close to smoke if you're using a transformer, suggest you do something clever in the PSU to protect it.
By njhussey in forum Tool & Tooling TechnologyReplies: 4Last Post: 04-12-2012, 07:07 PM
FOR SALE: DRO + 4 ScalesBy Rikk in forum Items For SaleReplies: 0Last Post: 22-10-2011, 08:41 AM
By Simon C in forum Motor Drivers & ControllersReplies: 5Last Post: 31-03-2011, 02:27 PM
FOR SALE: digital vernier.By i2i in forum Items For SaleReplies: 8Last Post: 13-08-2010, 10:31 AM
By irving2008 in forum Tool & Tooling TechnologyReplies: 26Last Post: 24-02-2010, 09:35 PM