Focus stacking assistant var.Mini – build log

By Oleg Mazurov

Focus Stacking Assistant var.Mini

After spending a week with focus stacking assistant I realized that I need more units. I’d like to have one unit dedicated for studio work, another to carry in camera bag and yet another one to control my Nikon (code for which I’m hoping to finish soon). Full-size Arduinos are big and expensive and I wanted this controller to be cheap and portable so I built my next controller using Arduino Pro Mini 3.3V, USB Host Mini, and a small home made PCB with buttons and LED. Finished mini-assistant can be seen on title picture and uses the same code as its big brother. What follows is a build log of mini-controller. It follows traditional layout, used, for example, here – a sandwich where Arduino Pro Mini sits on top of USB Host Mini. In addition to that, I needed to add another board on top of the sandwich to carry control and indication bits.

Step 1. The base.

I started by mounting 4 pins in the corners of USB Host Mini as depicted above. Doing it this way would allow me to take the unit apart later, if necessary, by simply cutting through wires. Following Arduino Pro Mini notation the “corner” pins are D9 and RST in the top row and D10 and GND in the bottom row.

Next picture shows all connections – pins D10-D13, VCC and GND on one side and D5-D9, GND and RST on another. Note also that pins D9 and D11-D13 are made short – they won’t connect to the control board which will be mounted on the top.

Step 4. Controls

This is how the next board in stack looks like – it contains buttons, indicator LED, power connector and power switch. It can be made from a piece of perfboard or etched. Schematic diagram and board layout in Eagle CAD format are provided to help with fabrication.

Step 5. Completed unit

This is completed unit with control board soldered on top and small lipo battery connected to the board and secured with rubber band. It also shows last minute modification – a blue wire reconnecting LiPo from VCC to RAW pin. MAX3421E works best while powered from 3.3V +-10% (3.0-3.6V). Fresh LiPo outputs 4.2V dropping quickly to ~3.7V and stays around this voltage until drained pretty close to the end of discharge. This voltage is slightly out of spec and depending on a particular battery, MAX3421E chip, and several other factors your camera will or will not be detected reliably by MAX3421E when LiPo is connected directly to VCC. If voltage from LiPo is too high and camera is not detected, the remedy is simple – cut the trace going from middle pin of power switch to VCC and solder a wire from this pin to RAW. This will give you slightly less run time from a battery – that’s why current revision of control board connects battery to VCC. If enough people report issues with this arrangement, I’ll make this mod permanent by modifying the PCB layout.

I am currently refining the construction (the PCB layout posted is already slightly different from the board depicted in the article) and planning on writing another post after building another 2-3 units. I’m very interested to hear from other builders – if you encounter any issues and/or would like to suggest an improvement, please let me know!

Hi Oleg,
first of all thanks a lot for the good work in designing the focus stacking controller for Canon. I am building the Mini version according to your information but I could use a little help in the procedure for programming the controller once it’s built. I understand that I first have to install drivers for the FTDI Basic Breakout plus install the Quantum Machines QM tool (do I need to install the QP base framework as well?), the USB Host Shield Library, the PTP library and your control software from gitHug. I will then open the state machine design in QM. This is it, how do I procede from here?
Thanks,
Mario

You don’t need QM unless you want to modify the code. You do need QP. Install Arduino IDE, USB Host library, PTP library and QP, run some simple Arduino examples, make sure everything compiles and runs. If you have never worked with Arduino, I suggest starting with full-sized boards.

I just finished assembling the Mini version of the Focus Stacking assistant. I was just able to test that the laptop talks to the Arduino by uploading the Blink sketch which works. Other than this, I am totally lost! Could you please tell me how to create the Focus Assistant sketch, assuming that this is what I need to do, as there are no instructions anywhere.
Thanks,
Mario

Oleg, I have downloaded QP/C++ (qpcpp_4.3.0.zip) and extracted to c:\qp (do I have to compile it?), I downloaded felis PTP_2.0 (there are just source code and examples, what do I do with these?) I still don’t understand what I am supposed to do in order to create a sketch to upload with the Arduino IDE, please give me more information, it would be a shame not to be able to use your nifty device!
Mario

There is Arduino-specific version of QP -> http://www.state-machine.com/arduino/index.php , you need to install this version. The installation instructions are quite detailed, you shouldn’t have any issues. Installing USB Host Shield libraries is similar.

Hi Oleg,
this is Mario again. Do you mean that I have to use an older version of Arduino (pre 1.0) to program the Focus Stacking Mini controller? Sorry if my question is silly because of my poor understanding.
Mario

Hello Stefan,
GetProperty is obsolete. It should not be used any more for EOS cameras. You can get exposure time settings handling EOS_EC_DevPropChanged event. In the latest version of the library you do not have to do it yourself. There is EOSEventParser class which does all the job for you. See EOSRemote sample sketch for the details. On startup EOS camera returns a huge event packet with initial camera settings, available via PTP. After that it returns much smaller event packets when any of the available properties changed either manually or programmatically. Canon uses this asynchronous mechanism for its software.

MoveFocus takes two parameters, a unint_8t for direction and a unint_16t for step. But what is the
->nStep % 10 ? 1 : 2? Can this be translated to for example direction 1, 10 steps? I guess when I do that a few times, and work out the error messages (probably not enough delay) it should work.

Oleg, thank you for your reply.
I do a lot of tests, and I come to the same conclusion on a Nikon Capture () and CaptureImage () commands does not work in Live View mode.

The MoveFocus command works only when liveview is enabled.
One solution, is to use the code above to move the focus in Live View mode, then disable the liveview and finally start CaptureImage () command (which works).

The only problem with CaptureImage () command, is that this command wants to focus before taking the picture.
Do you have a solution or a command to disable the focus before taking a picture with CaptureImage () ?

NB: On my Nikon, I have change the setting to take a picture even if the focus is not good.

Should therefore simply not to make the focus before taking a picture (photo taken directly without focus).

First, this is to cool, it is exactly what I have been looking for. I just want a small device that allows me to manually move the focus so that I don’t have to take a laptop out in the field with me. I know their are Android devices that can connect and do it but I have no other use for an Andriod.

Anyway, do I need to locate a pre 1.0 IDE board or has it been updated? If it still needs it, does the version you have for a UNO require an older version. I am new at this so I am trying to avoid all mistakes I can make first.