View Full Version : PIC Embedded design Question
musicmkr 06-20-2005, 07:18 AM 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.
Al_The_Man 06-20-2005, 09:02 AM 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?ViewItem&category=50924&item=7525009971&rd=1&ssPageName=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.
musicmkr 06-20-2005, 09:15 AM 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.
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.
ViperTX 06-20-2005, 02:12 PM Al, that's just the controller...how much more for the servo drivers?
Al_The_Man 06-20-2005, 03:08 PM 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.
ESjaavik 06-20-2005, 04:29 PM 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.
Al_The_Man 06-20-2005, 04:43 PM 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.
musicmkr 06-21-2005, 12:06 PM 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.
Al_The_Man 06-21-2005, 12:10 PM 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.
drawbar 06-21-2005, 12:17 PM 5 TPI @ 600 RPM = 120 inches per minute
--Brian
musicmkr 06-21-2005, 12:56 PM 5 TPI @ 600 RPM = 120 inches per minute
--Brian
Oops! It's been a long day....
drawbar 06-21-2005, 09:53 PM No offense intended whatsoever! I'm just an equation freak. :rolleyes: 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
Brian, can you provide more details about your servo circuit. Is it a PID controller? How well does it work?
drawbar 06-22-2005, 05:43 AM 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
musicmkr 06-22-2005, 09:05 AM 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.
Brian: thanks for sharing the information. I'm planning to do a servo controller in the near future, so now I'm inspired!
smarbaga 06-22-2005, 11:38 PM 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.
daedalus 07-30-2005, 08:01 AM 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.
lucas 09-09-2005, 11:15 AM 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.
drawbar 09-10-2005, 04:49 AM Lucas,
PM (Private Message) me your email address.
Brian
Whacko 05-06-2006, 08:45 AM I am currently busy with the same idea and have got a scale model running at my PC station. There are various ways to do this, but I have opted for the multipin PIC devices. I started of with the 18F8720, but ended up using the DSPIC 30F6014. Not for the speed, but for getting more experience with the 16 bit processor. The 452 has enough processing power. There are ways and means, and to try and do linear and circular interpolation with on the fly math sin and squareroot functions is not neccesary. In the 70's and eighties, commercial CNC machines were available as stand alone controllers using slow processors like the 8085, 8080 from intel. The PIC is to a much greater advantage.
If you would like, we can exchange ideas and code.
My scale is running quite well at this stage with increment accuracy of 0.02 mm
Regards,
Whacko
|
|