Home Wireless
Published in

Home Wireless

SpindleView CNC Camera Software

Spindle Cameras Part III

So, after showing how to make a sealed Wi-Fi spindle camera (part I), and describing why you want one (part II), this is all about the software.

SpindleView screen capture

Background

The original version of SpindleView was written 10 years ago. It used Microsoft C# and .NET and took 35,000 lines of code, using DirectX to read the video stream and OpenCV to image process. It included a fair amount of AI image processing to set focus, determine camera center, and determine positioning errors by auto-reading a ruler.

That was great, but for the next version I wanted a browser-based application that would work on anything and just needed a streaming image source, rather than a known USB camera. That’s SpindleView.

For V1 this is the bare-bones requirement to be extremely useful. It does no AI stuff to help characterize the hardware and doesn’t do things like measure hole size. That’ll be V2.

Summarize what it does

The system is a >1000dpi down-pointing camera with the ability to a) read the location of a visible feature (such as an edge of stock or the center of a hole) to high precision and b) position the spindle at any pixel on the display.

It works perfectly with (or without) a bit in the collet.

The camera offset restricts the visible range of the system so usually it is mounted as close as possible to the spindle. In the large CNC it is 2" forward. In the micro-mill it is 2 inches to the right of the spindle.

The software works with any mjpg streaming source such as the TinyCam. For now it only supports the Duet3d RepRap because it has a REST Api for GCode.

How to Run It

SpindleView is written in TypeScript (which compiles to JavaScript) using Angular. It runs in a browser but prefers a minimal local web server to host the code. Here’s one way to provide the web server->

Installation

  1. Place all of the SpindleView files in any folder (there are about 7; some have long strange names). I use C:\Git\spindle-view in Windows.
  2. Find Npm (node.js installer) at Download | Node.js (nodejs.org) and install it.
  3. Then install the node.js application http-server in the global namespace by, in a command prompt:
npm install -g http-server

Execution

Start by running http-server in the parent of the spindle-view folder. Using the parent folder as base is helpful with some web servers which reserve root.

This simple web server serves up the SpindleView JavaScript files. All browser security applies so it can’t, for example, read or write a local file without explicit by-file approval.

http-server

Then run any browser and browse to: http://localhost:8080 (the default http-server port). You can use http-server -p80 to use port 80 if it isn’t in use (in Linux these require ‘sudo’).

Once the application is visible click the Settings button and set the URLs for the image stream and the command stream as well as the focus point and resolution.

Demonstration

The below video is moderately watchable and entirely at x1 (normal) speed.

A demo of SpindleView

Options

SpindleView today has three primary sets of options.

  • Reticles — this is an overlay on the image with a target and a ruler of some sort.
  • Zoom — zoom in or out on the image
  • Measurement mode, such Machine or Workspace or Distance.

Actions

  • Move the head to center the camera on the clicked spot.
  • Center the spindle at the camera center spot, as if to drill there.
  • Based on the height of stock move the camera for best focus and distance measurements highest accuracy.

It also shows the CNC location of spots underneath the mouse.
Note: the camera must be fixed focus for precise measurement.

--

--

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.