587,714 active members*
4,593 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > PIC Programing / Design > PIC Embedded design Question
Page 1 of 2 12
Results 1 to 20 of 25
  1. #1
    Join Date
    Jun 2004
    Posts
    57

    PIC Embedded design Question

    My company has me building a 3 axis mill/router for repetitive tasks milling aluminum extrusions. There are basically six different programs this thing will run for the first year of it's life so instead of running it from a PC & parallel port I am building a stand alone controller based on a PIC 18F452. The PIC will provide step/dir signals to drive the three geckos.

    The reason I am doing it this way is because no one in our shop has ever used any type of CNC machine, so I want it to be simple "push button" operation. Also I want the machine to home before every operation and it's very simple to get the PIC to do this automatically, however with a PC the operator would have to tell it to home.

    My first question is; has anyone on this board done anything like this before? I've been making huge progress on the ASM code but I don't want to re-invent the wheel if I don't have to. I've been on luberth's site but his project seems to be based on a trickle link from a PC, and I'm pretty sure the PIC is the motor driver itself.

    Next I'm wondering if anyone has any insight as to which is the better method of Pulse Modulation. I could use software to pulse the step pins with calculated delays to determine the phase, or another method is to use timers and interrupts. But that leads to the possibility of interrupts "butting heads".

    My last question is regarding two axis circular interpolation. Has anyone done this to any level of accuracy using a PIC? My application shouldn't require very precise circular interpolation, and I'll probably just have the software break down any curves into small line segments, but I was just wondering if anyone has any experience in this area.

    Thanks for any insight you may have. I've asked a few of these questions on PIC boards but most of those people don't understand the importance of accurate step pulses in the CNC world.

  2. #2
    Join Date
    Dec 2003
    Posts
    24220
    Are you commited to PIC design? If you are open to different solutions with less leg work and need a system that runs dedicated programs and do not require graphical operator input etc, then one easy way is to look at something like this.
    http://cgi.ebay.com/ws/eBayISAPI.dll...sPageName=WDVW
    The programming is very easy and if the programs are not that large they could all reside in the controller, initial programing is with the free downloadable software and is done with a PC through the serial port.
    All the interpolation is done for you and it offers both stepper or servo output.
    Just an alternative suggestion.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  3. #3
    Join Date
    Jun 2004
    Posts
    57
    I knew there had to be something similar to what I want to build. Even at the E-bay price it's more that I was looking to spend, and there's just something that my employer doesn't like about purchasing equipment from ebay.

    Plus I've already got the PIC running a LCD with a menu interface, and it's reading the home switches and other inputs just fine.

    Thanks for the suggestion though, I'll keep it in mind for future projects.

  4. #4
    Join Date
    Jan 2005
    Posts
    1695
    I think it would be easier to use a timer interrupt to pace your stepping pulses. The PIC is not particularly fast when doing math calculations that you need for circular interpolation. Activities such as keyboard scanning and LCD driving don't need to be done in an interrupt.

    Remember that the geckos are microstepping controllers. If you have it set to 8 microsteps per step, with a 200 step motor going at 600rpm, you will need to generate stepping pulses at 16khz for each motor. Do a cycle measurement on the mplab simulator. I suspect that the PIC isn't nearly fast enough. You might want to take a look at the DSPIC.

    Why not just use a 100mhz PC? You can easily get them for $20.

  5. #5
    Join Date
    Aug 2004
    Posts
    2849
    Al, that's just the controller...how much more for the servo drivers?

  6. #6
    Join Date
    Dec 2003
    Posts
    24220
    Quote Originally Posted by ViperTX
    Al, that's just the controller...how much more for the servo drivers?
    What ever brand you want to use, step and direction or analogue.
    I presume in his case with a PC, he would have to buy them anyway, unless one goes with PIC drives also, If the Galil goes for around the present listing, thats less than 10c on the dollar.
    I have used this type of product for simple stand-alone systems as everything is in there for motion control as well as some I/O. The last one I did was a 30ft 3 axis line punch I used the communication program as a simple operator interface where he could home, jog and download hole punch dimensions for the whole part in one shot. All the drives were the existing DC SCR drives and motors.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  7. #7
    Join Date
    Apr 2004
    Posts
    678
    As this is for your company, have you figured out how many hours you will spend.
    - Making the hardware.
    - Making the software.
    - Debugging them both.
    Multiply with your hourly pay + social costs + company admin cost.
    Then add cost of junk parts while debugging.

    For a hobby project, it (usually) does not matter for a number of reasons. Different reasons for each of us.

  8. #8
    Join Date
    Dec 2003
    Posts
    24220
    Quote Originally Posted by ESjaavik
    As this is for your company, have you figured out how many hours you will spend.
    Yes, that was one of the reasons I mentioned this item, as if this is a commercial venture, I would expect a ROI to be very rapid if you could cut the development cost by getting a $3000.00 controller for $250.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  9. #9
    Join Date
    Jun 2004
    Posts
    57
    Thanks for all the advice.

    Like I said in my original post, no one in our shop has ever run a CNC machine, and many of the guys who will be operating it have never touched a computer. That's the reason I don't want to just set up an old PC to run this thing. It needs to be idiot proof or I will have a miserable next six months.

    I've been working with the PIC 18F452 which runs at 40 Mhz. Even with the timer dividing factor, the timers will operate at 10 Mhz. That should be more than fast enough to pulse the geckos, even at 1/8th microstepping. My leadscrews are 5 tpi ball screws so 600 rpm would be 3000 ipm, that's much faster than I'm going to be going.

    I have thrown out the idea of messing with circular interpolation, and have broken down any curves into simple line segments.

  10. #10
    Join Date
    Dec 2003
    Posts
    24220
    Quote Originally Posted by musicmkr
    Like I said in my original post, no one in our shop has ever run a CNC machine, and many of the guys who will be operating it have never touched a computer. That's the reason I don't want to just set up an old PC to run this thing.
    Just to clarify, a PC is not required to run the unit I mentioned, only to initially write the control program, after that it is stand alone and could be initiated by a simple push button.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  11. #11
    Join Date
    Apr 2004
    Posts
    90
    5 TPI @ 600 RPM = 120 inches per minute

    --Brian

  12. #12
    Join Date
    Jun 2004
    Posts
    57
    Quote Originally Posted by drawbar
    5 TPI @ 600 RPM = 120 inches per minute

    --Brian
    Oops! It's been a long day....

  13. #13
    Join Date
    Apr 2004
    Posts
    90
    No offense intended whatsoever! I'm just an equation freak. I also dabble with PIC's a bit. What do you program your 18F's with? I built my own parallel programmer board that works well with either Oshonsoft or IC-Prog. I've been playing around with 16F72's, spinning servo motors with it and Mach II.

    --Brian

  14. #14
    Join Date
    Jan 2005
    Posts
    1695
    Brian, can you provide more details about your servo circuit. Is it a PID controller? How well does it work?

  15. #15
    Join Date
    Apr 2004
    Posts
    90
    Sure! My servo board is super simple. I have one PIC 16F72 running at 20 MHz (crystal oscillator) driving a National LMD18200 H-bridge driver. PWM frequency is 19.531 kHz. Power supply is 24 VDC and the motors are used surplus Pittman motors I got from ebay (CHEAP!). 500 ppr encoders which go straight into two input pins. The program I am using currently is proportional only, which to my surprise at the time I wrote it tracked the command surprisingly well. I figured proportional-only would be lazy and wouldn't end up exactly at the right position all the time. Boy was I wrong! If the motor is sitting still, you can grab the shaft and make it give about a degree or two one way or the other because there's no integral to constantly correct small errors, but it always springs back right to the commanded position. And I can't make it break out into oscillation no matter what I do to it. I think I'm going to utilize it just the way it is!
    It's a step/direction controller so you can use it with Mach II, TurboCNC, etc. My biggest learning curve right now is learning where to put filter caps. Switching 24 volts on & off quickly makes lots of electrical noise everywhere!

    --Brian

  16. #16
    Join Date
    Jun 2004
    Posts
    57
    drawbar:

    Your servo project sounds interesting. Before I started on this stand alone controller I was working on a stepper driver using a 16F877. It's now one of my many projects on the "back burner".

    I use the USB programmer from electronickits_com . It took all of 45 minutes to assemble and I was off and running.

  17. #17
    Join Date
    Jan 2005
    Posts
    1695
    Brian: thanks for sharing the information. I'm planning to do a servo controller in the near future, so now I'm inspired!

  18. #18
    Join Date
    Mar 2005
    Posts
    523
    musicmakr
    well i think it is time your people had a little coarse on computers. (cnc computer .....)
    if you are going to slap a number machine infront of them.
    - how are they going to get instructions into the controllers.
    logo turtle graphix was used in the 70's to teach kids how to use these new inventions
    and draw lines on a black and white tv, like an etch-a-scetch.
    - todays grafixs and menu driven stuff is hundreds of times easier.
    like tool up tool down, tool forward 10, tool reverse 10.
    maybe just a menu driven interface with a touch screen, put a pc in a black box so they don't know what it is, just call it the brain.
    just a sugestion.

  19. #19
    Join Date
    Jul 2005
    Posts
    450
    i know this is not the option you wish to pursue, but for the time you spend designing this pic based controller, you could just get a cheap pc to use as an embedded controller. There is no need for users to be computer literate, as you could wire up some manual pushbuttons and an lcd, then solve the rest of the problem in software. The interface would be the same, and it will probably cost less, plus it would be a lot less effort.

  20. #20
    Join Date
    Jan 2005
    Posts
    364
    Quote Originally Posted by drawbar
    Sure! My servo board is super simple. I have one PIC 16F72 running at 20 MHz (crystal oscillator) driving a National LMD18200 H-bridge driver. PWM frequency is 19.531 kHz. Power supply is 24 VDC and the motors are used surplus Pittman motors I got from ebay (CHEAP!). 500 ppr encoders which go straight into two input pins. The program I am using currently is proportional only, which to my surprise at the time I wrote it tracked the command surprisingly well. I figured proportional-only would be lazy and wouldn't end up exactly at the right position all the time. Boy was I wrong! If the motor is sitting still, you can grab the shaft and make it give about a degree or two one way or the other because there's no integral to constantly correct small errors, but it always springs back right to the commanded position. And I can't make it break out into oscillation no matter what I do to it. I think I'm going to utilize it just the way it is!
    It's a step/direction controller so you can use it with Mach II, TurboCNC, etc. My biggest learning curve right now is learning where to put filter caps. Switching 24 volts on & off quickly makes lots of electrical noise everywhere!

    --Brian

    Brian,

    I am looking to use servo's iso of steppers as I can't find powerfull steppers cheap (free), I am on very thight budget.
    However I probably could get some decent servo motors with encoders for free
    On my desk is already one: a Minertia 33V 5Amps with pulleys and belts for reduction. Should have a bit of power, don't you think?

    So my question: Could you share your schematic and firmware?

    Thanks,
    Luc.

Page 1 of 2 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •