How-To: Build your own CNC machine (Part 1)

Ready for some hard core gadget creation? If you thought your dremel tool was handy before, in today's How-To we'll start building our own CNC machine. Aside from the geek factor, it can be handy for making things like PC boards without chemicals or maybe some little styrofoam voodoo heads of all your enemies, uh friends.

Gentlemen, start your soldering irons.

Computer controlled mills have been around for a long time. If you just want to buy oneone, Sherline makes mills that are ready to go (pictured is their CNC ready model -- just add your own motors and controller). But then again, if you wanted to buy one, you probably wouldn't be reading this, now would you? A CNC machine is a lot like a precision drill press with a table that moves in two directions -- seeing a commercial unit like the one above should help you visualize the end goal. We'll be making ours from scrounged, recycled, and adapted parts; today we'll be going over the basic parts we'll need to build our own.

[Update: If you're not quite sure what a CNC machine is, check out the Wikipedia article, mkay.]

Parts Hunting
For Part 1 of the How-To, we'll go over all the major components of the project and get started with the controller.
The major components of the DIY CNC machine:

  • Stepper motors

  • drive positioning screw

  • 3 Axis stepper motor controller

  • Linear slides

The most important component to determine the construction of your milling machine is the motor. Motors can be purchased from surplus houses, but the cheapest place to get them is from old dot matrix printers. Apple Imagewriters are one of our favorite sources. They contain multiple stepper motors, and the primary is pretty beefy. As a bonus, just about every dot matrix printer has a hardened steel rod that can be useful for our nefarious goals.

A stepper motor is an odd beast. Most motors spin when power is applied, stepper motors contain multiple coils. If the coils are energized in the proper order, the motor will rotate a small amount (a step). We'll take full advantage of the nature of stepper motors with this project. To simplify your life later on, you'll want to find stepper motors with more than four wires. Four wire motors are usually Bipolar motors. They produce more torque, but end up complicating the control circuit. The preferred type of motor for the frugal hobbiest is Unipolar. These usually have five or six wires, and they're pretty easy to work with.

Most stepper motors are labeled. The major points of interest include the voltage, resistance and the number of degrees per step. Knowing the number of degrees per step is vital for configuring the software to properly control the machine later on. For a three axis machine, at the very least you'll want the X and Y axis to both have identical motors. It's not the end of the world if they don't match, but it's more of a pain later on.

The drive screw is the next piece of our project. Commercial units use linear ball screws or linear gears. The commercial parts aren't cheap, but you can get away with some 1/4-inch threaded rod from the hardware store. Instead of anti-backlash nuts, we'll use these handy 1-inch long 1/4-inch nuts. Just about every hardware store has them, and they produce very little play. Try out the hardware at the store because defects in the nut or rod will produce drag that's easily noticeable by spinning the nut on the rod.

To couple the rod to the motor shaft, we'll use vinyl tubing with a pair of collars. The tubing is 1/4-inch inner diameter and prevents binding by allowing some play between the rod and the motor. You can get suitable collars from a model airplane store (The hardware store had some, but they were overpriced). Alternatively, you can make your own like we did from nylon bushings and hex screws.

Finally, we'll need some linear slides. One easy out is to purchase a used or surplus XY table that's built just for this purpose. Custom designs can be built using ball bearings. Above is the linear rail that ShopBot uses. They machine the edge of a piece of steel and use this cool angled roller bearing.

We built this linear slide from a 1/2-inch steel rod and multiple bearing surfaces. It works, but we don't recommend building it if you value your sanity.

Once uou've bought or salvaged a set of motors, you'll need a controller. The controller provides the interface to the computer, drives the motors and can provide some simple feedback to the computer. The stepper controller has to be powerful enough to drive the motors you've selected. We sifted through lots of stepper controller designs looking for one that presented the best value.

In the end we found this design for a relatively simple parallel port interface that originally appeared in a 1994 issue of Nuts and Volts. Today, the expensive UCN5804B is only available as a surplus item, but now the entire controller can be built for about $22-$30 in parts. (If you use a heavier motor like the ones from the Imagewriter, you might need to add some separate power transistors.)

The parts list at the link is a bit outdated, here's our updated shopping list.

  • 3 - UCN5804B -

  • 12 - 1N49355 Diodes - Part 625-1N4935 from

  • 2 - .01uF Capacitors - Part 581-SR155C103KAT from

  • 1 - 10uF Capacitor - Part 140-HTRL25V10-TB from

  • 3 - 4.7k Resistor Network 652-4608X-101-4.7K from (Has an extra resistor, but works fine)

  • 1 - D-Sub 25 pin Male - Mouser, RadioShack, etc.

  • 1 - Barrel power connector - Whatever works for your power supply. (We used a spare 12V power brick)

  • Stranded Cat-5 is sufficient for wiring

  • Terminals and male headers are optional, see the page for the circuit.

  • Heat sinks for the 5804Bs are needed. We used some aluminum channel.

  • Copper clad PC board (We stock up on ebay every so often)

  • Etching solution - Ferric Chloride, etc.

We made our own board using the template from the web page. We used similar techniques to the one in part 4 of our iPod Superdock How-To. We reversed the pdf image using Gimp, and printed it onto a laserprinter transparency. This method doesn't create as nice of a trace as the paper, but it's speedier. Clean the board, and keep the paper backing between the plastic and the iron. Once the toner is ironed, just cool it with water and peel.

We etched the board using Ferric Chloride from RadioShack in a disposable Zip-Lock container. It needs to be warm and agitated to work well. The acid and hydrogen peroxide solution etches way faster.

We drilled the board with our drill press and tungsten carbide bits from Drill Bit City. We had to refer to the placement schematic several times to make sure we drilled everything right. Getting the pins holes aligned for the 5804s is a challenge!

If you want to do a toner transfer of the placement mask, do it before drilling the holes. Otherwise the surface is too uneven to allow a good transfer. If you screw it up like we did, you can cheat. Just print the mask onto a transparency and burn holes for the components with a soldering iron. It works surprisingly well.

Next time we'll start building the actual machine and show you how to build some simple and effective slide systems. For now, here's a teaser of what's coming! Good luck!