Home Wireless
Published in

Home Wireless

How to use a Spindle Camera and SpindleView

CNC Spindle Cameras Part IV

Here I discuss how to most effectively use SpindleView, the underlying physics, and various tricks.

SpindleView v1

How to get Accurate Readings

There are a lot of places where errors propagate in an application like this. So, it’s easy to be disappointed with the app accuracy unless you do a few things.

Error Sources:

  • Lens Linearity — Inexpensive lenses have distortions and mounting issues.
  • Resolution off — You can spend forever re-measuring resolution or just leave it really close and never touch it. I know where I fall in that.
  • Machine Position drift — based on limit switch and other physical things that change a tiny bit
  • Nonlinear motor systems — motor systems have imperfections in gearing and belt stretching and …

So, start off assuming these errors and then… use the center of the image as the only measuring spot.

In other words, if you want to know the coordinates of a visible spot move the camera to be right overhead — so the center is at the spot. At this spot resolution, focus height, and lens linearity have zero effect and your accuracy is exemplary. The only terribly important variable is Spindle Offset here.

How to Check Vise Placement with a Camera

I move my vise a lot for different sized stock. Each time the question comes up as to whether it’s lined up perfectly. The fixture plate is pretty tight but overtightening it causes the bed to warp so it’s possible it can shift.

Anyway, in just a few seconds it’s easy to see the (fairly small) vise placement error. Because the camera doesn’t move here (at all) the overall accuracy is near 2400dpi (or .0004").

Scan a vise for parallel to X

Installation and Setup

Tighten the Camera

Make absolutely sure the camera won’t slip or slide during production. Specific Z axis movement isn’t a huge deal but rotating or displacing the camera is real bad. While the machine moves no one cares what’s on the video but at rest it’s important the camera be at a known X,Y offset from the spindle and Z offset from the stock.

Try hard to ensure the camera is pointing straight down before you tighten it. Look at a crosshatch sheet of paper and ensure the grid looks as parallel as the lens allows. Perhaps elongate one screw hole to allow a small amount of rotation of the mount at install.

Setup

You will be sad if you don’t first define how the camera works in the Settings. That’s the button at the top-left of the window.

Settings are stored in the web cache so they may disappear when you clear the cache. Please read the Save As discussion below. It’s odd.

Calibration Order

Set the Camera URL first, so there is an image to use for the rest of the steps. Then,…

Set the Camera Center to the image size/2 as a starting point. Then:

  1. Set the Focus Height
  2. Determine the Camera Center (optional)
  3. Set the Resolution
  4. Find the Spindle Distance
  5. Save the options

Focus Height

More important than getting focus height correct (where focus is best) is using the exact same height consistently. So, always click the Set Focus button and set material height as close as possible to actual for best results.

To set focus height:

  1. Move the spindle to where you can see the bed (or fixture plate) with the camera.
  2. Raise/lower the height until the bed/plate is in perfect focus.
  3. Look at the machine Z position and that’s what should be the Focus Height value.

Camera Center

This is defined in pixels offset from the top-left corner. Using display size/2 is a fine compromise. The reticles will all show this center and the given distance to spindle is based on this value.

To set this exactly move the head up and down from the focus point. One dot will not move XY on-screen as you do this. That’s the display center. If you are very wrong (like 1/5th the display) then it is important to get the focus height correct or you may introduce inaccuracy.

Spindle Distance

The distance from the defined camera center to the spindle center. This is critical.

A spindle spot made by hand-rotating a 1/8" mill-drill at .01" depth. The blue splotch is a sharpie line.

To measure this

  1. Move to a convenient drill point and drill a tiny hole, perhaps just the tip of a drill rotated by hand, or… place a rectangular stock in the vise and probe one corner of it.
  2. Set X,Y workspace zero (0,0) here for reference.
  3. Set the program Spindle Distance to (0,0) in Settings, as a help.
  4. Move the CNC so that the center of the camera is over the center of the drilled hole or the corner of the stock.
  5. The value shown in the Center’s position display (in Workspace coordinate mode) is the negative Spindle Distance.
  6. Change the Spindle Distance and watch the Center display — it should change to (0,0) Workspace.

Resolution

This is the resolution of the camera (in the center) when it is focus height above the measured stock.

To measure the resolution:

  1. Place a ruler horizontally on the stock. You can check horizontal by moving X back and forth while watching the camera.
  2. Use the “Move to Click” button or the CNC controller move buttons to get the camera exactly on an Inch marker (or something easy). When resolution is wrong the moves will not be accurate.
  3. Set the location display mode to distance.
  4. Move the mouse to either side and see if when the mouse is 1/2" away the distance is shown as 1/2".
  5. Change the resolution (use (reading/actual reading) * old-resolution) until the distance shown is accurate. The farther away you go from the center the more error a lens will introduce so don’t overdo the range.
  6. To test, use the “Move to Click” button. If the resolution is correct the move will be right. If the resolution is too low then it will move too far.

Camera URL

Typically, with mjpeg-streamer this would be camera-url/?action=stream which is an mjpg stream of images. For me that’s http://zerocam1.local/?action=stream.

It needs to be an acceptable source for an http img object.

Camera Rotation

In case the camera is mounted upside down or sideways, use the option here to make it right-side-up.

Machine URL

This is the address where gcode is pumped. Currently only Duet3d Reprap is supported (supply the controller site URL) but other machines are easily also supported if they have any communications.

Saving Options

This is very strange because it’s a web site. It can only really download so you must pick an existing file (ignore the button saying Open, it won’t open the file) and it will write file-name(1) like typical download of a same name.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mark Zachmann

Mark Zachmann

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