CNC Automation

Discussion in 'General Electronics Chat' started by cmartinez, Jun 11, 2017.

  1. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    Well.. I've done several automated measuring machines, the last one was a $200K project. Right now I'm finishing a $120k CNC dual-head drilling machine that's destined to an automotive harness assembly facility in south america that has a work area of 4' x 25'. The machine is 33 feet long and 5-1/2 foot wide. I designed every single part of it, except for the servos and spindles of course... and several linear motion components. I also designed and programmed its motion control circuitry and software.
     
    Last edited: Jun 11, 2017
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    6,644
    2,928

    Sounds like a really cool job. You are doing the exact work I always wanted to do.

    Sounds lucrative. If not too personal, wow many hours did you put into the $200K project? How do you get business? Do you bid or is it just word of mouth?

    I once wrote all of the software for a PC based environmental control system. We replaced a huge PDP 11/34 with a tiny PC with far more computing power. I was able to keep all of the existing field hardware which was an enormous part of the cost for total replacement. Not to mention the customers were only down for minutes while we unplugged the old system and plugged in the new PC. I guess the reason I never continued on in that area was the enormous competition in the field at the time. I only had 2 or 3 systems to retrofit. After that I would need to supply my own hardware and that is where the competition came in.
     
    Sinus23 likes this.
  3. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
    What type of motion control circuitry/software?
    All custom or based on what platform?
    Max.
     
  4. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    Hello Max, I just knew that my post would draw your attention. :)

    The system is completely designed and made by me, and it's based on the single-cycle AT89LP MCU family.

    Its working principle is easy to describe:
    • It's designed for closed-loop step motors, but it can also control servos in step-mode control.
    • First, there is a master MCU in charge of controlling and counting a pulse train according to a desired motion profile.
    • This master MCU is connected in parallel through 11 I/Os to another MCU in charge of generating a frequency proportional to the binary number represented by those 11 bits. That is, it's capable of generating 2,048 different speeds, including zero Hz. (In an older design, the master MCU was also in charge of generating said frequency, but its programming was so complex that it couldn't generate speeds higher than 16 kHz or lower than 200 Hz. It also had a speed range of only 6 bits, or 64 different speeds, including zero Hz)
    • The master MCU requests a frequency from the FG (frequency generator MCU) in accordance to the desired maximum speed and acceleration/deceleration parameters. These parameters are described by three bytes, and those in turn are received through a USB-UART converter from an ordinary control computer. They're usually set just once during normal operation.
    • Then there is an extra MCU for each axis that you want to control. Each axis reads the pulses generated by the FG and linearly interpolates them to the desired distance using Bresenham's algorithm.
    • Also, the master MCU has an extra input for an emergency stop button, and each axis' MCU has two inputs for limit switches. Three bytes per axis is all that's needed to describe any motion command that you want to generate, so sending motion commands from the computer to the controller is extremely fast.
    • All in all, the basic price for building said system is about $4.00 dlls for both the master and FG MCU's, plus about two bucks for each axis that I want to control. Of course, you need to add the cost for the PCB and some connectors. But building a five-axis controller this way costs a little under $25 dlls... not too shabby, eh? :D

    I designed this system about ten years ago, and I'm quite pleased with it because it allows me to control any number of motion axis that I want. Its only limitation at this point is that it can only perform discrete linear motion and it's not yet capable of producing continuous complex routing patterns... but I'm working on that feature too :cool:... even as we speak... ;)
     
    Last edited: Jun 12, 2017
    Sinus23, #12, strantor and 1 other person like this.
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
    Excellent!
    What kind of HMI or MMI are you using, if any?
    Max.
     
  6. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    I've done all of the motion flow control programming in .NET. But all of the motion code is generated within AutoCAD through LISP. I also wrote all of those routines myself quite a few years ago.

    My code is not only capable of generating instructions for standard three-axis CNC machinery, but it's able to produce quaternion programs for robotic arms as well.
     
    #12 likes this.
  7. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
    I meant HMI, Human Machine Interface or system display/keypad/buttons etc, PC or other?
    Is that 3 axis point-to-point or interpolation mode?
    Max.
     
  8. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    Yeah, I know what you meant... But it seems I wasn't clear enough. I meant to say that the interface is completely programmed in .NET. So a PC is needed to control the system. But any modern ordinary low-budget PC is by far more than enough for this task. Even the smallest laptop meets the requirements. And besides, practically all machines use a PC nowadays for production networking and data logging purposes.

    I'm not sure what you mean with your second question.... any number of axes can be controlled in a single motion command, all moving simultaneously and in sync. For instance, the system is capable of tracing a perfectly three-dimensional straight line if desired.
     
    #12 likes this.
  9. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
    I should have said Circular Interpolation, rather than simple point to point, but if you say straight line, then I would think that includes circular also?.
    BTW my favorite for DIY motion control has always been the Galil Motion cards, beautiful results, including electronic gearing if needed.
    Max.
     
    #12 and cmartinez like this.
  10. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    Yes, it can also perform circular interpolation. But in my experience, most curves can be broken into segments whose angle does not make for a cathetus larger than 0.005" ... That works pretty well for sheet metal works and signage applications.

    That's why continuous routing capabilities is the holy grail of my research...
     
  11. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
    I have used Autocad almost since it's (DOS) inception, how do you translate it directly to motion code? Similar to a plotter driver output?
    I have never used step/dir, all analogue ±10vdc

    Max.
     
  12. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    AutoCAD works through a geometric elements database, with each element classified by type (circle, line, point, etc), layer, color, linetype etc. LISP allows you to consult this database and add or modify elements to it. But it also allows you to add specific custom characteristics to those elements. So what my software does is it adds a "sequence number" characteristic to the elements that you wish to turn into code, and sorts them in the order that you wish to perform the translation. The rest is pretty straightforward. It interprets a line as a point to point motion command, and it breaks any curve (even splines) into small segments that are later translated into an interpolated continuous motion profile. I added several other commands to my software (and a few dialog boxes) to help the user edit and manipulate those sequences in a faster and clearer way.

    In the end, a simple command called "code" generates an ASCII file containing the G code translated from those geometric entities. I wrote that software about 25 years ago, when CNC routers and plasma machines were beginning to flood the market. Back in those days the company that would sell you the machine would also sell you the code generating software, which most of the time was clumsy and had a terrible graphical interface... and it was also extremely expensive. I sold many licences of my software during those years and many people were very pleased with it, since they found it was a huge advantage to be able to run it transparently inside AutoCAD...

    Today practically all 2 and 2-1/2 axis CNC machines are sold with the necessary software (which most of the time is not half-bad) included for free... so nobody buys my software anymore... But it's ok because I constantly take advantage of my own code by integrating the old routines into new projects when necessary.
     
    Last edited: Jun 12, 2017
    strantor and MaxHeadRoom like this.
  13. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
    Actually the big boys do it that way also, also including the Galil Motion method.;)
    Max.
     
    cmartinez likes this.
  14. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,985
    2,971
    No, say it isn't so! My perceptions are dashed.
    I thought that the whole reason why "real" operations use software like CAD and solidworks are because the geometries are described mathematically.
    In other words, they don't use a software like Sketchup because a circle in sketchup is actually 12-sided polygon (# of sides is adjustable), and a circle in CAD is described as a center point and a radius.
    So would/could sketchup be just as "good" as CAD if you adjusted the circle to be (ex) a 360-sided polygon, since that's what the CNC machine is going to turn it into anyway?

    Or am I completely misunderstanding here?
     
  15. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    There's a misunderstanding alright. CAD software definitely uses analytical geometry to define all objects. It's when CNC code is generated that this geometry is broken down into discrete segments to simplify motion programming.
     
    Last edited: Jun 13, 2017
    MaxHeadRoom likes this.
  16. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
    What he said.
    Max.
     
  17. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    Thanks for the editing... :D
     
  18. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
    Another break through was look-ahead machining.
    In the development of NC, a buffer was added to allow the control to read a block of data before it was ready to be executed, speeding up the operation.
    This buffer gives a sort of "look-ahead" to anticipate the next move and minimize dwell time before the execution of each move.
    Max.
     
    cmartinez likes this.
  19. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    5,346
    6,262
    Actually, the look ahead buffer is there to anticipate a "feed-hold" command from the user. That is, to let the user stop machining operation (as opposed to normal point to point displacement) in a controlled way.
     
  20. MaxHeadRoom

    Expert

    Jul 18, 2013
    15,654
    4,559
Loading...