Introduction: Focus (z) Drive for Focus Stacking Photomicrography
I wanted to automate data collection during focus stacking imaging on my microscope. If you are not familiar with the technique I have included the figure "Focus Stacking" (above) to help explain the process. Briefly, photos are taken through a range of focal planes (z) and then the in-focus sections of the image are merged together. On my setup, I have a Fujifilm FinePix S4800 shooting images through an eye piece on the trinocular mount (adapted by PVC parts) of a Zeiss Standard WL microscope. The image quality was good (see the mite on a blueberry), but for focus stacking I had to simultaneously hold the shutter down (for multiple shots) while manually moving the focus knob after each image. I found a way to lock the shutter button on the camera, but I wanted to design a method to automatically change the focus.
Step 1: Connecting the Stepper Motor
I used a Small Reduction Stepper Motor - 12VDC 32-Step 1/16 Gearing ordered from Adafruit. I really didn't know how much torque it was going to require to move my focus knob, but I figured that the 12V stepper (with the pull-in torque of 120-400 gF*cm, depending of voltage) would be more versatile than the 5V version (140-170 gF*cm).
For more information on torque of these steppers see: https://grahamwideman.wikispaces.com/Motors-+28BYJ-48+Stepper+motor+notes
Once my stepper arrived, I had to couple the stepper to the microscope. Similar to mounting the camera, I accomplished this by a trip to the PVC isle at the hardware store. I used the combination of a 1/2" PVC coupling, 1/2" plug (drilled to accommodate spacer), and a Nylon spacer 1 x 1/2". I used a micrometer to measure the diameter of the focus knob and the shaft of the stepper motor; and then wondered around Home Depot until I found a reasonable combination. I then drilled, tapped holes and installed set-screws to hold everything together. I used a foam ring to slip the 1/2" coupling over the focus knob so I didn't scrape up my microscope.
I'm still working on the stand for the stepper motor, but I'm still deciding if I want the stepper to be in a stand or secured to the body of the microscope. On my scope the fine focus actually increases the distance between the body and the base, so attaching to the body may make more sense.
Step 2: Camera Communication
I wanted to have the stepper motor turn a specific amount each time the camera took a picture. As I mentioned before, I'm using a Fujifilm FinePix S4800 camera which does not have a method for external control. I could have hacked the shutter button on the camera and made this project a lot easier, but I was informed by my wife that any dismantling or alteration of her camera would not be tolerated. In order to avoid the second image above, I decided that I would have my device "listen" for the fake shutter sound from the camera then turn the stepper motor.
I did have an electret microphone I salvaged from a Logitech webcam which I had repurposed for the original microscope camera (see photo above and complete system image on the last step), but found the resolution too low. Since I could not remove the microphone amplifier from the Logitech board without ruining it, I had to build my own. I used the schematic above (edited from: https://www.sparkfun.com/products/9964) to create an amplified microphone on its own circuit board (some resistors on underside pictured above), so I could place it near the camera speaker to prevent unwanted triggering.
Step 3: Creating the Controller
At this point I had a stepper motor that I wanted to control and an input (Microphone) that would trigger the event. I thought through the process and decided that I wanted to include:
An input to adjust the step size (using a potentiometer),
An input to return the focus to zero* (push button switch),
An output (alarm) to signal a step and out-of-range* (Piezo),
Once I had all the parts, I assembled the circuit on an Arduino Starter Kit (a wonderful kit to learn Arduino programming). The stepper motor was driven by a Dual H-Bridge from Adafruit (L293D, for schematic see https://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors). Once I had the circuit assembled, I turned to the programming. Basically, I took the Sound Level Sketch for Adafruit Microphone Amplifier and modified it to know where the stepper is located, set the step size by measuring an input, and then listen for a loud enough signal. When the signal is heard, the controller turns the motor and gives a beep (as long as the stepper does not go out of range, if so the device will just give the over range alarm*). Through the testing phase I found that I did need to use 12V to get enough torque to turn the focus knob of my microscope. Once I got everything working correctly I put everything on a circuit board, connected it to an Arduino Pro Mini and placed it into a case (actually it’s the packaging for the FDTI that I needed to program the Arduino Pro Mini). Final image shows the complete system, including the illumination source used for reflective pseudo-darkfield imaging.
*My microscope has a limited range on the fine focus (20 turns or 2mm); I don’t want the system to stress the focus knob or stepper motor. Therefore, I designed the system to work within the range of the fine focus (<10,000 steps, remember this stepper has 32 steps/turn and 1/16th gearing). I also wanted the focus to change in one direction, always against gravity, so imaging starts at the bottom (0), goes up until the limit is reached and returns to 0 when the push button is activated.
Participated in the
First Time Author Contest
7 years ago
Clever solution, using the fake shutter sound and a microphone!
Fyi most DSLR cameras (and some point and shoot cameras) have an electronic remote shutter release available as an option. That would make for a simpler setup--just tie into the remote's button circuit; send a pulse to click the shutter and then turn the stepper.
Reply 7 years ago
I spent some time looking for a remote shutter for this particular camera, with no avail. The camera has good resolution (16 MP), but lacks most of the bells and whistles, such as external control. I tried to elucidate this in the text. This camera wouldn't be my first choice, but I'm a firm believer in working with what you have for economical and environmental reasons. Reduce, reuse and recycle!
7 years ago on Introduction
Very cool project. Thank you for sharing how you did this.