◆ Rebuild

Part 10 · Machines

CNC Machines and 3D Printing

Machine tools that follow a list of numbers instead of a machinist's hands. How lead screws, stepper motors and a controller turn coordinates into movement, how G-code works, how to build a CNC router and convert a mill and lathe, and how 3D printers build parts layer by layer from clay, plastic or metal — so that a small workshop with the right file can copy almost any part.

Difficulty
●●●●●
Time
Two to four weeks to build a CNC router or a clay printer; a season to convert a mill; months to make reliable plastic filament
Steps from zero
76 prerequisites →

You need first

Machine ToolsRobots and Automation

This unlocks

—
The full path from nothing — 76 steps before this one
  1. Stone Tools
  2. Cordage and Rope
  3. Fire
  4. Finding and Preparing Clay
  5. Finding and Identifying Ores
  6. Sulfur
  7. Measurement from Scratch
  8. Writing and Numbers
  9. Basic Woodworking
  10. Hunting and Trapping
  11. Charcoal
  12. Pottery
  13. The Kiln
  14. Arithmetic and Fractions
  15. Hides and Leather
  16. Lime
  17. Bricks
  18. Salt
  19. Mercury
  20. Lye and Potash
  21. Fermentation
  22. The Wheel and Axle
  23. Logic and Binary
  24. Glass
  25. Firebrick and Refractories
  26. Bellows
  27. Saltpeter
  28. The Lathe
  29. Gears
  30. Glass Fibre and Glass Wool
  31. Iron (the Bloomery)
  32. Copper Smelting
  33. Lead
  34. Laboratory Glassware
  35. Sulfuric Acid
  36. Pumps
  37. The Waterwheel
  38. Lenses
  39. Blacksmithing
  40. Gold and Silver
  41. The Blast Furnace and Cast Iron
  42. Bronze
  43. Hydrochloric Acid
  44. The Battery
  45. The Vacuum Pump
  46. Magnets
  47. The Thermometer
  48. Steel
  49. Chimneys, Stoves and Heating
  50. The Steam Engine
  51. Bearings and Lubrication
  52. Copper Wire
  53. The Light Bulb
  54. Electrolysis
  55. Photography
  56. Hydrogen, Oxygen and Gases
  57. Machine Tools
  58. Centrifugal Pumps and Fans
  59. The Electromagnet
  60. The Generator
  61. The Vacuum Tube
  62. The Electric Arc Furnace
  63. Ammonia
  64. The Electric Motor
  65. Thermostats and Automatic Control
  66. Ice and Refrigeration
  67. Pure Silicon
  68. Ventilation and Air Conditioning
  69. Semiconductors and the Transistor
  70. Clean Rooms
  71. Integrated Circuits
  72. Making Microchips
  73. The Computer
  74. Programming
  75. Microprocessors and Personal Computers
  76. Robots and Automation
  77. CNC Machines and 3D Printing

Do them roughly in this order. See it on the tech tree →

Why it matters

A CNC machine (computer numerical control) moves its cutter by numbers: tell it to go to X = 50.00 mm, Y = 20.00 mm, and it goes there, for the first part and the thousandth. It cuts curves no hand could follow — a propeller blade, a gear tooth, a bottle mould — and runs while the machinist sets up the next job.

A 3D printer works the other way round: it builds a part up, one thin layer at a time, from soft plastic, clay or melting metal, with no fixtures or cutters, and can make hollow, interlocked shapes no cutter could reach.

Together they let a village copy a broken part for a pump, loom or tractor from a measured drawing turned into a file — and the file can be stored and sent like any other knowledge (Programming). A CNC machine can also make the parts of another CNC machine, which is how they spread.

The honest limits: CNC needs Machine Tools, Robots and Automation and a small computer (Microprocessors and Personal Computers) first; the best work needs Precision Grinding; plastic printing needs a plastics industry. So this chapter starts with the simplest machines that work.

How it works

Coordinates

Every point on a part can be named by three numbers: X (left–right), Y (front–back) and Z (up–down), measured from a chosen zero, usually a corner or the centre of the stock. A CNC machine has one motor per axis. A milling machine moves X, Y and Z; a lathe needs only X (across) and Z (along the work); a 3D printer moves X, Y and Z and also feeds material.

From number to movement

Stepper motor200 steps a turn Coupling Thrust bearingstops the screw sliding Nutfixed under the table Lead screwlead 5 mm Ways Limitswitchfinds home Tablecarries the work Steps per millimetre= (200 steps × 8 microsteps) ÷ 5 mm lead= 320 steps per mmso each step moves the table 0.003 mm Backlash plain nut: a gap ball screw: no gap
Fig. 1 One axis of a CNC machine. A stepper motor turns a lead screw; the nut on the screw drives the table along its ways. A limit switch at the end tells the controller where "home" is. The inset shows backlash: the gap between screw and nut that a ball screw removes.

Each axis is a slide on straight ways (Machine Tools), pushed by a screw turned by a motor. One turn of the screw moves the slide by the screw's lead (its pitch, for a single-start thread). So:

steps per millimetre = (motor steps per turn × microsteps) ÷ screw lead in mm

A 200-step motor with 8 microsteps on a 5 mm lead screw gives 1,600 ÷ 5 = 320 steps per mm: each step moves the table 0.003 mm. That is the resolution. The accuracy — how close the table really comes to where it was sent — is set by the screw, the slack in the nut, the stiffness of the frame and the temperature, and is usually 10 to 50 times worse.

The controller (a small computer, Microprocessors and Personal Computers) reads the program, works out how many steps each motor must take, and sends the pulses at the right rates so that all axes arrive together and the cutter travels in a straight line or a true arc. It speeds up and slows down gently so that stepper motors never miss a step (Robots and Automation). Large machines use servo motors with encoders instead, which report their position and cannot silently lose it.

G-code

The program is a list of lines in G-code, a language older than personal computers that almost every CNC machine and 3D printer reads. Each line holds letter-number "words":

Word Meaning
G0 X Y Z Rapid move to a point (not cutting)
G1 X Y Z F Straight cutting move at feed rate F (mm per minute)
G2 / G3 X Y I J Arc clockwise / anticlockwise to X,Y around a centre offset I,J
G21 / G90 Units in millimetres / coordinates absolute (from zero)
M3 S Spindle on, clockwise, at S revolutions per minute
M5, M30 Spindle off; end of program
T Tool number to use
XY 20 40 10 20 30 40 50 A B C D E arc centre Part 60 × 40 mm, corner radius 10 mm; grid 10 mm The program G21 G90millimetres, absolute M3 S12000spindle on, 12,000 rpm G0 X0 Y0 Z5rapid to above A G1 Z-2 F200plunge 2 mm deep G1 X60 F600cut to B G1 Y30cut to C G3 X50 Y40 I-10 J0arc to D round the centre G1 X0cut to E G1 Y0back to A G0 Z5lift clear M5 M30spindle off, end
Fig. 2 A simple part and its G-code. The cutter starts at a safe height, plunges, follows the outline, cuts the corner arc, and lifts clear.

Short programs can be written by hand. Longer ones are produced by a CAM program (computer-aided manufacturing) from a drawing (Technical Drawing, Blueprints and Cyanotypes): it plans every pass of the cutter, its depth, speed and order.

Rigidity, backlash and heat

  • Rigidity is everything. Cutting forces bend a flimsy frame, and the cutter chatters and digs in. A CNC mill for steel wants cast iron and heavy ways; a router for wood can be steel tube or even thick plywood.
  • Backlash is the slack between screw and nut: reverse the motor and the table does not move until the gap is taken up. A plain screw and bronze nut has 0.05–0.2 mm. Cure it with a split nut pushed apart by a spring, or with a ball screw. The controller can also add a fixed correction each time an axis reverses.
  • Heat. Steel grows 0.012 mm per metre for every 1 °C. A 1-metre screw that warms 10 °C in use is 0.12 mm longer. For fine work, let the machine warm up before measuring, and keep the workshop's temperature steady.

What you need

Item Notes See
Frame and ways Cast iron, steel tube, or thick plywood for a router Machine Tools, Plywood, Veneer and Boards
Screws, motors, drivers, limit switches, emergency stop One set per axis below, Robots and Automation
Controller Small computer with step and direction outputs Microprocessors and Personal Computers
Spindle and cutters 0.5–2 kW motor; high-speed-steel end mills and drills The Electric Motor, Alloy and Stainless Steels
For printing Extruder, heater, temperature sensor, filament or clay below

Where to find it

The raw materials are those of Machine Tools, Steel, Copper Wire and The Electric Motor. For printing in clay, use ordinary potter's Finding and Preparing Clay. For printing in plastic, PLA (polylactic acid) is made from sugar or starch — cane, beet, maize or cassava — by Fermentation to lactic acid and then chemistry; other printable plastics come from oil (Petrochemicals and Modern Plastics).

The stepping stones

Numerical control did not appear from nowhere, and a rebuilding society can climb the same stairs:

  1. Copying by template. A copying lathe or tracer mill follows a master shape with a stylus while the cutter, linked to it, cuts the copy — Blanchard's gunstock lathe of 1818 did this with no electricity. The pantograph does the same in two dimensions. This is how to make many identical curved parts before computers.
  2. Cams. Automatic screw machines read their motions from cams: every part identical, but changing the job means making new cams.
  3. Punched tape. The first numerically controlled mills (1952) read their moves from paper tape (Programming) through relay and tube circuits. A rebuilding society with relays, counters and stepper motors can make a slow NC machine this way, before it has microprocessors.
  4. A small computer reading G-code: the modern machine, and the subject of the rest of this chapter.

Method 1: The first machine — a CNC router

The lead screw

A lead screw turns rotation into straight motion. For CNC use it must be straight, of even pitch along its whole length, and fit its nut closely.

  1. Material: a straight steel bar, ground or turned true. For a router, 12–16 mm across; for a bench mill, 16–20 mm.
  2. Thread: a trapezoidal (Acme) thread with 30° flanks, which is strong and easy to fit with a split nut. Lead 4–5 mm for a mill, 5–10 mm for a router (faster, less fine).
  3. Cut it on the screw-cutting lathe (Machine Tools), with the work supported by a steady rest so it does not whip. Take light final passes.
  4. Lap it: run a split bronze nut, charged with fine abrasive and oil, up and down the screw for hours (Abrasives and Grinding Stones); this averages out the small errors the lathe left (Precision and Interchangeable Parts).
  5. Measure the error: move the slide by the screw in 10 mm steps and measure each against a good scale or gauge blocks. Write the errors in a table; the controller can correct for them.
  6. Mount it with a thrust bearing at the motor end (so it cannot move along its length) and a plain support at the far end. Join it to the motor with a flexible coupling.

Good or bad: a good lead screw turns freely in its nut along its whole length, with no tight spots, and its measured error is under 0.05 mm per 300 mm.

The ball screw

A ball screw is a lead screw whose nut runs on a stream of hardened steel balls rolling in a round-bottomed groove, recirculating through a tube in the nut. It wastes almost nothing in friction (about 90% efficient, against 25–40% for a plain screw), lasts much longer, and with two half-nuts pressed apart (preload) has no backlash at all. Making one needs a hardened screw whose groove is ground to shape (Precision Grinding) and sets of balls matched to a micrometre (Making Ball and Roller Bearings). It is the right screw for a mill, but not the first thing to make.

The CNC router

A CNC router carries a fast-spinning cutter over a large flat table, for wood, plywood, plastics and soft metals. It is the easiest CNC machine to build, because the forces are low, and it can make many of the parts of the next machine.

Item Size
Working area 600 × 900 mm (cuts half a plywood sheet at a time)
Frame Welded steel box tube, or laminated hardwood or plywood 25–36 mm thick, glued and screwed
Gantry A bridge across the table on two rails, driven at both sides (X); a carriage on the bridge (Y); a vertical slide carrying the spindle (Z)
Drive Lead screws, or toothed belts (fast but springier), or rack and pinion for long axes
Spindle 0.8–2 kW, 10,000–24,000 rpm, with a collet for 3–8 mm cutters
Speed Feed 1,000–3,000 mm/min in plywood; each pass no deeper than the cutter's diameter

Step by step:

  1. Build the table as a stiff box with a thick board top; once the router runs, let it surface its own top flat.
  2. Fit the rails — round steel bars in bronze bushes, or angle-iron ways with rollers on Making Ball and Roller Bearings — parallel within 0.1 mm.
  3. Build the gantry as a deep box beam; any sideways bending spoils every cut.
  4. Fit screws and motors, with one motor on each side of a long X axis.
  5. Wire drivers, limit switches and an emergency stop that cuts motor and spindle power directly.
  6. Set up the controller: steps per mm, top speeds, accelerations, and "home".
  7. Test with a pen on paper, then foam, then plywood.

Method 2: Converting a mill and a lathe

The CNC mill

A CNC mill is a milling machine whose table and head are driven by motors under program. The quickest route is to convert a good manual mill:

  1. Check the machine. Scrape or adjust the ways so the table moves smoothly without shake. CNC cannot make a worn machine accurate.
  2. Replace the lead screws with ball screws if you have them, or fit preloaded split bronze nuts to the old screws.
  3. Mount the motors on brackets at the ends of the screws, in place of the handwheels, through flexible couplings or a toothed belt (a 1 : 1 to 2 : 1 reduction gives more torque). For a bench mill, 2–4 N·m steppers or 400–750 W servos.
  4. Add limit switches, an enclosure to catch chips and coolant, and a spindle with speed you can set.

Cutting numbers for high-speed-steel cutters:

Material Cutting speed 10 mm cutter at Feed per tooth
Mild steel 25–30 m/min 800–950 rpm 0.02–0.04 mm
Brass and bronze 50–80 m/min 1,600–2,500 rpm 0.03–0.06 mm
Aluminium 100–150 m/min 3,000–4,800 rpm 0.04–0.08 mm

Spindle speed = cutting speed × 1,000 ÷ (3.14 × cutter diameter in mm). Feed rate = rpm × number of teeth × feed per tooth: a 4-tooth 10 mm cutter in mild steel at 900 rpm and 0.03 mm per tooth feeds at about 110 mm per minute.

The industrial machining centre adds heavy cast iron, ball screws and linear guides, servos with encoders, glass scales measuring the table's true position, a changer holding 20–40 tools, and flood coolant. It holds 0.005–0.01 mm; five-axis machines tilt the work to reach every side in one setting.

The CNC lathe

A CNC lathe drives its carriage (Z) and cross-slide (X) by motors. Convert an engine lathe the same way as the mill: motors on the lead screw and cross-slide screw, with the handwheels removed or declutched. To cut screw threads it needs an encoder on the spindle (Robots and Automation), so the controller can start each pass at the same point on the work and move Z in exact step with the turning — the job change gears did on the manual lathe. CNC lathes cut tapers, spheres and curved profiles that a manual lathe can only make with a forming tool.

Method 3: 3D printing

The clay printer: the easiest first printer

The simplest useful 3D printer pushes clay through a nozzle. It needs no heater, no plastic and no fine temperature control: only the three-axis motion of the router (lighter), and an extruder.

  1. Extruder: a tube 40–60 mm across and 200–300 mm long, filled with clay as soft as thick toothpaste, pushed by a piston on a lead screw turned by a stepper motor (or by compressed air at 2–6 bar, Bellows to Air Compressors). Nozzle 2–4 mm.
  2. Layers 1–2 mm high, about half the nozzle width; speed 10–30 mm per second.
  3. Print pots, tiles, cups, moulds and filters straight onto a board covered with cloth, let them dry slowly, and fire them as in Pottery and The Kiln.

Good or bad: walls stand straight without slumping. If they sag, the clay is too wet or the layers too tall; if the bead tears, it is too dry. The same idea, scaled up with concrete and a gantry, prints house walls (Mortar and Concrete).

The 3D printer (plastic)

The common plastic 3D printer (fused filament fabrication) melts a thin plastic wire, the filament, and lays it down as a bead 0.4 mm wide, layer after layer.

The whole printer (front) Spoolfilament Carriagemoves in XZ lead screwone each sideHeated bed Part The hot end, cut open (about 4 times real size) Drive gearpushes filament Filament1.75 mm, solid Heatsinkkept cool Heat breakthin steel neck Heater30–40 W Temperaturesensor Nozzle0.4 mm hole Fan nozzlemoves layers 0.1–0.3 mm thick; molten plastic shown red
Fig. 3 A plastic 3D printer and its hot end. The extruder gear pushes filament into the hot end, where it melts and is squeezed out of the nozzle. The heat break keeps the melting zone short so the filament does not soften too early.
Part Size or setting
Frame and motion Light steel or aluminium frame; X and Y by toothed belts of 2 mm pitch on 20-tooth pulleys (40 mm a turn: 80 steps per mm with a 200-step motor at 16 microsteps); Z by lead screw
Extruder A toothed drive wheel presses the filament against an idler and pushes it in
Hot end Aluminium heater block with a 30–40 W heating element and a temperature sensor (thermistor); a thin steel heat break tube; a finned heatsink with a fan above
Nozzle Brass, 0.4 mm hole
Bed Flat aluminium or glass plate, heated to 50–100 °C so the first layer sticks
Layers 0.1–0.3 mm high; print speed 40–100 mm per second
Plastic Nozzle Bed Notes
PLA 190–220 °C 50–60 °C Easiest; stiff; made from starch or sugar; softens at about 55 °C
PETG 230–250 °C 70–85 °C Tougher, takes more heat
ABS 230–250 °C 95–110 °C Tough and heat-resistant, but warps; needs an enclosure; fumes

Building one is like building a small, fast, light router, with the extruder in place of the spindle. The heart is the hot end: the plastic must be fully molten in the nozzle but solid in the tube above it, so that the filament acts as a piston. That is the job of the heat break: a stainless-steel tube with a wall under 0.5 mm thick, joining the hot block to the cold heatsink, through which little heat can flow. The controller holds the block's temperature steady to ±2 °C by proportional control (Thermostats and Automatic Control) and must switch off the heater if the temperature reading stops rising or falls off — a sensor that has dropped out of its hole would otherwise let the heater run until the block glows.

Good or bad: print a 20 mm cube. A good printer gives sides within ±0.1 mm, sharp corners, no gaps in the top surface, and layers so bonded that the cube cannot be split by hand. Bad signs are stringy threads between parts (too hot), a lumpy first layer (bed not level or nozzle too high), corners lifting (bed too cool or draughts), and layers that peel apart (too cold).

Strength. A printed part is weakest between layers, at perhaps half the strength of the same plastic moulded. Lay a part on the bed so that the main load runs along the layers, not across them.

Plastic filament

Plastic filament is a plastic wire of even diameter, usually 1.75 mm ±0.05 mm, wound on a spool. Make it with a filament extruder: a steel screw 16–25 mm across turning slowly in a heated barrel (like a meat mincer), which melts plastic pellets or shredded scrap and forces them through a 2 mm die; the strand drops through a warm-water bath and is drawn off by rollers whose speed sets its diameter. Measure it with a micrometer every metre (Precision and Interchangeable Parts). Uneven filament is the commonest cause of bad prints. Old prints and clean single-type plastic scrap can be shredded and re-extruded.

Other ways to build in layers

  • Resin printing: ultraviolet light from a laser or screen hardens liquid resin one layer (0.025–0.1 mm) at a time. Very fine detail; the resins irritate skin.
  • Powder printing: a laser fuses layers of nylon or metal powder — industrial, needing powerful Lasers and inert gas.
  • Wire and arc: an arc-welding torch (Welding) on a gantry lays steel beads 1–2 mm high, layer on layer, building a rough metal part that is then machined. Within reach of a workshop with a CNC gantry and a wire-feed welder.

Copying a part

Measure it with callipers and micrometer (Precision and Interchangeable Parts), noting which faces fit other parts. Draw it (Technical Drawing), allowing for wear: a worn shaft was once larger, a worn hole smaller. Print complex, lightly loaded shapes and patterns for Metal Casting; machine anything that needs strength, fits or threads. Keep the drawing and program: the next copy takes minutes.

How to tell it worked

  • Square and circle test. Mill or draw a 100 mm square and a 100 mm circle. Measure the square's diagonals (they should match within 0.1 mm) and the circle's diameter at four angles. Small steps or flats where the circle crosses the axes show backlash.
  • Repeatability. Put a dial indicator against the table, send the axis away 200 mm and back ten times. The reading should return within 0.01–0.02 mm on a mill.
  • Lost steps. Run a long program, then send the machine home: if it does not meet its limit switches at exactly the same reading, steps are being lost.
  • For printers: the 20 mm cube above.

Note Troubleshooting. Parts come out the wrong size by the same proportion → steps per mm set wrong. Measure and correct. Circles flat at four points, steps in diagonal lines → backlash. Tighten the split nut or add compensation. Cutter chatters and leaves a wavy surface → too little rigidity, too long a cutter, wrong speed. Shorten the tool, slow the spindle, take a lighter cut. Position drifts during a job → stepper losing steps: lower the acceleration or speed, check for binding, raise motor current. Printer nozzle clogs → heat creeping up the heat break; check the heatsink fan; clean with a hot pull of filament.

Dangers

Danger Spinning cutters and moving tables. A CNC machine moves fast and without warning when the program says so. A cutter or chuck catches sleeves, hair and gloves and pulls the hand in. Never wear gloves, loose sleeves or long loose hair near a spindle. Keep doors closed while it runs; fit interlocks and an emergency stop within reach (Robots and Automation). Always run a new program first "in the air", well above the work, with a hand on the stop button.

Danger Fire. 3D printers run heaters unattended for hours. A failed temperature sensor or a loose heater wire can start a fire. The controller must cut the heater on any sensor fault, and the printer must stand on a non-burning surface, away from curtains and paper, with a smoke alarm nearby (Fire Extinguishers and Alarms). Do not leave an untested printer running alone.

  • Broken cutters fly. Wear eye protection, and keep the enclosure shut.
  • Dust and fumes. Routing plywood and fibreboard makes fine dust that harms the lungs; use extraction and a mask. ABS gives off irritating fumes when printed; ventilate. Uncured resins burn skin and cause allergies; wear gloves.
  • Hot parts: hot ends at 200–250 °C and beds at 100 °C burn on contact.

What this unlocks

CNC machines make Precision and Interchangeable Parts cheaply and accurately, cut the moulds for Petrochemicals and Modern Plastics and Metal Casting, the blades of Water Turbines and Hydroelectric Powers and Jet Engines, and the frames of Electric Vehicles. Printers make patterns, moulds, prototypes, medical aids such as Crutches, Prosthetics and Rehabilitation and Hearing Aids, Braille and Daily-Living Aids, and spare parts on demand. With a library of files, a small, distant settlement can keep its machines running.

How it was first done

Thomas Blanchard's copying lathe (1818), later used at the Springfield Armory in Massachusetts, turned irregular gunstocks by following a master. In the late 1940s the American engineer John T. Parsons proposed controlling a mill by computed coordinates to cut helicopter rotor-blade templates, and in 1952 the Servomechanisms Laboratory at MIT demonstrated the first numerically controlled milling machine, reading punched tape. G-code was standardised in the 1960s, and microprocessors brought CNC to ordinary workshops from the 1970s. Hideo Kodama in Japan described layer-by-layer printing with light-hardened resin in 1981; Chuck Hull patented stereolithography in 1986; Carl Deckard developed laser sintering of powder in the 1980s; and Scott Crump invented fused-filament printing in 1989. In 2005 Adrian Bowyer at the University of Bath began the RepRap project, an open-design printer that could print many of its own parts; when the main filament-printing patent expired in 2009, cheap home printers spread around the world.

Source: content/entries/mechanics/cnc-and-3d-printing.md