Warning! Please be sure that you take all the precautions before doing anything. Especially dealing with the trigger input of a DSLR can be dangerous and if you accidentally apply voltage here you may permanently damage your camera. I can not be held responsible for any damage you or your equipment can get, Try at your own risk.
After struggling with CD-ROM trays and old scanners for a while I decided to make a proper Focus Stacking device. All of my previous solutions were either fragile, hard to control, unstable, not automated or sometimes all of it.
My aims for this approach were:
-The operation of the device must be easy and fast
I realized that I dont want to deal with complex menus, submenus or numerical details this time. If I must, I should be able to use it eyes shut. So there wont be any LCD screen this time. But I was still in need of some kind of visualisation. I used LED pushbuttons for visualization of settings. I used a Rotary Encoder module for moving the motor for MarkIN and MarkOut positions and set the delay values.
-It should be mobile and as compact as possible
It should be operated with battery. But later I decided to attach the battery holder outside, since I wont be using Batteries all the time. I used Velcro strips to hold the batteries outside of the case. If there is a AC plug nearby, an 12v adapter can be used instead.
-It should be relatively cheap
No one wants to spend hundreds of dollars to a DIY device. But just to be clear, it is not the cheapest solution, especially if you dont have an access to a 3d printer. Whole system costed to me $130. Nearly half of the cost is linear stage.
Not a step-by-step tutorial
This post is not a step-by-step tutorial on how to build an automated linear stage. I am still working on building a better FocusStacker. This is just a post which I share my experiences. On the other hand, I share every piece of code, workaround and 3d model I created, so it will be a good starting point for someone who wants to build his own FocusStacker.
HOW TO USE FocusStacker
Right now I only tested it with Canon 600d and Nikon d7100 Cameras. But it should be compatible with almost all dslrs except Fuji and Panasonic. First you should get a connector compatible with your camera. I used a cable which I acquired with remote trigger for my Nikon d7100. One end was compatible with the camera and the other end was 2.5mm stereo jack. I converted 2.5mm end to 3.5mm with a cheap $1 converter. For a Canon DSLR I used a regular 3.5mm male-male cable and converted one end to 2.5mm using another cheap converter. You can alternatively make your own cable. I suggest you to take a look at Doc-Diy for a detailed explanation about the camera remote shutter standards.
The rest is a easy six step process:
Set Step Size (1-4)
According to the size of the subject, you need to adjust the minimum distance. If the step size is too large, you may have out of focus areas between each step. If it is too short, you may get hundreds of pictures where only 40 may be sufficient. There is no short answer what should it be, since the sensor size, magnification level and aperture should be taken into account. Best way is to practice and take some test shots before.
To set the step size: Hold down the Rotary Encoders button. All four led buttons will blink on and off. Turn the rotary encoder to adjust the step size between 1-4. Push the Rotary encoder button again to exit. Light will blink again and you are again in the free move mode.
Set Shutter Speed Delay
This is the delay for waiting the camera take the shot. Note that this is not only the shutter speed, this delay should also include saving the image to the memory card and charging time of the flash -if there is any-. This value is not an easy one to calculate. If for example you are shooting with a shutter of 1/125 with a flash, one second of this delay may seem more then enough. But in fact if you dont have an extremely high speed memory card and your flash is not ac powered, you will most definitely miss some shots and/or some of them won’t be illuminated.
I prefer to take a test shot and put a safe estimated value for that. If the subject is dead and I am in my controlled environment, I set it into a reaaally safe value and get a cup of coffee. And take my dog outside of the room -learned from experience-. If I am outside in a sensitive environment and/or my subject is alive, It is kind of a risk management. A waking subject, a summer breeze, a rain drop, your playful dog, a curious ant and many other things can ruin your stack. It is best to take all the shots while you have the chance. If you are using flash, be pretty sure the batteries are fully charged, thus it is the only element that may work perfectly for the first 100 shots and starts missing shots afterwards.
I am planning to make more automated version of this as a future update. It will actually know that the picture is saved to the card and the flash is ready for the next shot before moving for the next shot.
To Set the Shutter Speed: Double click the delay button to go to the Shutter Speed Mode. Delay Led will start to blink. The default duration is 1 second, so it will stay turned off for 1 second and turned on for 1 second. Now you can increase or decrease it using rotary encoder. Since it is a roughly estimated value I first estimate how many seconds I need then I count each blink like cpr. (one-onethousand, two-onethousand, three-onethousand…) Once it is done, use rotary encoders button to return to the free move mode.
Set Cooldown Delay
This is the delay for waiting the vibrations go off caused by the motor movement. I takes place after the motor movement and before shooting. It depends on how sturdy your linear stage and tripod is. I again taking a simple test shot before.
To Set the Cooldown Delay: Hold down the delay button. Delay Led will start to blink. The default duration for cooldown delay is 500 miliseconds (Half second) Use rotary encoder to increase and decrease the duration just like adjusting the shutter speed. Once it is done, use rotary encoders button to return to the free move mode.
Set Mark IN Position
To set Mark In Position: Use the rotary encoder to move the Linear Stage. Go to the position you want to start stacking. Hit the Mark In button. The button’s led will turn on indicating the Mark In Position is set.
Set Mark OUT Position
To set Mark Out Position: Use the rotary encoder to move the Linear Stage. Go to the position you want to finish stacking. Hit the Mark Out button. The button’s led will turn on indicating the Mark Out Position is set.
To Start Stacking: Make sure the Mark In and Mark Out Positions are set. Press the Start Button. The Start LED will turn on and off for the shutter speed delay value, indicating that the shot is in progress.
After the stacking the camera goes back to the last known position. If there was a trouble during the progress, you may adjust things and re-start the same stacking process.
1.Linear Stage (The Rail)
The first and most important part was to find the Rail which is suitable for that purpose. I bought mine from Ebay for $60+shipping. The model is DCI CP3-10. Which I could find very few information about it. Since all of my design took place around the rail, it should be the first thing to deal with. I couldn’t find any blueprint or data sheet about it. I measured it very carefully and modeled all necessary parts in Autodesk Maya. If you can find the same rail (which I highly doubt), you can just download all the data and replicate it. But if you have another Linear stage, every file are provided (except the arduino code) is useless since it won’t probably fit yours.
I guess most Nema 17 bi-directional (4 cable) motor would fit to this design. Although you should definitely check the height of the motor and compare it with the stl files before printing anything.
I used Arduino Nano as the controller. It is small enough and since I was going to make a custom circuit board, I didn’t need all the female headers Arduino Uno and Arduino Mega has. If you never worked with arduino, dont hesitate, because this is probably the easiest part. It is really easy to program an arduino and you do not need any extra programmer to do that. https://www.arduino.cc/ is probably the best place to start learning.
Easy Driver v4.4
As the title says, easy driver is one of the easiest step motor driver. Its size is pretty small and has lots of cool features. Check the Brian Schmalzhaus’ website for more info.
Limit switches and related hardware
My Linear stage had already two optical limit switches pre-installed. This may sound like “I was lucky, I didn’t had to deal with them”.. No I wasnt. It caused me more trouble than I thought, in fact I had several urges just to rip them apart and replace them with mechanical switches or another optical switches. The problem was those optical switches need 12v to operate. With the correct schematic they each output 12v when the tray reaches its limits. Which is enough power to fry my Arduino… Arduino boards accepts + 5v logic as input. If you exceed this limit you probably fry the board. Because of that I had to use a voltage regulator to reduce the voltage input gathered from the limit switches. If you have the chance, use a simple non-optical limit switch or a 5v optical switch and don’t bother with the voltage regulator or any other alternative way to drop down the voltage.
Opto-coupler (opto-isolator) 4N33 (or 4N26)
You can think that it is as a switch which separates two different circuits with different power sources. This way you can control a flow, using another one. I used it to control the camera shutter. Most camera brands (excluding panasonic I presume) have a very simple cable shutter release protocol. There are three wires: Shutter, Focus and Ground. If you connect focus to the ground, it focuses. If you connect shutter to the ground, the camera takes a shot. If it is in bulb mode, the shutter remains closed as long as the shutter and ground are connected. Unfortunately there are lots of different cables types. The cables are even change along with the models.
These are the elements like resistors, diodes, pushbuttons and rotary encoder. I either found them in my toolbox or ordered as a bulk. There is a detailed list and estimated prices (In Turkey) in the shopping-list-focus-stacker-v2 pdf file.
PCB & Perforated Board
I designed the board in Fritzing. Fritzing is very simple to use but very effective. You can download the software from its Fritzing Official Website. I made the button panel with a perforated board. There was actually a problem with the voltage regulator connections. I had to switch the + and – inputs of the voltage regulator with a jumper cable. Voltage regulator is a seperate module so it did not create a major problem. Using this exact design is almost impossible for anyone since I doubt that there are any DCI-CP-10 Linear stages with the same limit and home switches installed. You need to use this as guideline and create your own pcb according to your specific needs.
4.Second Macro Rail
This Second Macro rail is not a must but having it on the rig has big advantages. Our precision Linear Stage has a very short operating distance. Especially if you are on a tripod, it is very useful to have a second rail to adjust the framing. But more importantly, it helps you to have a nice balanced rig. Sometimes macro lens solutions may become very long especially on high magnification. By adjusting the camera position you can move center of the mass, prevent accidents and excessive vibrations.
I modeled the case in Autodesk Maya and 3d printed it on Zortrax M200 with Z-ABS filament. There are 4 sections.
- Camera Connection: The second tray mounts here. I used a m5 bolt and nut to connect two parts. You also need a 1/4 -20 screw (which is a camera mount standard) to fix the camera on it. The lower part is attached to the Linear stage with #10-32 screws. (Which is almost impossible to find in a country which uses metric system)
- Coupling: My Rail uses inch standard and my Nema 17 Stepper has Metric shaft. I couldnt find a proper coupling for that. All of them I tried is either doesnt fit at all, or very loose on one end, making the connection uncentered even it is squeezed with set screws. So I decided making my own. You can find the stl file in the downloads section. One side is 0.482 radius and the other side is 0.495 radius. I filed each end a little after printing to fit on the shafts. You need 2 X m5 Bolts and 2 X m5 set screw for attachment.
- Motor connection: this part connects the motor to the linear stage andalso secures connection with base part. It requires 2x #10-32 screws for the linear stage connection. 2x m5 screws and bolts for the base connection and 2 m3 screws for the motor connection.
- Base: this is the actual part for holding electronic parts. There are 4 parts in it: case, tray, tray connection and strap holders. Case is both connected to the motor part and to the linear stage. Requires 4x m4 bolts and nuts for stage connection. At the same time Tray connection part is secured to the case with the same bolts. Tray slides through to the case and secured to it with 2 x m5 screws and bolts. You may nee
d to file the edges of the tray after printing in order to make it fit to the slit on the case.
Error Report: Why my setup triggers Canon DSLRs but not Nikon DSLRs? While testing with a Canon 600D, the camera connection was perfectly working. But I couldnt make it work with my Nikon D7100 first. The reason was that to trigger Canons, you only need to short Tip and Ground. But to trigger Nikons, you need to short both Tip and Ring to the ground at the same time. So simply soldering a wire between tip and sleeve inputs of input
socket worked. Instead permanently soldering, I soldered two jumper cables at the and and made them dis-connectable if in case I ever need to use it with a Canon DSLR.
After putting them all together and made a few test shots, I decided to make an improvement with this rig. With this setup, it is a little bit hard to set delays. Especially for the shutter speed. You have to put much extra room then necessary to ensure the cameras shutter duration does not exceed the shutter delay you set for the rig. To overcome that, I made a Light Reader to read the DSLRs “Disk is busy” light. This way I would be able to make sure the shutter is done and the image safely saved to the flash before going to the next step. It actually worked very well, but it also created more cables to deal with, started to consume more power and most importantly became useless with any camera other then mine. I decided to make it optional but changed my mind, since I wanted to move to my next build, Focus Stacker v3.
Next post will be about Focus Stacker v3