CNC microscopy

Intro

I wanted to build a CNC microscope in order to attempt image fairly large objects such leaves, CD-ROMs etc. to reveal detail that can’t be seen with the naked eye.

This required a metallurgical style microscope, which shines light through a microscope objective, onto a sample.

Initial attempt

I initially attempted to fix the microscope in place using a rather large amount of plasticine. This did hold it in place for a little while, until it began to creep and fall through!

To fit the microscope through the tool holder I had to first unscrew the mirror section of the microscope and re-install after.

I switched from plasticine to neoprene tape, which held the microscope in place much more effectively!

To install the microscope I wrapped it with the neoprene tape and unscrewed the CNCs tool holder and gently prised it wide open to install the scope and re-install the screw.

The AmScope imaging sensor was then attached to the C-Mount thread on top of the microscope. It was necessary to rotate the image sensor, to do this I gently unscrewed the screw labelled in the following image and turned the sensor and re-tightened the screws.

An adapter provided by Lapsun was then attached to the RMS thread of the 20x objective and then the objective was screwed into the bottom of the microscope.

The LED light source provided by Lapsun was attached to the light port on the side of the microscope.

Parts and approx. costs

  • Genmitsu 3018-PROVer V2 – CNC machine – £216
  • Lapsun Microscope – Chose Color: 40X-400X Lens – £240
  • Metallurgical Objective – Chose Color: Only 20X Lens – £108
  • AmScope MU1803 18MP USB 3.0 – Used – £120
  • Black neoprene tape – 0.5mm thick, 50mm height – £15
  • Sorbothane discs – used for feet for the CNC machine – £20

Initial imaging

In the following image, you can see the microscope attached to the moveable head of the CNC machine using neoprene tape.

I placed a large cast plastic block onto the CNC stage, so that samples were closer to the microscope (the Z-axis couldn’t reach down far enough for the microscope to image without this).

The Z-axis was at -11.798mm to take the first picture from the microscope of a CD-ROM. I then moved the CNC 11cm to the left.

To get from the image below, to an in-focus image, I had to adjust the Z-axis upwards to -11.488mm. A difference of 0.31mm.

Magnification

The following image is of white paper with 20x magnification objective and using 4x magnification on the microscope dial.

The following image is of white paper with 20x magnification objective and using 1x magnification on the microscope dial – you can see significant vignetting due to poor illumination (I since found this assumption regarding illumination was incorrect, see below for more information).

Turns out I was wrong with initial thoughts on illumination being the issue for the vignetting.

After tightening the screws, which you can see in the image below, more properly. The image looks a lot better!

Sharpest regions from a single microscope image

onilink_ (see their website here – http://ic.onidev.fr/en/index.html) suggested to me the great idea of splitting a single microscope image into multiple ’tiles’ and measuring the sharpness of each tile, using the Laplacian of Gaussian – this works since a CD-ROM has a repeating pattern.

I used the Laplacian function I found from https://github.com/ArduCAM/RaspberryPi/blob/master/Motorized_Focus_Camera/python/Autofocus.py, iterated over tiles and generated a heat-map, which you can see below.

The original image has a shape of (3684, 4912) and the number of tiles is (13, 17).

You can see in the heat-map the far right of the image is the sharpest. I’m just hoping this means the CD-ROM is tilted rather than the microscope!

Using a higher quality 10x CD-ROM image from ZeptoBars (see their site https://zeptobars.com/) and the same code, with a tile size of 150. You can see the area of sharpness is in the centre of the image, which makes more sense.

I made a few adjustments – rotating the light source to try to improve light distribution as well as re-tightening the mirror section.

The following shows experiments with CD-ROM images with a 10x objective, with different magnifications on the microscope dial.

The following shows experiments with CD-ROM images with a 20x objective, with different magnifications on the microscope dial.

Software

I created a very simplistic script using Python which you can find at – https://github.com/anfractuosity/cncmicroscopy to automatically capture images from the AmScope camera from x0,y0, to x1,y1 with arbitrary steps.

You can see in the follow image, the pattern that the software generates for the movement of the CNC microscope whilst moving across a sample and capturing images.

I then made use of Hugin to stitch the resulting images. following the procedure from – https://hugin.sourceforge.io/tutorials/scans/en.shtml

The first image consists of microscope images of a book cover. You can see how the image becomes more out of focus nearer the bottom. I’m going to investigate focus stacking as one means of fixing this.

To Do

  • See if kinematic table means I can move 11cm across CD-ROM without having to adjust Z-axis
  • Try to implement contrast detection auto-focus for microscope
  • Try out focus stacking
  • Try out sorbothane discs
  • Stitch more images using Hugin

Commercial solutions

The following is a list of some commercial solutions:


Leave Comment

Error Please check your entries!