fpga4fun.comwhere FPGAs are fun

What is a CNC?

A CNC is a controller that drives a cutting machine. The most popular cutting machine is a milling machine.

Milling machine

A simple milling machine has 3 axes, while more complex machines have 4 axes or more.

Here's a simple 3-axis milling machine. Each axis is controlled manually with an handle.

On a CNC machine, each axis is moved by a motor, and a controller to precisely control the motors rotations. For example, let's say each turn of a motor makes an axis move by 1mm. To move by 3mm, you need 3 turns. How does the controller make sure the motor turns exactly 3 turns?

Motors and loop control

Two types of motor are commonly used: stepper motors and CC motors (CC = continuous current).
Stepper motors typically use open loop motion control, while CC motors use closed loop motion control.

Before explaining what that means, here's a summary of the motors capabilities.

Motor typeStepperCC
Loop controlOpenClosed
ComplexityLowhigh
CostLowHigh
Motion speedMediumHigh
PrecisionVery highHigh
Axes sync.Very goodGood
Idle stabilityGoodFair
EfficiencyLowHigh

Stepper motors can be seen as motors controlled by electrical pulses. Common stepper motors require 200 pulses per rotation, so by sending 600 pulses, the motor should make exactly 3 turns. This is called "open loop motion control" because there is no mechanism that checks that the motor turns as expected. Instead the user relies on the known characteristics of the machine/motors combination. The main drawback of stepper motors is the possibility of "missing steps" if driven too fast, so stepper motors are always used at conservative speeds (i.e. with enough margin to avoid missing steps).

CC motors don't use pulses, but continuous current, which is simpler than pulses, but getting exact motion is more complex. To get 3 turns, the controller needs to send some current to the motor, and needs a way to monitor the rotation, so that it stops sending current once the 3 turns are achieved. This is called "closed loop control" because of the mechanism that monitors the motor rotation. This allows for faster operation and efficiency, but is more complex and slightly less precise than stepper motors.

fpga4fun's milling machine uses stepper motors (like most hobbyist machines do) so that's what we'll concentrate on.