Once in a while, we need to check electronics components, PCBs or solder parts of our prototypes. Being (mainly) a software house, we cannot afford professional lab equipment to do that. Luckily, the advent of easy prototyping technologies like 3D printers and access to flexible camera modules let's us build our own systems quickly.
For an introductory lecture on sensors I wanted to show students a close-up of a few components for better explanation. Lacking a macro camera, so I decided to hack a few parts together based on a cheap USB camera.
Resistor codes hard to read? Not any more...
Camera module and lens adapter
We got a few ELP 5 Megapixel cameras which you can source from Amazon.com (they do ship to Europe...), Alibaba and others. Cameras come focused at roughly 1m+, for macro operation you simply shift the lens out a few mm. The lens on our module has 13.6mm focal length and sits at the outer edge of the focusable area, making it fall out of the on-board tubing for our working range.
With some optics, when you losen the screw you will have to apply considerable force to turn the lens, as the holding screw has been turned into the m12 thread, partially deforming the thread. After a few turns it should get easier; you might want to repair badly bruised portions by bending metal back into place with an sharp blade.
A short search on thingiverse revealed a few M12 adapters, but they did not suit our needs, but Thing #83754 by jasonwebb served as a good start for our own adapter that can be snapped on the camera cylinder of the board cam. Our M12 adapter is not using the M12 thread model but is a simpler design based on cylinders - I found that the 0.3mm layers of my printer are course enough to tightly hold the lens in place. After printing, a sharp knife and the diameter measurement side of my caliper quickly eliminated printing artefacts. Take an old lens and screw it in and out a few times, it should sit tight and eventually cut a thread into the plastic. If your fit is too loose you might wrap the lens with teflon tape.
You can adjust it to different lens holder geometries and printer characteristics using the variables at the top of the file.
Macro camera inspecting an Arduino Uno board
Depending on the focal plane selected, objects can be inspected at very small distance, like the bonding wires of SMD LEDs in the gallery below.