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.
The source for SpindleView is now available on Github.
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
- 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.
- Find Npm (node.js installer) at Download | Node.js (nodejs.org) and install it.
- Then install the node.js application http-server in the global namespace by, in a command prompt:
npm install -g http-server
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.
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.
The below video is moderately watchable and entirely at x1 (normal) speed.
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.
- 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.