Building a CNC machine

The final machine is supposed to look something like this:

Click here for plans in PDF format.

Click here for some detailed images of the final machine.

Brief overview of the machine

I wanted a machine capable of engraving, drilling and milling printed circuit boards, and cutting out shapes in thin aluminium sheet. Basically so that I could more easily build things like this robot. I also wanted to have fun building a technical and robust piece of machinery.


The initial mechanical design was based heavily on Tero's JV2 CNC machine. It is a fair bit smaller, and has deviated somewhat from that machine, but the basic set-up of the axis remains the same. The rigidity and precision of the machine relies on quality linear motion components, with the rest of the structure made of aluminium.

Some of the aluminium was cut by the supplier; the rest I cut by hand with a hacksaw. The two drill mounting brackets were subsequently re-milled by the machine. All holes were drilled using a drill press and tapped by hand.


I did not want to rely on a PC for accurate timing, and I did not want to rely on having a parallel port for logic control. I wanted USB control, with a microcontroller dedicated to the timing and stepping of all three axis.

The control box houses an ATmega324p running at 20MHz, which controls the stepper motors, emergency stop switch, drill control relay, LCD display and joystick. The code for the AVR was written by hand in assembler and totals about 12,000 lines, including about 4,000 lines for 16.16 fixed-point math routines (a divide takes about 600 cycles, a sine about 1700, a square root about 3500).

To minimise bandwidth from the PC to the CNC machine, the AVR does its own rasterisation of the path. The AVR accepts two kinds of commands from the PC: straight-line to (x,y,z), and parametric path along (x(t),y(t),z(t)) for t from t-start to t-end. One can use polynomial, trigonometric and exponential functions to compute the 3D path. The analytic derivative of the path is computed by the AVR to determine the accurate step size for t. Parametric paths are converted on the fly by the AVR to small (20 or so steps = 40 um) straight-line segments and stored in an internal buffer. This buffer can also be filled directly by the PC with long straight-line segments. Bresenham's algorithm is then used to rasterise these straight-lines into step commands for the stepper motors. It takes into account proper timing for acceleration, deceleration and constant velocity. The AVR is powerful enough to rasterise mildly complex parametric paths (a circle is classified as a simple path) at full speed (which is about 12,000 stepper-motor steps per second).


Progress log

Linear guides, ball screws, ball nuts and bearings; all brand new.

I like to use socket screws because they look good and you can tighten them easily.

(big) (big)
Most of the aluminium was cut by the supplier. The main frame has been drilled and tapped and bolted together. The Y base rail and X cross rail are in place and seem to be solid and perpendicular enough. (big) (big)
The motors and ball screws need to be mounted next.

(Dated 27/2/2007)


The electronics are the next thing on the list. I make circuit boards from scratch using the laser printer toner transfer method. I find this method works very well and is relatively easy.

Stepper motor controller, based on the A3977 chip. Design printed on glossy photo paper, ready to transfer with a hot iron. (big)
Iron on the design, then etch!

The small tracks are 0.4 mm thick. The large ones around the edge are 2 mm thick.

(big) (big)
The main micro-controller board, based on an Atmel mega-324p. (big) (big)
The USB interface, based on a CP2102. I couldn't solder the CP2102 it its proper place (it is 5 mm square!) so wires had to be used. It still works fine. (big) (big)
Completed electronics box. Red switch is kill switch for the stepper motors. LED is power indicator. LCD is for general information, and feedback when you control the machine with the joystick. (big)
Inside are three motor controllers, Atmel controller, power distribution, USB interface, 60W switch mode power supply. Lots of cables. (big)
Connectors are (left to right): stepper motors out, joystick in, power in (240v AC), USB. (big)

The machine with motors and ball screws mounted, and the control box.

(Dated 17/1/2008)

(big) (big)
The machine with drill mounted. And first tests drilling a grid of holes in some wood. Holes have 2mm spacing.

(Dated 7/9/2008)

(big) (big) (movie 3MB)
The drill is now wired to a solid state relay that is used to turn the drill on and off in software. There is also a red emergency stop button (which turns the drill off, holds the x- and y-axis at their current position, and pulls the z-axis up about 0.25mm) and an extra mechanical safety switch for the drill. (big)

In its current state, the machine can only barely mill aluminium. The movie shows a very slow and shallow pass cutting out a shape. Pass depth: 0.1mm, milling speed: 2mm/s, mill bit diameter: 1.6mm, drill speed: about 12000 RPM.

Basically the machine is not rigid enough to mill even soft metal. There is too much play in the stepper motor to ball screw couplings, in the backlash of the ball nuts, and in the thin aluminium mounts used for the y- and z-axis.

(Dated 3/11/2008)

(movie 3.5MB)

Mechanically etching a printed circuit board.

Parameters: depth: 0.18mm, feed speed: 8mm/s, isolation width: about 0.4mm, drill speed: about 30000 RPM.

(big) (big) (movie 4MB)
Improved aluminium milling.

Parameters: pass depth: 0.1mm, milling speed: 4mm/s, mill bit diameter: 1.6mm, drill speed: about 10000 RPM.

(Dated 6/11/2008)

(big) (big) (movie 5.5MB)

Milling slots and holes for a table clamp. It is easier to make large cuts with a hacksaw than use the machine, so I milled shallow guide lines for the saw. (big) (big)
Milling the edges of the four clamps flat. The drill is not perfectly perpendicular to the table, so the finish leaves tiny ribs on the surface.

The finished clamp is shown on the right. The dimensions of the support grooves are 3mm wide by 1mm deep and are able to clamp wood, PCB and aluminium.

(Dated 16/11/2008)

(big) (big)

The Dremel has now been replaced by a far superior Proxxon IB/E. The machine fitted with the Dremel was used to mill the mounting brackets for the Proxxon.

There are three reasons the Proxxon performs better than the Dremel. First, the Proxxon can drill at lower RPM (down to 5000 RPM) which reduces a lot of chatter. Most importantly, torque is maintained at low RPM due to superior electronic feedback and control. Second, the collets for the Proxxon have much higher build quality than those for the Dremel, and the Proxxon collets are three pronged (instead of four), and have greater grip on the milling bits. Third, the shaft on the Proxxon is more rigid and has less run out than the Dremel.

(Dated 9/12/2008)

(big) (big)

The main control board with the Atmel AVR chip has been redesigned to make more efficient use of I/O pins. With this new board, a single AVR (ATmega324p) controls the entire machine, including home and emergencies switches, and drill relay control (previously the job of an auxiliary AVR micro controller). (big) (big) (big)
The new board was engraved, milled and drilled with the machine itself. Track isolation was very clean, although a bit deep. Holes and board cut-out were excellent. (big) (big) (big)

Another board created with the machine.

(Dated 19/8/2009)

(big) (big)

The CNC machine is being duplicated by a hackerspace group.

Using the existing machine, three stepper-motor control boards were etched and milled, along with the Proxxon bracket (lower bracket shown).

(Dated 8/9/2009)

(big) (big) (big)

Last updated 8/9/2009.