FocusStepper: Focus Stacking Automation

Have questions about the equipment used for macro- or micro- photography? Post those questions in this forum.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

TheLostVertex
Posts: 317
Joined: Thu Sep 22, 2011 9:55 am
Location: Florida

FocusStepper: Focus Stacking Automation

Post by TheLostVertex »

Driving The Wooden Monster, is FocusStepper. A Java application and Arduino build which communicate with eachother to drive the stepper motor.

In coming up with the UI, I was heavily inspired by Rik's thread on DoF calculation. His thread had been a great help to me in the past, as well as the spreadsheet he made. But I didn't want to be swinging back and forth between a spread sheet to do calculations.

Hopefully the UI makes a little bit of sense to people. I am by no means a UI designer.

Image

The application operates like this:
1. The left column selects the size of each focus step. Three options are given for ways to choose. Automatic calculation, move a set distance, or move a set number of motor-steps
2. The middle column selects what the depth of the stack will be. Three options are here as well. Start/End points to select where you want the stack to begin and end, a user specified distance to stack, or a number of focus-steps to perform.
3. In order to focus for setting the start and end point, the arrow buttons in the top middle column will move the rail. Single arrows will move the rail by whatever the CURRENTLY selected focus-step size is. Double arrows will move the rail by the currently selected focus-step size times the multiplier in the settings window (default 2). For example, if the focus-step size is 200 motor-step, the [>] will move it toward the subject 200 motor-steps and [>>] will move it toward the subject 400 motor-steps.
4. The right column displays info about the current focus-step size, stack, a time estimate and other details.

A peak at the settings window shows some options and settings available. Also you can see I tucked away some calculation parameters that aren't likely to be changed much for calculating focus-step size here.

Image

I won't go over the settings here, but everything should have tool tips, and I also have a page explaining things in more detail, linked below.

I would like to note though that I discover that in order to trigger the camera in live view, the time the shutter had to be depressed is quite long. The measurements Rik made for his 500d correspond directly to the amount of time the shutter must be depressed to get consistent accusation. A value of 100ms for "Shutter Actuation Time" in example, leads to the shutter firing only about 60% of the time in live view. A value of 600ms fires 100% of the time.

Image

In the main UI you can see a button called "F Win". Since the UI is some what large, and I am likely to be using a live view display on my computer, F Win creates a always-on-top focus window that takes up little room. This lets me have some screen real-estate back when setting star/end points and things like that. Closing the Focus Window brings back the main UI.


The software can run in some what limited capacity without being connected. It can run a "fake" stack, and you can see the output in the console.

For the hardware, there is a schematic and some notes in a pdf on the downloads page linked below. My set up pictured is connected via bluetooth, and runs quick well in OS X. On Windows, I have not had much success getting bluetooth to function. So for windows it is best to omit the bluetooth serial connection and use a USB cable, or maybe try a different bluetooth serial module (I can not offer much help here though).

I have more information about the software here:
http://www.thelostvertex.com/focus-stepper/

And the software, Arduino schematics and parts, and Arduino firmware has all be release for free here:
http://www.thelostvertex.com/focus-stepper-downloads/

Please let me know if I missed anything or it you have any questions :)

BTW Chris S., I added a go to middle command ;)

EDIT: I forgot to mention the software and arduino communicate bidirectionally. This is to prevent any sort of hardware mishaps. It also means that if you cancel the stack at any time, or cancel the motor movement while focusing, it will update the motor's position correctly.

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

Steven,

Your "Wooden Monster" is a work of art sir!! You and your brother are true craftsmen!!

Just a note on the schematic for the stepper motor driver. It shows a 1uF decoupling capacitor on the power input. I believe the polarity is inverted.


This certainly looks like a fun project and thanks for all the work building the "Monster" and writing the code!!


BTW I live in Clearwater and it's raining now, we have had enough already!! Can we send some to Ca, they really need it!!

Best,

Mike

AdmiralBumbleBee
Posts: 3
Joined: Mon Jul 06, 2015 5:20 pm

Post by AdmiralBumbleBee »

mawyatt wrote: BTW I live in Clearwater and it's raining now, we have had enough already!! Can we send some to Ca, they really need it!!

Best,

Mike
That rain put us back weeks. :(

I'm still waiting to finish a new sub-base for the rig (with some nice toned shellac), but I can't get out and spray because of the constant rain!

Thanks for pointing out the decoupling cap error. It was also listed at the wrong value. Fritzing can be a real pain sometimes. An old revision had it correct, but it somehow became flipped when I was moving some components around.

-Robert (the brother) :twisted:

TheLostVertex
Posts: 317
Joined: Thu Sep 22, 2011 9:55 am
Location: Florida

Post by TheLostVertex »

Thanks mawyatt. I have updated the pdf and my flickr with the right polarity and values. Good catch.

elf
Posts: 1416
Joined: Sun Nov 18, 2007 12:10 pm

Post by elf »

One of the things on my setup that I found most useful was a Pause/Restart button. Occasionally my flash will misfire, usually from a low battery, so it's nice to be able to pause the stack to fix the issue.

A log file can be useful as well.

Can this app handle changing the focus step size per frame when using bellows draw to stack?

lothman
Posts: 951
Joined: Sat Feb 14, 2009 7:00 am
Location: Stuttgart/Germany

Re: FocusStepper: Focus Stacking Automation

Post by lothman »

TheLostVertex wrote: Please let me know if I missed anything or it you have any questions :)
Thanks a lot for sharing all your experience and knowledge. Perhaps one little thing what could be changed.
Instead of "Distance per motor step" you could add the date of the components: pitch of the spindle, transmission ratio, steps per revolution (motor data). But on the other hand that could be calculated by hand.

AdmiralBumbleBee
Posts: 3
Joined: Mon Jul 06, 2015 5:20 pm

Post by AdmiralBumbleBee »

elf wrote:One of the things on my setup that I found most useful was a Pause/Restart button. Occasionally my flash will misfire, usually from a low battery, so it's nice to be able to pause the stack to fix the issue.

A log file can be useful as well.

Can this app handle changing the focus step size per frame when using bellows draw to stack?
Pause/restart and resume are possible to be implemented. The design of the software is such that implementing this are fairly simple, but they weren't totally necessary for the first release. I actually have code in there commented out that allows for pause/resume 8)

It does produce a very detailed log.

It does not currently allow focus step size per frame, but that is fairly easily implemented. I'm not sure how the UI would present this feature to the user, though I'd imagine TheLostVertex has a better clue.

TheLostVertex
Posts: 317
Joined: Thu Sep 22, 2011 9:55 am
Location: Florida

Re: FocusStepper: Focus Stacking Automation

Post by TheLostVertex »

lothman wrote:Instead of "Distance per motor step" you could add the date of the components: pitch of the spindle, transmission ratio, steps per revolution (motor data). But on the other hand that could be calculated by hand.
I spent some time thinking about that when I was designing it. Initially I was going to do it like you suggest, but then I thought there are so many different ways one might build something, and they may not be using components that they know all the specs for. So instead I decided distances per full step allows you to physically measure what the movement is. Either though measuring with Zerene, or measuring with dial indicator or calipers and then dividing by the number of steps. And as you said, you can always calculate it by hand if you know (which is what I did for my set up).

Hopefully my reasoning makes a little bit of sense :)
elf wrote:One of the things on my setup that I found most useful was a Pause/Restart button. Occasionally my flash will misfire, usually from a low battery, so it's nice to be able to pause the stack to fix the issue.

A log file can be useful as well.

Can this app handle changing the focus step size per frame when using bellows draw to stack?
Resume functionality is somewhere on the todo list. For now, if you are using the start/end point mode for distance and you stop the stack, it keeps track of the current motor position. You could just set the start point to where you stopped the stack, and hit start again and it will start from that point. A bit of a hack, but its something I can use until better functionality is implemented.

I was working on logging stuff to file during the 'monsoon' here, but I was not very happy with it so I reverted. Right now the logging that there is there outputs to the console window. Honestly is a little bit schizophrenic in its formatting, but it is there. Better logging/logging to file is also some where on the todo list.

It does not. I never thought about driving a bellows like that while doing this. I also am not sure how I would accommodate setting that up in the UI.

elf
Posts: 1416
Joined: Sun Nov 18, 2007 12:10 pm

Post by elf »

The UI can be pretty simple for bellows draw. I have a settings tab where the focal length, fStop, mm to Exit pupil (used to calculate the bellows draw), step size (used when doing fixed sized steps), and maximum end point ( I move each lens so the entrance pupil is aligned with the panorama rotation points). The rotation points are treated as 0 for calculating bellows draw.

On the main page I can select between moving the stage, moving the camera and lens as a unit, or just moving the camera with the lens in a fixed position.

I also have a button to just trip the shutter. It's useful for checking exposure, etc.

I hard coded the stepper info, but it wouldn't be hard to expose it on another tab. I prefer working in millimeters instead of steps. This allows you to add a scale to the stage for a visual reference.

Here's a thread on my setup.

BugEZ
Posts: 850
Joined: Sat Mar 26, 2011 7:15 pm
Location: Loves Park Illinois

Post by BugEZ »

A very impressive interface and nicely done!

When I built my electronics to drive my stepper rig 6 years ago I stayed away from a computer based interface because it did not occur to me that it would be easier. I did not discover the Arduino equipment family till I had ordered discrete components. My controller uses analog knobs to set the stepsize. It is described here in this old post.

http://www.photomacrography.net/forum/v ... hp?t=12851

Were I starting from scratch I think I would probably go with a computer based interface. Yours is very nicely done.

I only use a few different lens arrangements in my stacking.

10X 0.3 NA Oly, on my 200mm tube lens
20X JML objective on my 200mm tube lens,
29mm f3 UKA lens on extension tubes.

I have learned what step size settings (knob positions) work best for these lenses so I don't have to work through step size. However, I do often wish for more flexibility for setting the start and stop setpoints. Your digital interface handles this nicely. My analog knob interface causes me to do a lot of "adjust and check" when setting those starts and stops. A bit pesky at times!

Your interface is very clear and understandable. Very nicely done indeed!

Keith

TheLostVertex
Posts: 317
Joined: Thu Sep 22, 2011 9:55 am
Location: Florida

Post by TheLostVertex »

Thanks for the additional info Elf. Soon as I clicked the link I remembered your rig :)

Thanks for the compliments Keith. I had thought about doing a more portable interface, but decided that I would always be around a computer anyways. So computer control it was. I the future I might try and build a more portable tripod mounted device too. Some time further down the road. For now I need to finish up my current rig.

Ludvig Friberg
Posts: 25
Joined: Mon Jul 04, 2011 5:04 pm

Post by Ludvig Friberg »

Is anyone here running this? I tried to get it to work but I cant get the serial communication working, I flashed the Arduino(duemilanove) with the hex file from http://www.thelostvertex.com/focus-stepper-downloads/

When trying to connect I can see that the arduino RX led is flashing but no connection. Console gives :

On tty I get:
/dev/tty.usbserial-A9007KAH
Adding Listener!
In PingTask: Connected == false
In PingTask: Connected == false
In PingTask: Connected == false
In PingTask: Connected == false
In PingTask: Connected == false
Removing Listener!

I tried both OSX and different flavours of Windows.

Post Reply Previous topicNext topic