Why use a Spindle Camera?

CNC Spindle Cameras Part II

Mark Zachmann
Home Wireless
Published in
6 min readApr 1, 2022


Cameras on CNC spindles are essential for two reasons.

  • They provide non-intrusive positioning and measurement at incredible accuracy.
  • They allow you to measure and then fix physical errors such as rails not parallel, axes not at right angles, nonlinear leadscrews, … in software.

Click here for Part 3

The USB Spindle Camera on a Taig Mill

What is a camera for?

A camera is incredible at settings positions and measuring stuff. This also lets a camera (in software) fix physical errors.

Fixing errors is something you do once (or maybe an annual tuneup). Using the camera for positioning and measurement is an every-day thing.

Absolute Positioning

Finding the origin

I use this a lot: instead of physical probing I use the camera to find (0,0) of the workpiece.

  • Compared to mill probing with a probe or mill bit this is incredibly faster. Center the camera on the corner and click zero — or position the probe near the left edge and probe (wait) then position it near the bottom edge and probe (wait). No contest.
  • Compared to CNC probing with a laser it is much more precise. A laser probe is accurate and repeatable to maybe 0.1 inches. The spindle camera on my mill is accurate and repeatable to .0004 inches (optimistically).
  • Only physical stops are comparable and they are usually impractical.

Finding the Origin Again

The camera shines every time I finish a piece and remove it from the CNC and find out either I forgot a cut or a hole is too small. Then I can put the piece back exactly where it was and get the missing cut exactly in the right spot.

For most cutting I use a left hand rail that never moves. I slap the material against the rail, clamp it and then use the camera to tell exactly where X0Y0 is. Takes zero time and perfectly good.

Finding a feature

When I need to widen a hole it’s a simple matter to use the camera to exactly center the spindle on the hole.


Finding a position doesn’t require putting in a special probe or moving the head slowly and carefully. Just move the camera center to near the spot and click.


Use the camera to measure distances, hole sizes, positioning. This is a great way to validate cuts and stock sizes.

Measuring distance for holes center-to-center is easy with a camera to look down the middle.

Sample image of 2 inches of a ruler and a brush hair

Generally I use a 5MP camera with a final resolution of about 1,000–3,000DPI and fix the focus at 3–5 inches depending on machine.

How to Do it

It takes two things.

  • A Streaming Camera — here the Wi-Fi TinyCam in my last article is great. Any other image web source can also work.
sealed WiFi TinyCam — streams a USB spindle camera
  • Software — the SpindleView application lets you use a camera with the CNC for measurement and positioning. It runs in a browser and supports any operating system since it’s written in Javascript.
The Spindle-View App (cropped)
SpindleView App (dark)

A USB Camera

For machinery that generates a lot of electrical noise I use processors that are a distance from the machine along with a cabled camera, usually USB although ethernet has better noise resistance.

Some pictures of a USB camera. This camera is completely sealed and made from aluminum so it is very rigid and it can act as a passive heat sink for the camera module (which otherwise overheats quickly).

A camera mounted on the side of the mill spindle
A camera mounted on a CNC Router

Here are two views of the case (exploded).

The Camera Case Model

Background on Physical Mistakes

tldr; feel free to skip this but it’s instructive

This is a rather long but, I think, interesting and relevant story, so here goes.

Some time ago I bought a 1000lb 3'x4' CNC router to do woodworking with. The rails and carriages are topnotch, and the frame is steel. I was pretty sure I could do a repeatability of about 3 mils. (.003").

Then, I got this call out of the blue from a local fellow asking to borrow some time on the CNC to make two speaker enclosures. Speaker enclosures are very tweaky things made from sheets of MDF and ideal for a CNC. The holes have to be just right for the speaker drivers so they fit snugly with no gaps for sound to reflect from. I’ve made them by hand and they’re hellish. They always use butt joints (no joint — just glue and thick wood).

To save time I cut the enclosure panels in pairs across the CNC — since the enclosures were identical. We got all done and voila — or no — the boxes in fact were different. The left hand box the midrange driver didn’t fit. The right hand box it was loose. The panels between front and back were so different in width that the boxes wouldn’t seal not to mention close. I apologized profusely and spent time manually removing wood to get it all to fit.


I ended up CNC engraving a ruler in hardwood and comparing it to a known reference ruler — and it was way off. Sometimes as much as 1/32", sometimes not.

After much investigating I realized that the rails had been mounted on the carriage imperfectly. Not much off but off. It looked like they had to mill the rail guide in two steps and the two rail segments were at slightly different angles. In a few spots there were noticeable Y dimension errors, probably due to non-parallel rails or microscopic dirt smudges on the rail mounting guide.

How to Fix Physical Mistakes

I tried to move the rails to be perfectly parallel and not 2-segments and failed at both. So instead I decided to fix this in software.

  1. Measure the error very accurately.
  2. Enter correction tables into the CNC controller or alter the Gcode results to allow the CNC to correctly mill/route.

There is really only one effective way to measure the error and that is with a high resolution camera.

The error is caused by the spindle tilting in both dimensions. To capture the error requires looking down the spindle. Measuring motor move accuracy does nothing here.

A nice 5MP camera in a 3d printed box.

So, it seems dumb, but the most accurate approach is to mount a camera on the spindle and have it look at a precise ruler. It sounds barbaric but it’s absolutely right.

I wrote an application that would look at the ruler (with the camera) and figure out the error, move the CNC 1 inch to the right, do it again 35 more times and then store the (X,Y) errors. Then it would do the same in the Y dimension. When completed, it stores the measured errors in a calibration table.

Results of calibrating the CNC (X axis data shown here is 19" of the 3' total)

The above image shows the result of running this process and entering the X axis error terms into the CNC controller. The max error drops from about .031" to about .002". Mean error is even better.

After calibration this sort of thing always works

The inlaid ring boxes above show how well it works. The dark and light pieces match wonderfully yet are cut in different spots of the CNC (and mirrored).


The next article in this series is all about SpindleView.

Click here for Part 3



Mark Zachmann
Home Wireless

Entrepreneur, software architect, electrical engineer. Ex-academic.