Shopping Cart

Posts

Focus stacking assistant var.Mini – build log

Focus Stacking Assistant var.Mini

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.

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.

Step 2. Mounting Arduino Pro Mini

Step 2. Mounting Arduino Pro Mini

Next picture shows Arduino Pro Mini on top of USB Host Mini. It also shows proper placement of programming/serial header to connect USB to TTL-serial converter (Sparkfun FTDI Basic Breakout – 3.3V or similar).

Step 3. Complete USB Host Mini - Arduino Pro Mini connections

Step 3. Complete USB Host Mini - Arduino Pro Mini connections

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

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

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!

Oleg.

Related posts:

  1. USB Host Mini Hardware Manual
  2. Communicating to GPS Receiver using USB Host Shield
  3. Building Google ADK hardware from standard components
  4. Google Open Accessory Interface for USB Host Shield Library 2.0 released
  5. Driving the Cheeky Mail Notifier from Arduino
  6. Using HID device for RC control
  7. PTPDevinfo in 16K
  8. RC car controlled by Wii Remote on Arduino
  9. Andriod ADK-compatible USB Host Library release.
  10. Controlling Canon Powershot cameras with Arduino

20 comments to Focus stacking assistant var.Mini – build log

  • Mario Errico

    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.

      • Mario Errico

        Hi Oleg,

        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

        • The previous article has some hints. You’d have to install all the libraries the FSA sketch depends on and then compile and load the sketch into Arduino.

          • Mario Errico

            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.

  • Stefan

    Is there any idea to update the USB Host library to support Arduino 1.0?

  • Stefan

    Hello,

    I want to say thanks for the great lib for the EOS control.

    Is there any possibility to get an example how to use the getProperty to read the current set exposuretime from a camera?
    I was not able to understand the code.

    Thank you very much for your help.

    • Alex

      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.

  • Arjan Grootenboer

    Hi All,

    I am trying to get focus stacking working on a Nikon 3Dx. Can anyone explain me what this means?

    ((Nikon*)ptp)->MoveFocus(((((Nikon*)ptp)->nStep % 10) ? 1 : 2), 64);
    ((Nikon*)ptp)->nStep ++;

    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.

    Thanks for the help.

  • Hi ALL, Hi Oleg,

    I want to use focus stacking on a Nikon DSLR,

    I use the exemple sketch : NKLiveView

    and after this line of code :
    ((Nikon*)ptp)->MoveFocus(((((Nikon*)ptp)->nStep % 10) ? 1 : 2), 64);
    ((Nikon*)ptp)->nStep ++;
    delay(100);

    I put this code:
    ((Nikon*)ptp)->Capture();
    delay(1500);

    (This is the same code,and same place, present on the sketch EOSFocus)

    Look all entire code of OnDeviceInitializedState function:

    void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
    {
    if (stateConnected == stDisconnected || stateConnected == stInitial)
    {
    stateConnected = stConnected;
    Notify(PSTR(“\r\nDevice connected.\r\n”));
    ((Nikon*)ptp)->bPollEnabled = true;

    uint16_t ret = ptp->Operation(PTP_OC_NIKON_StartLiveView, 0, NULL);

    ((Nikon*)ptp)->bLVEnabled = (ret == PTP_RC_OK);
    }
    if (!((Nikon*)ptp)->bLVEnabled)
    return;

    ((Nikon*)ptp)->MoveFocus(((((Nikon*)ptp)->nStep % 10) ? 1 : 2), 64);
    ((Nikon*)ptp)->nStep ++;
    delay(100);
    ((Nikon*)ptp)->Capture();
    delay(1500);
    }

    The focus works fine but not the capture of the image.
    I want use focus stacking on Nikon DSLR and save picture on the SD Card.

    What is the problem ?

    Thanks in advance for your reply.

    • I’ve never tried to use LiveView with capture on Nikon DSLRs. It is possible that you need to use a different command. I was also unable to have LCD (or external screen) active in LiveView.

  • 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).

    If you have a solution?

    Thank you in advance.

  • Keith

    Oleg,

    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.

    Thank you in advance for any quidance you can give me.

    Regards

Leave a Reply

  

  

  



You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">