Yet another iteration of nothing
Random header image... Refresh for more!

Category — Machine Design

Machine Design: Whitepapers

One of the better papers out there on machine design: Principles of Rapid Machine Design.

Good source of information stating how machine tools are accurately measured, scraped into precision: Foundations of Mechanical Accuracy

Introduces basic machining operations, setups, procedures: Machining Fundamentals




November 7, 2015   Comments Off on Machine Design: Whitepapers

CNCZone – DIY 4th Axis from First Principles (quite similar to my own ideas)

Ironically, I’m not the only one who’s done this.

CNC Zone – Building a 4th Axis from First Principles

This thread post-dates my own efforts by over 26 months, but, most pleasingly, echos my own logic to a most satisfying level. He states he already has a high speed lathe function, and has chosen a differing harmonic drive, but his approach has all the checkpoints mine did, and more (such as testing the harmonic before use). Even better, he is a PhD in measurement, and this reflects well on my thought processes.

There is excellent information on bearings, building philosophies, engineering trade offs, final operations.



November 3, 2015   Comments Off on CNCZone – DIY 4th Axis from First Principles (quite similar to my own ideas)

Dual Closed Loop Control with KFLOP

The Dynomotion KFLOP controller can control 8 motor axis (either as 4 dual/slaved or 8 independent), complete with 8 dedicated hardware encoder channels (while any generic input could be used in theory for encoding,  I understand the general I/O speed is much less than the dedicated lanes).

Placing rotary encoders on stepper or BLDC/BDC/AC motors can feed information on the motor position back to KFLOP, which will then apply corrective action to the drivers to accurately place the motors exactly where they were commanded to be (See Dynomotion – Closed Loop Stepper Control)

Unfortunately, this does nothing to compensate for pitch error in the screws, lash, or other purely linear mechanical elements. The solution to these is to add linear encoders in addition to the rotary; measuring the actual position of the linear elements and sending that feedback to KFLOP.

With a stepper system, one might be able to utilize linear encoders alone, and achieve good results. The stepper motor design itself imparts built in feedback: when the motor is commanded to assume a position, the drive pulse forces the rotor to assume the commanded angle via the two phases. When the motor overcomes the initial frictional opposing forces, the torque is naturally reduced. A stepper motor can be though of as a spring and mass system. The rotor is the mass, and as torque is applied, the magnetic force acts like the spring, storing energy and releasing it (this is also the reason for mid-band resonance in a stepper system). If the load attempts to move the motor out of that position, the increased magnetic field will “push” it back to the commanded position; this force does vary depending on where the motor is (full step and half step are stronger than microstep positions), as the magnetic torque follows a sine pattern.

Having said all that, the “bandwidth” (ability to react in short time frames) with linear encoders alone is said to be rather low/slow.  Enter the Dual Loop setup: using the rotary encoders for velocity control of the motors, and the “outer loop” (linear encoders) for motion/positional control (see Dynomotion – Dual Closed Loop).

Multiplexing Encoders

Unfortunately, encoders #0-4 occupy the same JP connector as that used to connect to a KSTEP (which then uses those pins for multiplexing KSTEP I/O). This is perfectly acceptable for the majority of stepper driven systems (being open loop) and the JP5 connector can be utilized for single loop motor or linear encoders (using the #4-7 encoder channels).

Fortunately, KFLOP can be programmed to multiplex the encoder inputs over to alternative connectors. If the multiplex bit is asserted, the dedicated inputs shift from their normal pin assignments on JP5 and JP7 (respectively) to the first 8 inputs on JP4 and JP6, respectively (4/2012 firmware changesMux’d Encoders Discussion).

The first 8 Inputs on JP4 are Encoders 0-3 A/B signals (when mux’ed). The first 8 Inputs on JP6 are Encoders 4-7 A/B signals (when mux’ed).

Reference MUX program:

 // Mux encoder inputs from KFLOP JP7 & JP5 to JP4 and JP6


Mux = 0                                                              Mux = 1
Signal       I/O Bit  Pin                             I/O Bit    Pin
ENC0A        0                 JP7 – 7                       16             JP4 – 5
ENC0B        1                  JP7 – 8                       17             JP4 – 6
ENC1A         2                 JP7 – 9                       18             JP4 – 7
ENC1B         3                 JP7 – 10                     19             JP4 – 10
ENC2A        4                 JP7 – 11                      20             JP4 – 11
ENC2B        5                 JP7 – 12                      21             JP4 – 12
ENC3A        6                 JP7 – 13                      22            JP4 – 13
ENC3B        7                 JP7 – 14                      23            JP4 – 14

ENC4A        36               JP5 – 1                        26            JP6 – 5
ENC4B        37               JP5 – 2                        27            JP6 – 6
ENC5A        38               JP5 – 3                        28           JP6 – 7
ENC5B        39               JP5 – 4                        29           JP6 – 10
ENC6A        40               JP5 – 5                        30           JP6 – 11
ENC6B        41              JP5 – 6                          31           JP6 – 12
ENC7A        42               JP5 – 7                         32          JP6 – 13
ENC7B        43               JP5 – 8                         33          JP6 – 14

Note that JP6 and JP4 are 3.3V only. Driving them above 3.8V will not do good things to KFLOP’s integrated circuits (JP5 is 5V tolerant by design).


KMOTION Dual Loop Programming

KMotion (the C program loader) must be programmed to join the two servo control loops together, forming an “inner” and “outer” loop. Dynomotion has an example program to do this:

#include "KMotionDef.h"

// Creates dual feeback loops for cases such as rotary motor encoder feedback
// with linear scale encoder feedback.  Two KFLOP Servo Axes are required,
// one for each loop.  Output of the outer loop is applied as a velocity
// to the inner loop 

    for (;;)  // loop forever
        ch0->Dest += ch2->Output;  // move ch0 at speed of ch2 output

This uses two KFLOP Axes channels per set, allowing 4 combined axis. The “FOR” loop can be added to the KFLOP initialization C program as well.

Examples of the settings for KFLOP axes:

Set Inner Loop Axis as:
Input Mode = Encoder
Input Channel = Rotary Encoder
Output Mode = DAC Servo

Set Outer Loop Axis as:
Input Mode = Encoder
Input Channel = Linear Encoder
Output Mode = No Output

Each loop can be tuned separately:

– Tune the inner loop axis for optimal performance based on the rotary encoders

– Tune the outer positional loop for optimal performance based on the linear encoders.

The outer (positional) loop is a higher level control, so it’s output should drive the inner (velocity) loop. example: ch2->Dest +=ch3->Output;


Multiplexing Encoders vs. Input Loss

Multiplexing the encoders to JP4 and JP6 means the previously utilized general I/O connections can only move to JP5 and other connectors (JP7 will still use the I/O pins for multiplexing KSTEP’s inputs). This results in a net loss of available inputs that may be non-trivial to regain.

The Velocity Loop in External Drives

A simpler solution is to fit servo drives that accept encoder feedback and close the velocity/torque loop in the drives, leaving KFLOP to handle the linear encoder inputs, which forms the position loop. The drives will then make certain the motors respond to where they should, and the KFLOP will correct for positional errors via the linear scales. Less control by KFLOP, easier wiring and installation.

Pros and Cons

If the level of mechanical compliance/accuracy of the system is already acceptable, adding the (possibly) significant cost and complexity of closed loop control may not be warranted. Conversely, if the mechanicals are so sloppy a strong wind or quake can shift positions, additional feedback will not make for quality performance.

Closing the control loop around linear scales includes more “bad” mechanical things inside, making the loop more difficult to control. Lash for example, crossing a axis point (think the four quadrants of a circle) will cause considerable havoc as the servo system chases the lash around for that split moment the affected axis is unloaded. Always best to remove lash rather than attempt to correct for it. In addition to Backlash, there is Stiction (static (sticking) vs dynamic friction), and Compliance (elastic modulus). Poor machine design can render expensive zero backlash ballscrews useless. As examples:

  • Inherent design (Box Ways, Dovetail Ways) have relatively large amounts of stiction, which is offset by the proportionally greater load bearing surface area, compared to linear guides.
  • Ballscrew classes can have significant lead error (According to Thompson Ballscrews), a Transport Class 7 rolled Ballscrew can have a permissible variation of 900um in 2500um (0.035 inches in 98), and up to 0.18mm of lash (0.007″).
  • Thermal expansion. On a large machine, the growth of the ballscrew can be significant. (11.7 ppm/° Celsius). As an exaggerated example, a 1219mm long (48 inch) ballscrew, during a 50 degree Celcius rise in temperature, will “grow” 0.73152mm (.0288 inches).
  • Rigidity (stiffness, opposite of compliance) of the unit: floppy drive belts, worn or “sloppy” gearboxes, torsion and bend loads in the structure, flexible couplers

As an example of such from Tom Kerekes of Dynomotion (on a post from CNCZone):


 …So for example say the linear encoder has a small error that the servo wants to correct. This will usually cause the servo to ramp up the motor torque. Eventually the motor will have enough torque to break stiction and begin accelerating. But the linear scales may not yet indicate any thing has moved because of the system’s backlash/compliance. So the Servo will continue to ramp up torque further. Eventually when the backlash/compliance is taken out the Axes will move and the Linear scales will report the motion. But at that point the motor may be at such a velocity that it is difficult to avoid a significant overshoot. Most systems like this can be made to work and be stable but only with very low feedback gains (torque is ramped up very very gradually) resulting in poor dynamic performance (errors are not connected quickly and therefore are allowed to grow to larger values).


February 24, 2015   Comments Off on Dual Closed Loop Control with KFLOP

More Stepper and Servo Wisdom

Again, from CNCZONE:

Q.) What are the advantages/disadvantages between steppers and servos?

A.) Step motors and servo motors service similar applications, ones where precise positioning and speed are required.

The biggest difference is that steppers are operated “open loop”. This means there is no feedback required from the motor. You send a step pulse to the drive and take on faith it will be executed. Seems like a problem but it’s not.

If you have a quartz watch with hour and minute hands, then you have a step motor on your wrist. The electronics generates 1 step pulse per second, driving a 60 step per revolution motor which turns at 1 RPM. It keeps nearly perfect time. Any errors are due entirely to the electronics timing accuracy (quartz crystal oscillator).

Top Ten Stepper Advantages:

1) Stable. Can drive a wide range of frictional and inertial loads.
2) Needs no feedback. The motor is also the position transducer.
3) Inexpensive relative to other motion control systems.
4) Standardized frame size and performance.
5) Plug and play. Easy to setup and use.
6) Safe. If anything breaks, the motor stops.
7) Long life. Bearings are the only wear-out mechanism.
8) Excellent low speed torque. Can drive many loads without gearing.
9) Excellent repeatability. Returns to the same location accurately.
10) Overload safe. Motor cannot be damaged by mechanical overload.

Top Ten DC Servo Advantages:

1) High output power relative to motor size and weight.
2) Encoder determines accuracy and resolution.
3) High efficiency. Can approach 90% at light loads.
4) High torque to inertia ratio. Can rapidly accelerate loads.
5) Has “reserve” power. 2-3 times continuous power for short periods.
6) Has “reserve” torque. 5-10 times rated torque for short periods.
7) Motor stays cool. Current draw proportional to load.
8) Usable high speed torque. Maintains rated torque to 90% of NL RPM
9) Audibly quiet at high speeds.
10) Resonance and vibration free operation.

Top Ten Stepper Disadvantages:

1) Low efficiency. Motor draws substantial power regardless of load.
2) Torque drops rapidly with speed (torque is the inverse of speed).
3) Low accuracy. 1:200 at full load, 1:2000 at light loads.
4) Prone to resonance. Requires micro-stepping to move smoothly.
5) No feedback to indicate missed steps.
6) Low torque to inertia ratio. Cannot accelerate loads very rapidly.
7) Motor gets very hot in high performance configurations.
8) Motor will not “pick up” after momentary overload.
9) Motor is audibly very noisy at moderate to high speeds.
10) Low output power for size and weight.

Top Ten DC Servo (brush type) Disadvantages (besides higher relative cost):

1) Requires “tuning” to stabilize feedback loop.
2) Motor “runs away” when something breaks. Safety circuits required.
3) Complex. Requires encoder.
4) Brush wear limits life to 2,000 hrs. Service is then required.
5) Peak torque is limited to a 1% duty cycle.
6) Motor can be damaged by sustained overload.
7) Bewildering choice of motors, encoders, servo drives.
8) Power supply current 10 times average to use peak torque. See (5).
9) Motor develops peak power at higher speeds. Gearing often required.
10) Poor motor cooling. Ventilated motors are easily contaminated.

Q.) Should I use servos or steppers in my machine?

A.) If you are designing a machine and you get to motors, the first thing you should do is calculate the power you need. Never buy a motor (stepper or servo) first and then figure out if it will fit what you need.

Motors are motors. They couple power to your mechanism and power is what makes things happen. The choice of a motor comes after you know what’s needed.

Power is velocity times force or torque times RPM. It doesn’t matter if the motors are steppers, servos or a gerbil in a spinning squirrel cage at the start.

To separate what motor need (neglect the gerbil), is the power your mechanism needs.

Rule #1: If you need 100 Watts or less, use a step motor. If you need 200 Watts or more, you must use a servo. In between, either will do.

So, how do you figure the power you need?

Method 1: You have a plasma table, wood router or some other low work-load mechanism. You have a clear idea of how many IPM you want but you’re not sure of what force you want at that speed.

Pick the weight of the heaviest item you are pushing around. If it weighs 40lbs, use 40lbs. multiply it by the IPM you want. Say that’s 1,000 IPM. Divide the result by the magic number “531”. The answer is 75.3 Watts so use a step motor.

Eq: Watts = IPM * Lbs / 531

Method 2: You have a Bridgeport CNC conversion you are doing. The machine has a 5 TPI screw and you need a work feed rate of 120 IPM. 120 IPM on a 5TPI screw 5 * 120 or 600 RPM.

How about force? Not a clue? Use your machinist’s experience on a manual machine. The hand crank is about 6″ inches in diameter. How much force would you place on the hand crank before you figure you’re not doing something right? I hear about 10 lbs.

10 lbs is 160 oz, 160 oz on the end of a 3″ moment-arm (6″ diameter, remember?) is 480 in-oz (3 times 160) of torque on the leadscrew.

The equation for rotary power is: Watts = in-oz * RPM / 1351

For this example, Watts = 480 in-oz * 600 RPM / 1351 or 213 Watts.

213 Watts is servo territory. You have to use a servo motor to get that, about a NEMA-34 one.



Something else to keep in mind with the stepper motors is that bigger isn’t always better. You have to look at the phase inductance. Higher induction results in a faster torque curve drop off (lower usable rpms). Generally the smallest motor that will work for the needed torque with the lowest phase inductance will perform better that larger overkill motors. The inductance that you should be looking for will be below 2.5mh ideally below 1.8mh. With inductance higher than this the usable rpm range drops drastically.

Don’t forget voltage. The higher voltage you run the higher the usable rpms. Ideally you should run your motors at: V=32 x sqrt(motor inductance). This usually ends up being higher than most drivers can handle, unless you get high voltage drivers. This allows the best motor performance without over heating. Stepper very rarely run at full amperage and only for very short period of time. Driver current is important but correct voltage will give much more noteworthy real world performance.

Watch out for high torque for size (ie. nema 23 motors with >400 in/oz), they generally have a very low torque drop off, rpm wise, due to high inductance. They are fine for slow speed operation but anything above about 150-200 rpm have almost no torque unless you run them at very high voltage. High voltage drivers can get pretty expensive. Also, larger motors have a larger rotor inertia. This means slower response to speed and direction changes: meaning higher voltage for the same performance.

IMHO, you should look at wattage needs of your machine. (Watts = IPM * Lbs / 531) Lbs is the weight of the heaviest thing you have to move, including cutting force. If your system needs 100 or less watts use a stepper motor. This usually falls in the nema 17 to mid sized nema 23’s. Watts between 100 and 200 can be a stepper motor or a servo. The usable motors would be mid to large nema 23’s. Higher than 200 watts USE SERVOS. Large steppers generally have very poor performance (for the reasons I said above).



Microstepping beyond 10X is of virtually no value. First, no benchtop machine is going to benefit from more than 10X micro-stepping, because it’s already far beyond the mechanical resolution of the machine itself. If you’re running direct drive steppers with 5-pitch screws, 10X microstepping gives a nominal (NOT actual) step size of 0.0001″. Flex and vibration in the machine will FAR exceed that. Second, micro-stepping does not produce equal-sized steps, and the higher the ratio, the greater the % error will be, so microstepping beyond a relatively low ratio does absolutely nothing to increase resolution or accuracy.



The primary function of microstepping is to provide smoother motion, NOT to increase resolution. The ultimate resolution, and accuracy, of any CNC machine is FAR more a function of the mechanical characteristics of the machine than it is the drive system. In the real world, it is quire difficult, and VERY expensive, to even get close to +/-0.001″ true accuracy and resolution. It is done on large commercial machine by FAR more expensive components, a FAR more massive (stiffer, with better damping) machine structure, and more complex software, which compensates for some of the many remaining sources of error and inaccuracy. Having a drive that is theoretically capable of high resolution will do nothing to improve the overall system accuracy or resolution, unless the many errors contributed by the many other parts of the machine are all already below the error contributed by that drive. On these machines, you typically have ballscrews with an accuracy of perhaps +/-0.003″ per foot. Flex of the machine itself can be several thousandths of an inch. Thermal expansion can contribute that much more. You always have stiction, and backlash, which can completely consume small movements. So what does reducing the step size from 0.0001″ to 0.00001″ actually accomplish? Now, you can try to address all these deficiencies, but a single high-precision ballscrew will cost more than you paid for the whole the machine, and the other parts you’d need to swap out won’t be much cheaper.


Microstepping is for smoothness of operation. Take a big ratchet and give it 8 notches per turn and turn it fast. It’s going to make a hell of a lot of noise and vibrate a ton. Take that same ratchet and give it 48 smaller notches and it will be much less noisy and feel smoother as it moves at the possible expense of the amount of torque it can hold against. It’s easy to hear and feel the difference in a microstep driven motor and a full or half-step driven motor. But they may not actually move the table until a couple of microsteps are taken because they lack the full torque to move the load.

I microstep at 8 so 1600 steps per rotation and 5 rotations per inch or 8000 steps per inch, but I only count on the machine being able to position within 0.001″. In most cases it *can* position to 0.0005″ but there is no way in hell it’s good to 0.000125″ as the microstepsper would have you think.


November 27, 2014   Comments Off on More Stepper and Servo Wisdom