<HOME
<Workshop Stuff
<Proxxon Mini Drill and Stuff
<Electronics

USB Microscope for Proxxon Mini Drill

So I have a "Dremel tool", a mini drill made by Proxxon. And I have a modified drill stand, a compound table, and various other stuff for it. And one of the things I use it for is drilling circuit boards that I've etched myself. I mostly make one-off electronic devices, quite often on Veroboard, but sometimes a proper PCB becomes necessary—but I very rarely get it professionally made, as a one-sided board is usually sufficient, and easy enough (and faster) do DIY, especially with the right tools, i.e. an exposure box and a drill. (If I'm too lazy to drill the board, I'll use SMD components instead.)

But for precisely drilling holes, I find myself needing some kind of magnifying apparatus. I do have an MBS-9 stereo microscope, but if I mounted that onto the small and light weight Proxxon drill stand, it would likely fall over. I could keep the microscope on its own separate stand, but then its alignment with the drill would shift all the time. But by chance I came across a cheap USB microscope on an online auction site, and realized that's what I need! I already had a Raspberry Pi with a 24-inch monitor on the same desk, so not much else was needed—only a way to mount the microscope onto the drill stand, and some software.

Once the mechanical attachment was sorted, I wanted adjustable crosshairs on the live video from the microscope, so I could drill a test hole, align the crosshairs to that, and then use the crosshairs for accurate drilling alignment from there onwards. I ended up writing a short Bash script which uses zmqsend to command FFmpeg/FFplay. See the software section below.

Mounting the microscope onto the drill stand

The microscope is supposedly Fuj:Tech branded (and it says "20×300 microscope" on the sticker, whatever that means), but it looks like the exact same microscope is sold under various brand names (e.g. Toolcraft, Newbrand, AmScope, etc). According to the "dmesg" command, it is identified as a "UVC 1.00 device Digital microscope" manufactured by Sonix Technology Co., Ltd. The "v4l2-ctl --all -d /dev/video0" command reports its resolution to be a whopping 2592×1944, which is more than any display I currently own! The "microscope" is basically a webcam, with an LED ring light around its lens, and the ability to focus very, very close. It will focus from some 2 cm distance (the length of the clear plastic protrusion around its lens) or perhaps even closer, all the way to infinity—so it could even be used as an ordinary webcam, although its field of view is a rather narrow 10 degrees or so. And this means I can place it at any distance from the drill bit, and will still be able to focus. The "magnification" depends on the distance, and at some 5 cm or so, it seems about perfect for drilling a PCB. The microscope can also be placed further away, and its "magnification" can be compensated by doing a "digital zoom", i.e. by cropping and scaling the image—the camera's resolution is certainly high enough to do that!

The thing came with its own stand, which can be coarsely adjusted by releasing a locking screw and moving the microscope assembly up or down. The microscope itself is held in a ring shaped clamp with a pretty nice rack-and-pinion focuser just like in real microscopes, except that it's all flimsy plastic. It might do for observing where the drill bit is coming down to the PCB, but if I were to set up crosshairs on my monitor, and use that to target the drill bit, the flimsy microscope holder would assure the bit would hit anywhere but its intended target.

I was ordering some audio stuff from Thomann, and I happened to notice they have small ball heads for attaching to microphone stands—who knows what their real purpose is, people mostly seem to use them to convert a microphone stand into a camera stand... The On-Stage CM01 (on the left in the photo) seemed suitable for aiming a light-weight microscope like this one. I also found a suitable clamp (a Global Truss F14TA "Half Coupler", on the right) that would attach to the 20 mm diameter column of my Proxxon MB 200 drill stand. Finally, I needed some kind of arm to bring the ball head to a suitable distance from the stand's column, and settled on a K&M 23550 Microphone Stereo Bar (middle), meant for mounting two microphones side-by-side to make stereo recordings, with an adjustable distance between them. This will do nicely to place the ball head at an adjustable distance from the clamp, and its own 3/8" screws fit the CM01 with the help of a 3/8" to 5/8"-27 adapter (oh FFS, why are there so many alternative threads in this industry???). Not hard to DIY either, but milling the long groove would take an eternity with my home tools.

These are all made of metal, and ought to stay in place nicely enough once properly tightened. I also ordered a couple of clamping nuts that can be tightened by hand without needing a wrench. One of the original wing nuts of the "half coupler" is already replaced with a more comfortable M6 clamping nut in the photo. Later I also replaced the M5 nut for tightening the clamp onto the vertical shaft. K&M makes suitable clamping nuts in both sizes, their product Nos are 01-93-250-55 (M5) and 01-83-260-55 (M6).

Now there was only the question of mounting the microscope onto the ball head, which has a standard 1/4" camera mount thread. The microscope itself does not have a threaded hole (of course—although I'd like to ask the manufacturer, why in hell not???). While searching for various kinds of clamps in Thomann's catalog, I happened to notice a Stairville Bracket 36/30, which probably is a spare part for a telescoping pole or tripod leg or something. Half of it has an inner diameter of 36 mm, which happens to be the microscope's outer diameter exactly! The other half is narrower, with an inner diameter of 30 mm, which would have to be cut off.

The bracket has two threaded holes in it (as you can see in the photo), one presumably for a finger screw to tighten the telescoping inner tube in its position, the other one containing a smaller set screw, presumably to keep the bracket in place at the end of the outer tube. These threaded holes are on a flat at the side of the tubular bracket. My idea was to cut away the narrower part, then drill out the smaller hole (the one with the set screw) and make a 1/4" camera thread in that. With the microscope fitted inside the tubular section somehow, it could then be cleanly attached to the ball head.

(The confused baby moose did not come included with the bracket—he is a resident here, his name is Hansu, and he belongs to my wife Katja.)

...or so I thought. As it turned out, the narrower set screw hole was just too wide to re-thread into a 1/4"... But I found the bigger hole was actually a 3/8"—and I had 3/8" to 1/4" thread adapters in shelf! (And no, the narrower set screw hole was NOT 1/4" as-is!!!) There's also a 43/36 version of the bracket, where that larger hole—usable as-is with the adapter—is in the part with the 36 mm inner diameter, and had I only known, of course I would have chosen that version!!! Why in &#@@% don't they specify the threads in their sales blurb??? (Ok, I must learn a couple of new swear words!)

So, now I could either order the 43/36 bracket (not too expensive) and pay its additional postage fees (more expensive than the bracket itself, which is annoying as *$^@$ — I definitely need to learn a couple of new swear words), or... Cut out the narrower part of the tube, but retain its flat side section with the threaded hole! Ugly as §$₻ (see the photo), but it does the job I wanted it to do! Perhaps next time I order stuff from Thomann, I'll order the 43/36 bracket, just to make this thing more beautiful. (Or not... Aluminum is a pain to cut with a cut-off wheel. But if you want to do the same thing, get the 43/36 and a 3/8"-1/4" adapter!)

Just to be clear, the threaded hole in the protruding part of the flat is the 3/8" which I now want to use, whereas the threaded hole on the side of the round part is the one that I can't use as-is, nor re-thread into a 1/4", as I had planned. And I don't have a 3/8" tap—even the 1/4" tap was hard enough to come by here in Europe...

The bracket's 36 mm inner diameter tube turned out to be just slightly too narrow for the microscope to fit all the way in after all, but that was quickly fixed using the mini drill and a sanding drum.

To attach the microscope, I obtained a couple of M4 set screws, and made six threaded holes in the holder, three at each end of the tube. (The set screws are already in place in the above photo as well, in case you were wondering.) One of the screws must not be tightened, as it's on the side of the focus adjustment ring, but even so, this attachment is more than stable enough (more stable, I expect, than if the microscope's plastic body did have a 1/4" camera threaded hole in its side), and the microscope can be removed if ever necessary. (I also considered epoxying it in place, but that seemed like too permanent a solution.) Et voilà, here's the finished product with the microscope inside. And, now that the microscope is fitted inside, the adapter isn't even that ugly!

And just to be clear, the 3/8" hole that the ball head will attach to (with the aid of a 3/8"-to-1/4" adapter) is the one on the right in the photo.

These bits and pieces actually cost more in total than what I paid for the microscope itself (albeit second hand), but the final result is certainly worth it. It is reasonably sturdy, and easy enough to position with sufficient accuracy. The adjustments for focus and illumination are both accessible, of course. Once adjusted, I can drill an individual alignment hole, and adjust the on-screen crosshairs in software to accurately target the rest of the holes.

Here is a photo of the microscope installed onto the drill stand, and here's a side view where you may actually see how it's attached. The entire assembly is easily removed when not in use—I don't want to needlessly coat the microscope's objective lens with wood dust, for example, if I'm not trying to carve anything with microscopic precision. Here's another photo of the assembly, removed from the drill stand, where you can see its entire structure. Removal is a matter of simply loosening a wing nut and opening the clamp that holds the thing on the drill stand's column.

This thing is sturdy enough to keep its position once tightened, and it doesn't even vibrate when the drill is running. But with the small, cheap ball head, its adjustment is too coarse to perfectly align a crosshairs pattern to the drill bit, thus the need to adjust the crosshairs in software. I was able to implement that easily enough with a short Bash script (see below).

Software

The microscope, like any cheap webcam, is recognized under Linux without any special drivers. A live image can be streamed from it to the local screen with any v4l2 aware software, most of which are of course available in Raspberry Pi OS, such as MPlayer, Cheese, Guvcview or FFmpeg/FFplay. (Just be sure the software requests an mjpeg stream from the device, instead of individual still frames, otherwise the frame rate will be dismal.) The latter is a real Swiss Army Knife for video streams, and can be used to zoom, crop, rotate, overlay crosshairs, and even correct the perspective. This being a command-line program, the crosshairs adjustment is not terribly convenient as-is, but I found an easy way to make them adjustable interactively using the arrow keys.

The FFplay documentation suggests there is a way to change the filter parameters (such as the position of the crosshairs) of a running FFmpeg or FFplay instance from another program. The documentation is not all too clear on this, but after quite a bit of googling I found that it can be achieved with a program called zmqsend. This was not included pre-built in the default Raspberry Pi OS, but it was straightforward enough to compile. It is included with the FFmpeg sources, and can be compiled on its own like so:

  sudo apt-get install libzmq3-dev libavutil-dev
  git clone https://github.com/FFmpeg/FFmpeg.git
  cd FFmpeg
  ./configure
  cd tools
  gcc -o zmqsend zmqsend.c -I.. `pkg-config --libs --cflags libzmq libavutil`
  sudo cp zmqsend /usr/local/bin/
With this critical tool now installed, I was able to cobble together the following Bash script: microscope.sh. To set it up, you should: Once the microscope and script are both set up, you can start drilling a PCB: Here's what it looks like in use. The recently drilled hole is exactly where the crosshairs suggested it would be!

Note that any interaction with the script must be done with the keyboard focus in the original terminal window, not in the video window! Yes, it's crude, but it works well enough for my needs. (By all means, let me know if you find a better way.) You can exit the script with Q, but if you happen to exit FFplay first (e.g. by pressing Q in the video window), you may have to kill the script with Ctrl-C instead. (I don't know why, though. But it has no other adverse effects, so who cares.)

The script itself should be mostly self-explanatory. The "Parsed_rotate_1" and "Parsed_drawgrid_4" in the commands given to zmqsend can be found by running the FFplay command with the "-loglevel debug" option. (You can redirect stderr to a file to peruse at your leisure.) The "rotate" and "drawgrid" obviously are the names of the filters being changed, and the "1" and "4" seem to stem from them being the first and fourth filters in the video filter chain after the zmq filter itself. If you need to add other video filters with interactive adjustment of parameters, you can do so, if the video filters support it for the parameters in question (for example, running the command "ffplay -h filter=rotate" outputs a list of parameters, with something like "..FV.....T." following the "angle" and "a" parameters (they are synonyms, actually)—the "T" means the parameter can be changed at runtime, whereas the other parameters missing the "T" cannot), and if the video filters aren't buggy in the way "crop" seems to be.

A serious word of warning!

Wear eye protection! Even if you're not directly eyeballing the drill at 5 cm distance, the high-speed drill can fling debris all around, the drill bit can shatter, and all kinds of things can go wrong and take out an unprotected eyeball. And the first time may be all it takes—no guaranteed second chances!


Antti J. Niskanen <uuki@iki.fi>