Project tutorial
Focus Stacking Rail Made From a Microscope Focus Block

Focus Stacking Rail Made From a Microscope Focus Block © GPL3+

This is a project to make a focus stacking rail from a piece cut out of an old microscope.

  • 9 respects

Components and supplies

About this project

Rail Hardware

This project is one part of the larger project describing my attempts to photograph fern gametophytes by focus stacking.

This is the rail hardware setup. The focus block, on which the camera rests, is a block from a Nikon Optiphot or Labophot microscope. It was sawn out of the microscope by Doc.Al of the forum. He also drilled holes in it, which have allowed me to fasten it to the board. The board is a piece of discarded kitchen worktop.

You can see the focus knob under the camera. It allows the top section of the block to be moved back and forth. There is a coarse and fine focus knob. On the other side of the focus block there are identical focus knobs.

Switching now to the other side - below, you can also see the stepper motor, and the gearing that allows it to drive the fine focus control. The focusing can be driven by a Raspberry Pi or an Arduino, as shown in the two photographs below. The red board is a stepper motor shield.

We provide instructions on how to drive the system using either an Arduino or a Raspberry Pi. Please see one or other of these pages for the wiring illustrations, depending on which hardware you are using. Summary tables of the wiring for both systems are provided below, and will make more sense if used in conjunction with the illustrations on the two pages mentioned above.


Stepper motor wiring

The stepper motor is a 4 wire stepper motor, with two circuits. In order to wire it up correctly we checked the wires in pairs with a voltage meter to see which pairs produced a voltage. We designated these pair “A” and pair “B”, which were then wired up as shown in the Big Easy Driver wiring table above.

Raspberry Pi setup:

Arduino setup:

The stepper motor is an RS Pro Hybrid Stepper Motor 0.9°, 44 Ncm, 2.8 V, 1.68 A, 4-wire motor, which was bought from I intentionally brought quite a beefy motor in the hope that it would be less likely to burn out. It is also very square in the body, which helps to brace it against the board.

Below is a close-up view of the gearing. The gear wheels were bought from and then the centres were drilled out or cut out with a hacksaw blade. The plastic gears were very soft, and easy to cut.

Below, in close-up, is the driver board that allows the Raspberry Pi or Arduino to drive the stepper motor. The stepper motor is a 4-wire bipolar stepper motor, and requires an H-bridge chip to drive it. The board brought a number of specific advantages over just using an H-bridge and breadboard. The motor is able to turn a single complete turn of its spindle in 400 steps, but with the driver board this can be changed to 16 steps. The current reaching the motor can also be controlled so that the motor does not burn out.

Tim devised a system whereby the Raspberry Pi or Arduino could also send a signal to fire the shutter of the camera automatically. He took apart a 3rd-party infra red Canon camera remote control and wired it up to the Raspberry Pi or Arduino terminals. This meant that he could write a single programme to operate the stepper motor, and fire the shutter of the camera alternately. We have tried this and it works well.

Below is a photograph of the infra red remote control with its new wiring.

This is the other side. The wires are attached firmly to the board using the glue from a hot glue gun.

Tim has carried out some experiments on the travel that is produced in the focus block using this stepper motor setup. He figured out that a single step of the stepper motor moves the top part of the focus block 1/128th of a μm (micro metre), which is very very good for our purposes. So for 128 steps of the stepper motor we have movement of 1 micron. The movement is very smooth indeed. The depth of field of the optics with the Mitutoyo lens is about 20 microns. In the end I found that 17 microns was enough and this more rapid progress was better for stopping the bright lights from drying out the subject. To achieve a 17 micron step we needed to use 128 x 17 steps of the stepper motor.

List of Hardware Bits for the Rail

  • Bit of discarded worktop (£0)
  • Bit of sawn off Nikon Optiphot or Labophot microscope (£0 this time, but I was very lucky)
  • Cogs from Maplin (about £15)
  • Screws (£1 MacKays hardware shop in Cambridge)
  • Sheet of metal (£1.37 from MacKays hardware shop in Cambridge)
  • Raspberry Pi B (£34.50) or Arduino Uno (£17.30)
  • Canon Remote Control RC-06 (£16.99) or amazon version (£6.99)
  • Jumper wires 12v power supply transformer plug to drive motor via Raspberry Pi or Arduino.
  • "Big Easy Driver" Stepper motor control board with voltage adjustment (£22)
  • Soldering equipment Hot glue gun

Arduino version also requires:

USB cable to connect to laptop

Raspberry Pi version also requires:

  • SD card
  • Wireless dongle




Similar projects you might like

Driving a Focus Stacking Rail Using an Arduino

Project tutorial by Jennifer Deegan

  • 1 comment
  • 8 respects

Focus Stacking System For Gametophyte Ferns

Project tutorial by Jennifer Deegan

  • 5 respects

Rory the Robot Plant

Project tutorial by AhmedAzouz

  • 35 respects

Light Meter To Measure Plant Growth Conditions

Project tutorial by Jennifer Deegan

  • 9 respects

Arduino LIDAR

Project tutorial by abhinav

  • 62 respects

Smart Garden

Project showcase by patel Dipen

  • 89 respects
Add projectSign up / Login