GreatLight CNC Machining Factory logo
CNC Machining
Rapid Prototyping
Materials
Industries
News
About GL

Get Instant Quote

DIY CNC Setup

How to Calibrate Z Axis DIY CNC Machine

Z-axis error shows up as wrong depth of cut, scrap parts and broken end mills. This guide is for hobby builders and small-shop machinists running GRBL, Mach3 or LinuxCNC on a benchtop router or mill. After reading it you can measure real Z travel, set steps/mm, find backlash and decide when the machine is the limit, not the setup.

Steps/mm setupBacklash checkTool length offsetHoming repeatability
how to calibrate z axis diy cnc machine
Key takeaways

What matters most

Fix mechanics firstBacklash over 0.025 mm comes from the nut, coupler or bearing, not from software values.
Tune steps/mm with long movesCommand 100 mm, measure with a dial indicator, then correct the number once.
Separate offset from travelTool length offset sets zero; steps/mm sets distance. Calibrate travel before offsets.
Check repeatability before cuttingTen homing cycles should land inside 0.01 mm on a healthy benchtop machine.
Why it drifts

What Z-axis calibration actually controls

When you command a 10.000 mm plunge, the spindle should move exactly 10.000 mm. Calibration makes the physical travel match the commanded travel. On a DIY machine the controller counts motor steps, so it needs to know how many steps equal 1 mm of Z movement. Get that number wrong and every depth is wrong by the same percentage.

Z error is easy to spot. Pockets come out shallow, the second pass cuts air, or a finishing pass digs 0.3 mm too deep and snaps a 3 mm end mill. The error is not random. It scales with commanded distance, which is why long moves expose it better than short ones.

Three things cause most of the error: wrong steps/mm, mechanical backlash, and a Z axis that is not square to the table. A fourth, leadscrew pitch error, shows up on long travels and cheap trapezoidal screws. Work through them in that order.

Before you touch any numbers, the machine has to be mechanically sound. A loose coupler or a worn anti-backlash nut cannot be fixed in firmware. Software compensation hides the symptom and makes the next calibration harder to read.

  • 1
    Steps/mmConverts motor steps into real distance. Wrong value scales every depth error.
  • 2
    BacklashLost motion when Z reverses direction. Shows up as different down and up readings.
  • 3
    SquaringZ not perpendicular to the table tilts the cutter, so depth varies across the part.
Preparation

Pre-calibration checklist for a DIY CNC machine

Give the machine 5 to 10 minutes of jogging through its full Z travel before measuring. This normalizes temperature and spreads lubricant on the screw and ways. A cold ballscrew and a warm one do not read the same on a dial indicator.

Mount a dial indicator with 0.01 mm resolution on the table, tip touching the bottom of the spindle nose or a gauge block. The magnetic base must sit on the table, not on the gantry, or you measure the machine moving relative to itself. Rigidity of the indicator mount matters more than its brand.

Check that the Z coupling screws are tight and the anti-backlash nut is adjusted. Push the spindle nose up and down by hand with the motors energized. Any visible movement means you have a mechanical problem to solve first.

Write down the current steps/mm value for Z from your controller before changing anything. GRBL stores it in $102, Mach3 in the motor tuning screen, LinuxCNC in the INI file. Keep the old number so you can go back if a measurement goes wrong.

  • 1
    Warm up 5–10 minJog full Z travel so screw and ways reach steady temperature.
  • 2
    Indicator on the tableMeasure spindle movement relative to the table, not the gantry.
  • 3
    Record the old valueSave $102, motor tuning or INI entry before editing.
Common mistakes

Errors that send DIY builders in circles

The most common mistake is measuring against the gantry instead of the table. If the indicator base moves with the Z axis, you are measuring almost nothing. Mount the base on the table or on a rigid block clamped to it.

The second is calibrating with a short move. A 10 mm command on a machine with 0.05 mm of backlash gives a reading dominated by lost motion, not by steps/mm. Use 100 mm or more, and always approach the measuring point from the same direction.

The third is correcting steps/mm to compensate for backlash. That fixes nothing. The depth will be right in one direction and wrong in the other, and the error doubles on a reversal. Fix the nut first, then tune the number.

Finally, check the Z column for squareness after any crash. A column that is 0.1 mm out of square over 200 mm tilts the cutter and produces tapered walls. No steps/mm value can correct that geometry.

  • 1
    Indicator base on the tableMeasuring relative to the gantry hides the real error.
  • 2
    Use a 100 mm moveShort moves amplify backlash and reading noise.
  • 3
    Never hide backlash in steps/mmIt breaks in both directions and doubles on reversal.
Limits

When the DIY machine is the limit

A benchtop router with a 2 mm pitch trapezoidal screw and a 0.05 mm backlash nut will hold depth within roughly 0.05–0.1 mm on a good day. That is fine for signage, jigs and enclosures. It is not enough for mating bores, bearing seats or press-fit features.

The sign is repeatability, not accuracy. If ten homing cycles spread 0.03 mm and a test pocket varies 0.08 mm corner to corner, the hardware has reached its ceiling. Further tuning of steps/mm just moves the error around.

At that point the part usually needs a different machine class. Production 3-axis and 5-axis machining centers hold ±0.005 mm with thermal compensation and full inspection. GreatLight runs 127 high-precision CNC machines across three plants, with 16 simultaneous 5-axis centers and a maximum processing size of 4,000 mm.

For low-volume work, the practical route is to keep the DIY machine for fixtures and prototypes and send tolerance-critical parts out. Uploads stay confidential, an NDA is available on request, and quotation with free DFM analysis comes back within 12 hours.

  • 1
    DIY ceilingRoughly 0.05–0.1 mm depth on a light benchtop machine.
  • 2
    Production floor±0.005 mm on 3-axis and 5-axis machining centers.
  • 3
    Split the workPrototype in-house, outsource tolerance-critical features.
Procedure

Step-by-step Z-axis calibration

Do these in order. Repeat step 3 after any mechanical repair.

  • 1
    1. Zero the indicatorJog Z down until the spindle nose touches the indicator tip. Set the indicator to zero and note the controller position. This is your reference point for all later moves.
  • 2
    2. Command a long moveFrom MDI, command G91 G0 Z-100. Use at least 100 mm so a 0.02 mm reading error stays small. Short 10 mm moves hide the error you are trying to find.
  • 3
    3. Read and correct steps/mmRead the indicator, for example -99.62 mm. New value = old value × (commanded ÷ measured). If old was 400, new = 400 × (100 ÷ 99.62) = 401.5. Enter it, home, and repeat until the error is under 0.01 mm over 100 mm.
  • 4
    4. Measure backlashCommand G91 G0 Z-10, then G91 G0 Z+10. The indicator should return to zero. A positive reading on return is backlash. Above 0.025 mm, adjust the anti-backlash nut or replace the coupler before using software compensation.
  • 5
    5. Check homing repeatabilityHome the machine ten times and record the Z position after each cycle. Spread should stay inside 0.01 mm. Larger spread points to a flexing switch mount or electrical noise on the limit input.
  • 6
    6. Set tool length offsetsAfter travel is correct, touch off each tool on a gauge block or probe. Store the offset in the tool table. Offsets are only meaningful once steps/mm and backlash are settled.
  • 7
    7. Cut a test pocketFace a scrap block, then cut a 5 mm deep pocket at 0.5 mm per pass. Measure depth at four corners. Variation above 0.05 mm means the Z column is not square to the table.
Diagnosis

Symptom to cause to action

Use the reading pattern to pick the fix, not the other way round.

SymptomLikely causeAction
Depth error scales with distanceWrong steps/mmRecalculate from a 100 mm move
Error only after Z reversesBacklash in nut or couplerAdjust nut, replace coupler
Depth varies across one partZ column not squareShim and re-tram the column
Homing lands in different spotsFlexing switch mountRigid bracket, shield signal
Error grows through the dayThermal growth in screwWarm up, then re-zero
Fine pitch, coarse pitch mismatchLeadscrew pitch errorUse screw mapping or accept the band

Calibrate the axis, or move the part

Tune steps/mm, backlash and squaring in that order, and a benchtop DIY machine will hold depth within about 0.05 mm. When the part needs ±0.005 mm, send it to a machining center instead of chasing the last few thousandths.

FAQs

Z-axis calibration questions

How often should I recalibrate the Z axis?

Check steps/mm once a month on a hobby machine and after any crash, coupler change or controller reflash. Homing repeatability is worth checking weekly because it catches a loosening switch bracket before it ruins a job.

If you cut the same material daily, a quick 100 mm verification before a critical part costs two minutes.

Can I fix backlash in software instead of mechanically?

Software backlash compensation exists in LinuxCNC and some Mach3 builds, but it only works when the mechanical play is small and stable. Above 0.025 mm the compensation becomes unreliable because the lost motion varies with load and direction.

Fix the anti-backlash nut or replace the coupler first. Then use compensation only for the last few thousandths.

What steps/mm value should I start with?

Calculate it from the hardware: steps per revolution divided by screw lead, multiplied by any microstepping and reduction. A 200-step motor at 8 microsteps on a 2 mm lead screw starts at 800 steps/mm.

Treat that as a starting point only. Measure and correct it, because belt stretch and coupler slip change the real number.

Why does my Z depth change between morning and afternoon?

Thermal growth. A steel or aluminium screw expands as the shop warms, so the same commanded move covers a slightly different distance. On a 300 mm Z screw a 5 °C rise can shift depth by several hundredths of a millimeter.

Run a 5 to 10 minute warm-up cycle and re-zero on the workpiece after the machine settles.

Should I calibrate Z before or after X and Y?

Do all three in one session, but fix Z first if your parts are failing on depth. X and Y errors usually show as size and position errors, while Z errors show as wrong depth of cut, which breaks tools faster.

Use the same 100 mm move method on each axis.

Does a tool setter remove the need to calibrate?

No. A tool setter measures tool length offsets, which set the zero point. It cannot correct steps/mm or backlash, because those are properties of the axis itself.

Calibrate the axis travel first, then trust the setter for offsets.

Send us the parts your DIY machine cannot hold

Upload a drawing and we return a quotation with free DFM analysis within 12 hours, with 100% inspection before shipment.

12-hour quote±0.005 mm tolerance100% inspection

Follow

More machining notes

We publish setup notes, tooling trials and inspection data from the factory floor.

FacebookTikTokYouTubeLinkedInInstagramThreadsPinterest

Trusted by engineers and manufacturers worldwide

Tesla Ford Motor Company BYD Auto Denso Magna International Boeing Airbus Medtronic KUKA FANUC