Current Microscope Setup with the DIY scanning stage hardware and software.

TURNING AN 30+ YEAR OLD MICROSCOPE INTO A MORE MODERN MICROSCOPE.

THE PROCESS OF MAKING A CUSTOM MADE MICROSCOPE SCANNING STAGE.

In the beginning of this year (2016) I bought a new microscope, but not just one. I bought the Nikon TMD Inverted DIC microscope a micro-scope made in the mid 1980’s. The decision for this microscope was made after doing quite some research. Research on different types of light microscopes that were able to compete with my “wish list” (DIC, camera mounting port, good optics, good brand, proved techniques, locally available and within budget) But why did I end up choosing for this particular microscope thats was made in the mid 1980's?

The Images from the original Nikon TMD Inverted microscope. More technical information can be found in these PDF’s: Standard TMD, DIC and Epi Fluorescence.

If you followed the four links above, you may have seen that this microscope was specially made for photomicrography on 35mm (full-frame) camera’s and had a second view port for other (film) camera’s. Something that is I think still very unique these days, making it a “perfect candidate” to connect a digital full frame camera.

The Diaphot microscope was designed for photo micrography, with photographic capability built into the optical system. The optical design utilises a built-in binocular body, inclined at 45 degrees, and only one reflecting surface in the microscope body to reduce reflections and glare and maximise image contrast.

What also makes is special is that it it comes with DIC optics (something that is very hard to get your hands on for a microscope in this “league” and budget). Next to that it was locally available at a trustworthy vendor. So I decided to go there to check it out, since you can only make such a final decision by actually using and testing it in a real life situation. Testing it with your own slides, and see if it would really be the ideal new workhorse.

From the moment I walked into the shop seeing the microscope, I was sold! What a beautiful piece of equipment! And I It got even more excited when I started using it. The ergonomics were perfect (especially cause it was inverted which gave me a lot of working space), it was very stable due its heavy duty materials and the optics and were stunning compared with my other microscope. I was sold by its “power” and buying the microscope was only one step away, I only needed to check one more important thing; Will it take better images than my other microscope that I’m currently using.

So I grabbed my Canon 5D MKIII camera and the Nikon to Canon mount converters, but unfortunately the mount converters did not fit. This was because the photo mount assembly on the microscope, had a special overhang and mount addition to it, to be able to hold the older (analog) Nikon cameras camera better in place. Since I’m a Canon user the camera could not be connected without any of these mount converters, therefore I was not able test the optical quality of the microscope by taking images.

Desperate as I was, (since I really wanted to buy this beauty) I started looking at some available options and solutions regarding the mount. After a few minutes I found out that the photo mounting assembly could be fully removed from the microscopes body, leaving only a big cap by removing some screws! This would mean that I could put and hold the camera tightly in front of the gap of the microscope to see if it would give me some results.

Within the next few minutes the photo mount assembly of the microscope was removed. Meaning I could manually hold the Canon camera in front of the big round gap that was left in the microscopes body. It payed of, the first images came out crystal clear. It suppressed me that a “dirty fix” like this gave me already such bright and sharp images.

Would this mean that if I buy a canon lens mount and attach it to the microscope’s body, that the problem would be fixed? Or could I in some way get rid of the overhang and mount additions on the Nikon microscope photo mount assembly?

Eventually I went for the last option since the vendor agreed to help out and mill away the steel overhang / mount additions on the lathe. This irreversible procedure would not compromise the mount in any way, plus in this way it was also posable to connect other digital camera’s. Meaning it would have “more value” and keeping its original parts, with only some limited adjustments that would improve its use.

Left: Crop from an image on the web showing the original mount — Right: the milled version on my microscope mount.

Since I did not expect to write a full post on this, good imagery documentation is not always available, so images of the microscopes original state and process made along the way is not always available. But I will try to explain all as good as I can, so others can maybe go and take the same road with this or other microscopes.

On the left in the image you see quite some black overhang and support on the ring around the mount. On the right you see that the Nikon mount is removed and that the black overhang and support is milled away until the constriction. This was needed so it could fit any other camera mount in the future. In this case the big holes are there to remove the mount assembly from the microscope. The smaller screw holes are there to connect any lens mount.

After milling away the “overhang” and reconnecting it back to the microscope we reattached the Nikon to Canon mount adapter. “Surprisingly” it was now posable to connect the Canon 5D MK III to the microscope. It was now time to take some “real images” and see its power projected on a digital full frame camera, Stunning micrographs popped up on the screen of my laptop one after another without any problems.

At that point my wish list was (almost) complete DIC optics √, working camera mounting √, good overal optics √, inverted √, well known microscope type and brand √, Good ergonomics , locally available √, well tested √ and within budget √.

It had all I could wish for and extra, accept for a scanning stage. But as most microscope owners know getting a scanning stage that can be precisely controlled by a computer to take images at every step is hard to come by. If it exists or is available for your (type of) microscope its often very expensive and not within our budget.

But since it had “all” I wanted and I expected that the scanning stage was not an option by far in my budget or available second hand. I decided to buy it and mod & tweak it later on myself. Since I had the strong belive that this would work with this microscope and its standard stage.

Now a few months later I’m proudly presenting my first finished version of the microscope additions, mods and its digital photo scanning stage addition. Since there were some hardware and software iterations along the road in the past months, I will only show you the “final” working result and used parts for now. Below you will find some more information about final results and some information about why I need a digital photo scanning stage and how it works, together with some future plants for it.

WHAT IS A (DIGITAL PHOTO) SCANNING STAGE.

The goals I had with this new setup and its modifications is to get more functions, a better work flow, time reduction, higher resolution pictures and a smaller error mage in the images. To do this I needed to build a digital photo scanning stage.

A (digitally controlled photo) scanning stage is a microscope stage were its hardware can be controlled by software to get consistent precision movements in terms of a few microns or a time. By being able to control with such precision you can generate high resolution images. With each step made, images are taken using high power magnifications objectives to index (photograph) the specimen on the slide. This ensures the highest detail able to be captured, but because you are zoomed in so far its not posable to see the whole specimen. Therefore you need to “scan” the specimen in a comprehensive grid until you covered the whole specimen.

A simple example of a comprehensive grid imaging example, having 10 X axis rows and 10 Y axis column resulting in 100 images that need to be stitched together.

This is the most simple way not including any redundancy into the imaging of the specimen. For example if you would bump against foto number 43 and 76 you would have 2 big blurry parts with no “error correction” therefore I calculated 1/3 of overlap on each side so every part of the specimen will be photographed and seen on 3 diffrent images.

To do this you need to control its hardware with software the fancier you make and program the software, the more options and error correction you will have on controlling the hardware. In my case it only controls the step motors on the X and Y axis of the table and triggers the camera accordingly.

Depending on the magnification of the objective you are using you can choose a “calibrated” step size that fits the lens magnification. Calibrated means that we know how many steps the step motor has to take to get a fully new part of the specimen in frame. By dividing these step numbers into 3 on the X and also the Y axis you have a calibrated “error corrected” preset that can capture your specimens in a way that it has every part 3 times captured on the X axis and 3 times on the Y axis.

MORE INFO ABOUT THE HARDWARE PROCESS.

During the process of modding the microscope to give it a digital scanning stage, I came along some other “problems” that I wanted to fix.

First of all since its such a big and strong heavy duty microscope its hard to travel with it and some parts can easily be replaced such as the second “side camera port” for something that is 3D printed out of ABS. The “side camera port” is about 400–450 grams and is not used and because of the hole it always is more vulnerable for dust. So It was time to combine this with the micro controller box that along the way found its place in the side port. Not only saving weight (300 -350 grams) but also preventing dust of getting in and having in the same time a nice place to have the electronics to control the digital scanning stage.

Next to that the specimen stage plate and clip were old and worn so this could also use an upgrade so it would become a two in one stage plate with specimen clip together + it would also be able to rotate free.

Another problem was the worn out socket for the lamp in the “illumination post” every time the cord was in the socket it was wobbling everywhere and it was not properly hold by the socket any more. So also this needed a good fix.

But lets start with the digital scanning stage additions before I show you the other small modifications.

General note: all parts are custom designed by me in Autodesk fusion 360 and printed on my Ultimaker2+ 3D printer with black ABS Ultimaker filament. Most of the parts are printed at 0.1 layer hight with 25 to 100% infill with a 0.4mm nozzle using the Cura slicer.

Other parts that are used next to the 3D printed parts will be described in detail below.

(THE MAKING OF) THE DIGITAL SCANNING STAGE AND OTHER MODIFICATIONS TO THE MICROSCOPE:

Below you can find more information on the parts that are added to the microscope including the parts for the Digital photography scanning stage.

The Control board & enclosure:
Along the way I figured out that this would be the prefect spot to put al the electronics needed for the controls of the step motors and camera. Below you see the two 3d render previews the enclosure. The enclosure should hold the Makeblock Orion control board, 2 step motor drivers and a Me shutter units to control the step drivers and camera trough the software.

Autodesk Fusion 360 — Render of the “Controller enclosing”
“Controller enclosing” placed in the old second camera viewing port.

Item list: 
- The 2–3D printed parts
- 4 x M4 bolts (come with the second viewing port of microscope) 
- 4 x M3 bolts 10mm
- 6 x m4 bolts 6mm
- 1 x
Makeblock orion main board 
- 2 x Step motor driver of Makeblock
- 1 x Me shutter Makeblock
- 1 x micro usb cable
- 1 x 12v 2A power adapter
- 2 x 10mm shrink wrap sleeves of 1 meter
- 3 x RJ-45 jack cables

Step motor bracket for X axis:
To control the X axis of the stage, I needed to create a clamp that would hold the step motor (otherwise it would turn itself instead of the shaft) to directly drive the old knob used to control the X axis manually. By removing the knob I was able to connect the drive shaft to the step motor with a Shaft Coupling Coupler. Doing this would result in turning the inner drive shaft in the the tube of the X and Y controls.

Autodesk Fusion 360 — Render of the “step motor connector for the X stage control”
“Step motor connected to the x stage knob”

Item list: 
- The 3–3D printed parts
- 4 x M3 bolts (come with the step motor) 
- 4 x M4 bolts 6mm
- 2 x M3 bolts 10mm
- 2 x M3 nuts hexa
- 1 x step motor 
- 1 x Shaft Coupling Coupler

Step motor bracket for Y axis:
Just like the X axis the Y axis also needed to be controlled. Only this was a bit harder since it would become quite hard for me to control both X and Y from the same “handle”. Since the “handle” which controls both X and Y has a inner and outer shaft / axis controlled by a knob to drive the table.

So I choose not to use the standard gear / knobs used in manual control for the Y axis. To solve this I added the step motor to a fixed part of the table that would move along in a fixed position with the Y or X axis. By doing this I was able to “push and pull” the table with a time belt along its Y axis feely, no matter where the table would move to.

Basically the bracket of step motor and pulley were attached to the part of the stage that was fixed. Driving the time belt to the made part of the table called the Gear Pulley Bracket that will be explained further bellow. Between this bracket of the Y axis step motor and the Gear Pulley Bracket the time belt would be a connection to the moving part of the Y table, “pushing or pulling” the table along the time belt connector.

I hope this explanation is clear enough, since it’s quite complicated sometimes to explain in words how it works, so please scroll down to see some of the images attached that hopefully make the principle more clear.

Autodesk Fusion 360 — Render of the “step motor connector for the Y stage control”
Step motor connected to stage table and the time belt with gear.

Item list: 
- The 3D printed part
- 4 x M3 bolts (come with the step motor) 
- 3 x M3 bolts 10mm
- 1 x step motor
- 1 x MXL Timing Belt
- 1 x Pulley 18T MXL

Stage time belt connector:
To move the stage I needed to connect the time belt to the Y moving part of the stage. Therefore I removed some of the original parts and placed a time belt connecter under the stage that would then squeeze in the time belt between a “clamping Mechanism”. With this clamp the time belt movement would be directly moving the stage when the time belt is being moved into small steps by the Y step motor.

Autodesk Fusion 360 — Render of the “Stage time belt connector”
Stage time belt connector connected to the stage and time belt.

Item list: 
- The 2 3D printed parts
- 2 x M2 bolts (Phillips screw) 6mm length
- 2 x M4 bolts (the 2 originals of the microscope stage) 
- 1 x time belt joiner

Gear Pulley Bracket:
To control the Y axis it was necessary to get a “gear pulley bracket on the end of the microscope stage to keep the timing belt running from the Y axis stepper motor, to to this I needed to connect it right after the macro and micro knob that normally controls the microscope stage manually. The extension beyond the table was necessary, to be able to get the full movement of the table.

Autodesk Fusion 360 — Render of the “Gear Pulley Bracket”
Images of the current situation and attachment to the table.

Item list: 
- The 3D printed part
- 2 x M3 bolts (originaly from stage assembely) 
- 1 x 50mm long axis of 4mm ø
- 1 x Pulley 18T MXL Timing Belt

Stage plate and specimen clip :
The microscope “originally” came with no specimen clip that would fit nicely with it, and I always struggled with the one I had. The one that I had did not work cause the stage plate that came with the microscope was a few mm to high and the connection points for the screws did not match the holes in the stage. Resulting in some weird problems such as not keeping the slides nicely in place. Also the clearance of objectives did not always go without problems since if to long they would hit the plate at the bottom if it was not centred right in the middle of the stage plate opening. So it needed to be bigger not a 20mmm diameter opening but more like 60mm large diameter opening.

So this means the stage plate should be re designed in a way it would be exactly as high as the top of the stage, it should hold the glass slides without the use of an extra specimen clip, have more clearance for the objectives to switch in the revolver, plus it would be a big advantage if the plate with the specimen could turn 360 degrees. These ideas and specs resulted in the following stage plate.

The only thing that I will do in the next update, is to make the extruded lowered part for the glass slide with less tolerance so it will fit in exact so there is no chance of moving during the scanning process.

Autodesk Fusion 360 — Render of the “stage plate with specimen slide holder”
Stage specimen plate clip in place.

Lamp socket fix:
Since the lamp socket was quit heavily used in the last 30+ years and quite worn out, I wanted to create a socket where you can put the power plug in without the plug moving or hanging weirdly resulting in failure over time. The design and solution I came to was as follow.

Autodesk Fusion 360 — Render of the “Lamp socket fix”
Lamp cable into stable socket connector.

Item list: 
- The 3D printed part
- 1 x M3 bolt 25mm

THE FINAL WORKING RESULT OF THE MICROSCOPES HARDWARE DIGITAL SCANNING STAGE:

Below you will see four images that will give you a “360” view of the final result of the microscope.

Complete “360” view on the final result of the modded microscope.

I’m very happy about this result and the current “final” state its in. But knowing my self, I already have some new ideas on the addition of hardware and software, but more about this can be found below.

For now it’s time to show you the “power” of the microscope and its scanning table software and hardware. Below you will find a short movie that shows the hardware moving controlled by the custom made software on the laptop that stands next to it.

Some of the hardware movements controlled by the software. Some part are with big steps 150–300 steps at a time and others are 1 to 25 steps at a time making it way more accurate.

HOW DOES THE SOFT- AND HARD- WARE WORK?

To make it “simple”, there are two parts that make the scanning stage work like it does now.

1.) Main board:
The main board and the connected hardware; this main board is programmed with several functions (I will go into more detail about this later) with the use of the Arduino IDE programmer. The code language used in this platform is C/C++. This board is then connected trough usb with the laptop.

2.) Software:
There is a code running on the laptop that communicates with the main bord trough a serial port over usb. This code is written in the Processing IDE (that uses JAVA). Because the main board is programmed to run several functions, we now only have to say in the software which function we want to run and how we want to run it (declare the values of the variables). To make this easy we use a GUI that displays the functions and the variables that can be set. Once these are set and “uploaded” you can control the microscope with the settings used.

A screenshot of the GUI that communicates with the control board trough the serial port.

Above you see a screen shot of the GUI. I tried to keep this piece of software and GUI as simple as I could, but in the future I hope to tweak and update it and give more functions (more about this later).

The first step when the software is opened is to select the lens you are going to use. The larger the enlargement of the objective the smaller calibrated steps it wil take. The size of the steps are visible after selecting the lens, in the box STEP SIZE X or STEP SIZE Y. Accordingly you can also manually change them if they don’t suit your way of examining your specimen.

When you are examining your specimens or when you want to “guide” the table to a specific location you can simply use your keyboards arrow keys. the way you would normally do to navigate trough for example a game. Left is left and right, up and down are mapped down in the same way you would normally expect. You can ether press the keys once to have 1 accurate step or hold it for continues movement.

After you have examined your specimen and choose the part you want to image find your start location.

When choosing your start location t is important to pick a spot that is say a 3 frames on the X and Y axis away from the top left corner of the area you want to index.

Once you have chosen your start location (top left) you have to “guess” the amount of frames you think you would need to index the specimen at the enlargement you are using. If you know you need +/10 frames on the X and 10 on the Y you can fill this into the boxes under “GRID SIZE CONTROLS” and set it to FRAMES X: 10 and FRAMES Y: 10. After this you can press apply and the software wil “upload” the data to the board.

To be sure the area that you want to capture is fully in the frame you can press the TEST SEQUENCE button. In this case it wil start a quick movement of 10 frames down -> 10 frames to the right -> 10 frames up -> 10 frames to the left. In other words it will “draw” a outline around your specimen area. When you watched thought the oculars, or payed attention to the screen you find out if the area was to small or to big. If to big or to small you can change the values accordingly. Once you found the correct grid size you can re apply you settings and press the START button. Now the software will start to capture the amount of frames set in the X and Y boxes.

THE SCANNING STAGE IN PROGRESS.

Reading the above might not give you a full idea of how this then works when used, so I made a screen recording while I’m using the scanning stage. Below in the video you see the proces of photographing a crystalised tear with an total enlargement of 250X (10X objective 10X oculair 2.5X Camera), resulting in the final result of a 300 MP ( 17364 x 17364 pixels) photo of a crystalised tear.

Video showing a screen recording of the software in use and the progress during the capturing of the images when the DIY scanning stage is in use. This is a accelerated version of the +/- 25–35minute process. ( The images are taken with a 10x objective resulting with the camera in a total enlargement of 250X).

The scanning / capturing time of this image was +/- 25 minutes for the , resulting in 350 images shot in RAW format captured with my Canon 5D MKIIII. With a total movement of 2,7MM in the X and Y direction (+/-150um per step).

*Time of 25 minutes can be reduced since the time is now standard set to wait for 1,5 second before taking an image, to stabilise the table after movement. Then giving the camera time to do and exposure up to 1 second, and then 1 second to do the next movement. So in total every step / frame will take 4 seconds making it a total time of 4x 250 =23,3 minutes.

During the capturing the images are automatically downloaded to a folder cropped and saved as a .TIFF. So directly after all the images are shot you can start your post process of stitching and rendering your images together with your Favorite stitching / panorama software (in my case Autopano Giga ) which then takes around 30–40 minutes for a images of this size to complete (loading, pre- render, render and export).

Screenshot of the 350 images pre-rendered by Autopano Giga, showing a great RMS score.

Subtotal time: Time spent on creating a 300MP image without other photoshop processing is about +/- 60 minutes.

After this render its often needed to spend some time to create the finalised crystalised tear image since I want them to be perfect. Depending on the stitching quality and small errors this takes about 30–60 minutes. You can find the final image below, or by following this link to see it in 300+ MP.

Total time : spent on creating a 300MP image with minor corrections, fixes, color corrections, level adjustments and background replacement in photoshop is about +/- 80 minutes.


Software summery:

1.) EOS utility 
- Directly controlling the camera
- Directly downloading the images from the camera connected trough USB. 
- Live view to during the process to see what its doing.

*While the EOS software is directly downloading the images through the tethering usb connection a program in the background scans the folder and converts the images to .TIFF and crops them into 1:1 aspect ratio and saves them in a _cropped_ folder. The coping is done to eliminate the vignetting and unsharp characteristics of the objectives in the microscope.

2.) Autopano Giga
- To load in the images that were directly downloaded to a folder on the computer with EOS utility.
- Index, process and render out the stitched file created from the images imported.

3.) Photoshop CS 
- To finalise the rendered image of Autopano Giga by checking and removing / editing the image so it can be finalised.

FUTURE PLANS AND ADDITIONS TO THE HARD- AND SOFT -WARE OF THE SCANNING STAGE.

Since my mind often is full of new ideas when I’m not even ready with the frist version I decided this time to first present you this version and later extent its features software and hardware wise. So what will I be adding in the future?

Hardware:
Direct input towards the main board making it able to stand alone working without a laptop.

1.) Adding a touch screen display so I don’t need to use the GUI and software on laptop. 
2.) Adding a joystick to smoothly control the movements instead of using laptops keyboard 
3.) Adding a Accelerometer that is checking for vibrations. If there would be a spike, due a bump against the table where the microscope is standing on it will stop and roll back and re take previous image.
4.) Adding a endstop switch so the software knows its 0 position. 
5.) SD card for logging the steps so it always knows what it did and can roll back accordingly. 
6.) Finetuning the time belt and gear settings to be even more accurate
7.) Adding a Kinect camera or other like camera to track objects and movements under the microscope.
8.) Z axis step motor

Software:
Some of the hardware options above require new software or software additions to make it work.

1.) Rewriting the software for the main board so it can also be used in stand alone mode
2.) Adding joystick support
3.) Adding error handeling support for the Accelerometer when triggered
4.) Adding end stop switch 0 position and “re calibration” of the scanning stage before it starts. And when the progress is done return back home, or to its starting position. 
5.) Read out log plot positions 
6.) More step motor control options that make several ways of moving posable:
6b.) tracking an object that is viewed with the 2nd camera (Kinect) and keeping it centred.
6c.) Smoother transitions due ease- in and out functions.
6d.) Drawing shapes that are converted into movements of the table so if you film a slide you can set dynamic shapes and patterns with according ease functions. 
7.) Start / stop / pause button
8.) Elapsed time, shutter count and % progress 
9.) Control of the Z axis so the images can also be stacked. 
10.) Camera exposure time
11.) Waiting time between images.

So there is still some development going on and I would love to give you some more updates soon. The same goes for a calibration test, currently I’m waiting for a 0.01mm stage micrometer calibration objective glass to exactly measure the finest steps I’m able to take with this setup.

If you have any questions, suggestions or feedback regarding this article, then please feel free to contact me.

Twitter | Facebook | Instagram


If you enjoyed reading this, please click “Recommend” below.
This will help to share the story with others.