View Full Version : NEW MEMBER: I am going to build a 3 axis servo control

07-10-2010, 02:02 AM
Hi. My name is Mark, and I am from Bucks County Pennsylvania. I am a student of DeVry University in the Electronics engineering bachelors program. I found your website through a simple google search. I became interested in cnc after reading several projects through the instructibles.com community. There are many stepper control circuits there, but nothing for servo control. I plan to develop a servo control that is inexpensive, and distribute it to the instructibles.com community. Personally, as a student, I do not have much capital to invest in this project, but would still like to have a full featured 3-axis cnc router to make circuit boards without chemicals, and possibly to cut foam for casting metal parts.

The control I plan to develop will include a servo for each axis; x, y, and z, plus a pwm h-bridge for my cutting tool. Most people on the Instructibles community seem to want to run Mach 3, but that requires the use of a parallel port, which most computers don't have any more. I plan to make my contribution fully usb compliant, even though that may be over zealous. I am going to use a Microchip PIC18fxxxx series microcontroller, but I have not finalized my hardware as of yet. The PIC18fxx31 microcontrollers feature a built in quadrature encoder interface, or a PIC18fxx53 which includes native usb communication. I hope that I can make this work in mach 3, but I am sure that i can scrip linux emc2 to work

I really want to join this site to gain more cnc experience, and I like to see if I can find an answer to my questions, before I ask for help.

07-10-2010, 11:37 PM
Hi Mark and welcome to the site. Thats a pretty ambitious project. All of what you mention is doable, becuase all of it has been done in some form or another. But for one person to code it all up is definitely a labour of love. I for one would love to see it.. and there are several members who have the skills/expertise to advise you.

08-10-2010, 12:50 AM
you have my interest as i run servo motors and have yet found a decent yet affordable controller. Pah...all you stepper boys :whistling:

08-10-2010, 06:14 AM
Oh, but steppers are not that bad, I just really like a challenge. Seriously though, I really decided to take the servo challenge because:

1) I would like to be able to contribute something instead of just taking all the time.

2) Because I can come up with dc motors and encoders for relatively free.

The setup I will use the servo control for will probably use mostly junk car and printer parts. I did not design the table yet, but I feel that it will be slightly easier than the control. I am envisioning using automotive power window motors for the servo motors, with serial mouse encoders, or possibly inkjet printer encoders, but the chop wheels look much more professional on the mouse parts. I did however already buy sealed bearings for the slides. Precision round rods are found in shock absorbers, and most spare tire jacks have a really nice acme thread forcing screw, with nut. I am not looking to build a huge setup, this time, but I would like to leave room for expansion in my control design.

I was not even thinking about a mouse for the quadrature encoders but it makes perfect sense. I read this guy's blog about it:


...back to the servo control.

National semiconductor makes a deticated chip for precision motion control called the lm628/lm629. The problem with it is price. The lm629 is about $52 us. for each axis, making it very cost prohibitive for the hobbyist, but the lm629 would be the easiest way to go because it can output directly to a motor driver. I actually would make a go with it anyway, but it was not on the free samples program. Jkerr makes a chip for about $20 us. for each axis, but I think that I can do it cheaper. Right now, I am reading the 392pp datasheet for the Microchip PIC18f4431. Its a pretty stout programmable microcontroller that has a quadrature encoder interface already built in. This makes it a perfect candidate for the servo control, and at just under $7 us., it is getting very close to my tight budget. I don't know if it can be sampled, but I have already sampled its little brother the PIC18f2431.

Microchip also has sample code to perform servo control for certain processors in its application notes this one is for the PIC17c42:


I know that my idea CAN work, but with my busy schedule, which consists of a full time job, a part time job, and school, this may take at least six months til I have something real to display.

08-11-2011, 07:00 PM
Bit late but very interested. I use servos basically because they were free! Very interested in any servo drivers that output a proper drive signal, 12 bit DAC would do! I use an old card currently drip fed from a pc. Whilst it's capable I use only basic commands, move relative, absolute, circular arc etc. it's fast but, I can only feed it through 9600 baud RS232 which is limiting me to about 10 moves per second. Multiple short moves are a problem. I seem to be forever re writing the home brew to optimise the tool path. A good low cost servo controller, quick on the comms side would go down very nicely please!

09-11-2011, 02:29 AM
Do not worry, you are not late.....

I am still working on my design. I totally understand your 9600 baud problem. That is why I would like to incorporate usb into my design. It is infinitely faster than a normal serial connection. USB has been slow to in its implementation for industrial applications. I have been using an Analog Devices usb isolation ic in my design phase, but I may switch up to an Atmel uC because the open source community is more inclined to them. Microchip is still at the front of my design because they give out a light version of their IDE for free, but in linux, which I use, Atmel is much easier to work with.

My table is almost complete. I have the x axis, and most of the y axis done. I just have to mount the lead screws and the limit switches. I am going to use a modified computer switch mode power supply. I can use it to power my drive controller, and use the drive controller to turn on the power supply. All I have to add is an scr to turn the cutting head on and off. I have a dedicated computer with EMC 2.4 loaded, all ready to go, and I have been reading up on creating the drivers.

I would say the whole project is about 50% complete, since my last post. I would have liked to have been making chips by now, but I feel satisfied that I at least have some progress.

Thanks for showing interest..

11-11-2011, 11:09 PM
I have a very capable but old card, I use an eprom that is designed to respond to drip fed commands form a pc, but limited buffer. Commands can be 10 - 15 asci chars plus checksum and the card can take up to 50ms to respond or though its often less when I measured it. For smooth servo move it needs continuous commands and the RS232 just don't do that. The card will interpolate 3d straight moves and circles / arcs in any two axis but not complex moves, spirals etc. So, to sum up, complex moves must be short 3D interpolated. At the moment in my optimisation home brew, the host pc software works out the time the machine needs to complete a move ahead of the move. If it's less than 50ms it does a suitable ramp up and ramp down as the card will do a controled stop (out of my hands!) if it cant maintain constant velocity. This makes it very slow on complex multiple short fast xyz moves.

I am probably making a very naive statement but presumably this chipset is a simple swap from pwm to a voltage signal which my free but massivley good MAX250 amplifiers need? Very interested in your developments especially if it could do arcs, spirals on board, even if that just means a decent move buffer like next 40 or 50 moves or high speed comms. Don't like the pulse and direction type controllers for servos, sort of defeats the object and demands Mach3, might as well have steppers..

Basically, very very interested!


15-11-2011, 12:59 AM
Hi Mark,

I'm new to this forum myself, and stumbled on MyCNCUK while Googling for bits to complete my tabletop mill. I was going to go with servos, but the daunting complexity of feedback loops and tuning has put me off for now.

I totally understand what you are setting out to do, and commend you for taking it on with the limited means of a student. I'm forever canibalizing old photocopiers, printers and scanners, which will yield nice precision rods and bearings, drive pullies, ballraces, power supplies and stepper or even servo motors with encoders. For readers wanting to go the servo controller route with Gecko-style modular purchases, I've stumbled across this guy on my doorstep here in Pacific Coast Canada: DMM-Tech.com who supplies servo drivers and controllers and motors at prices comparable to the popular Gecko stepper stuff. No connection, or recommendation, I just happen to know of them.

Off-topic, my own project is conversion of a wood mortising machine into a table top mill, using steppers and ball screw actuators. The objective is a compact, very accurate steel and aluminium-capable 3-axis (expandable to 4) bench-top sized machine, with a work space of about 6 X 8 X 8 in, or 1500 X 2000 X 2000 mm.

15-11-2011, 11:53 PM
Hi. Looks good, but AC and Mach3. Being a died in the wool old servo guy I am still struggling with the concept of why anyone would want to send pulse and direction to a servo, maybe I need to evolve! I could just upgrade my motion card, but we are talking about 1500! The trouble started 20 years ago when I got a load of big servos, 500 and 1000 line encoders, industrial rack mounted amplifiers etc, for free! Never given any problems, wouldn't expect it too, they are just getting run in now. So at the moment it's resolution is 1000 counts per mm and is happy moving in straight lines and circles at 1/2 m/s, good for cut transition moves, following errors are in the order of 2 or 3 encoder counts at these speeds, ie, not very much. anything straight or arc ish can move fast, but.. my cam program (to create tool paths) is outputting complex curves as point to point or small arcs and even at a reasonable 10mm/s take less time to complete than I can send the next command (homebrew driver software pascal, dlls in C). I have optimised and optimised the software, it even calculates the time to move before it sends the next command (telling the machine to ramp down to zero speed if the move cannot be competed. It keeps account of the time taken for the card to respond and adjusts). So, quite complex. I need a cheap card, with a voltage output and fast comms, they don't currently exist, so I encourage you to press on!
But it's just a hobby! If my card ever gives up, it would be far far cheaper to switch to steppers and write a pulse driver.