Focus stacking assistant for EOS cameras Guide
Here is a build log of mini-variant of this device. [/EDIT]
One of my favorite shooting techniques is focus stacking. Many pictures on Circuits@Home site are made using this technique. I use Helicon Focus for post processing and even though this program has camera control built-in, it obviously requires a computer close to the object of shooting. In order to be able to control my camera in the field, I wanted to replace a laptop with simple lightweight controller able to move focus of camera lens and take pictures between steps. In this article, I will show how to build one from Arduino, USB Host Shield and several small parts.
Finished circuit can be seen on the title picture. As you may already have guessed, the sequence of shots used to produce the picture has been made with the very unit depicted on it. Focus stacking assistant is controlled by 3 buttons: first moves focus towards the camera, second moves focus away from the camera, third button starts shooting sequence. Long press on focus move button sets “near” of “far” points, after both points are set shooting sequence can be run – it always starts from “near” point. The sequence can be stopped at any time by pressing on any of focus move buttons. It is important to understand that after a point is set, subsequent focus moves must be performed with focus move buttons only.
The controller can also be set to “free run” mode. Long press on third button starts shooting sequence from current lens position (which in this case can be set by hand using lens’ focusing ring) towards infinity and will run indefinitely. It can be stopped at any moment by pressing on a focus move button.
A single LED shows states of the controller. Short blink once a second indicates “idle” state – controller is connected to the camera, PTP session is open. Continuous frequent blinking means some kind of an error – most likely, controller not being able to initialize the camera or open PTP session. 3 short blinks act as a feedback to long press, focus move, etc. Additionally, more detailed diagnostic is output to Arduino serial console.
Even while connected to the camera, Focus Stacking Assistant allows camera buttons to function as usual. For example, camera LCD can be turned on and zoom area can be moved to the area of interest and then zoomed in to help focusing. Shooting mode, as well as aperture/shutter speed/ISO can be changed. It is also possible to access or erase images on the card and perform other manipulations as necessary.
Let’s now talk about how building the assistant. Links to Arduino board and USB Host Shield has been given at the beginning of the article, refer to USB Host Shield hardware manual for connection instructions. The protoshield is also handy, I prefer ones from Adafruit, maybe I’m just lucky but I’m always receiving blue ones which match nicely with Arduino and host shield. You will also need some wire, a LED, current-limiting resistor (Adafruit sells all of that), and 3-4 tactile switches. The connections can be figured out from title picture, here is “formal” schematic just in case.
The control software is hosted on gitHub. It depends on USB Host Shield library r.2.0, PTP library r.2.0 and Quantum Leaps state machine framework AKA QP (the code uses standard Arduino variant of QP from Quantum Leaps site, not the modification made for PTP library examples!). The state machine design has been made using QM modeling tool and model file is included in the repo for your viewing pleasure.
The code has been extensively tested with Canon 5D Mark II and XSi cameras, it should work with any Canon DSLR with LiveView function. The code is in beta, it is a little slow and maximum exposure time is around 1-2 sec depending on the camera and lens model. In coming weeks I’m going to build and test Mini variant of the circuit and write code for Nikon DSLRs. As always, stay tuned for the updates and if you build this circuit, please share your experience in the comments!
121 comments to Focus stacking assistant for EOS cameras
Hi, I am Charles your local Home Tech and Gadget Expert. I’ve been fascinated with electricity for as long as I can remember. I grew up in an old home in a rural setting, so the quality and continuity of our electrical service were spotty at best.
Spending time without power (or running off a generator) gave me a lot of appreciation for the benefits of electricity. I love writing and talking about it.