I modified a lens into a macro stacking rail – it works super fast! = diy project

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

Moderators: Chris S., Pau, Beatsy, rjlittlefield, ChrisR

Patison
Posts: 44
Joined: Mon Feb 27, 2023 1:37 am

I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by Patison »

A Few Words of Introduction

For the past 2–3 years, I have been successfully photographing and stacking using the Olympus OM-1 system, always knowing in the back of my mind that maximum detail and tonal range could only be achieved with a full-frame setup.
The only thing holding me back was the very weak software available for Canon, Nikon, and Sony systems (I was ready to adapt to any ecosystem).

Canon – let's say it has "almost" good focus bracketing. Unfortunately, it forces the use of autofocus, making it difficult to manually set the starting point for stacking. After completing a cycle, the lens does not return to the starting position, requiring a new focus search, which I consider ridiculous. Not to mention, I can't program a button like C1 to automatically activate focus bracketing—I have to go into the menu every time.

Nikon – has the option to return to the starting position after completing a focus bracketing sequence, but their flagship camera speeds up to a "whopping" 7 fps (which is weak!).

Sony – also has very slow focus bracketing and lacks a return-to-start function.

I had a lot of time to think in December 2024—my three-week vacation allowed me to "give birth" to a few ideas.
One of them I decided to present to you—I believe it is brilliant in its simplicity.


Riding the momentum, I bought a Canon 5D Mark II—though I'm still not sure if Canon was the right decision.

My recent tests at 30 FPS left me quite disappointed because the buffer fills up quickly when shooting JPEGs. Even with a $1,000 CF card, the buffer runs out after 200–250 JPEGs, which was frustrating.

In my graveyard of lenses, I had a Canon 50mm f/1.8 lying around.

I decided to strip it of its optics and control the focus ring electronically using a controller. Initially, I used Arduino, but now I’ve switched to ESP32.

The disassembly of the optics went smoothly.
The next challenge was figuring out how to control the lens electronics. The solution came in the form of extension tubes, to which I soldered an Ethernet cable, following the wiring diagram below.
Image

setup:
Image64f3d2bc-d5fc-44b6-bb7a-c350aaec5897 by Radoslaw, on Flickr

diy pcb project
Image41dff873-8508-4d1b-b2dc-5815a158d06e by Radoslaw, on Flickr

first test:
Image25eb49d5-47e2-4bae-af56-425e235fd467 by Radoslaw, on Flickr

stack test - using minolta 5400 lens
Imagec5fafccd-bebe-49cc-8093-a82bab045e7e by Radoslaw, on Flickr

results
Image88f08a61-75c4-482d-bd3b-dd48387b24e8 by Radoslaw, on Flickr

90% of success:
Image1test by Radoslaw, on Flickr

Best regards

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

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by lothman »

two question because I'm afraid I might have understood in a wrong way.:

so you uses the mechanism of a modified AF-lens in order to move a macro lens -correct?
and you did not use the camera but an external controller to control the modified lens?

A very cool hack you achieved, thanks for sharing =D>

CrispyBee
Posts: 999
Joined: Mon Apr 03, 2023 11:17 am

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by CrispyBee »

I like the idea! Isn't there an advantage to moving the lens via extension alone while stacking? Or does that only apply to a certain range in macro photography?

Would be interesting to use a broken 200mm lens with AF motor, that should have a somewhat correct tube length and might even work with the built-in AF for focus-stacking.... {-o<

Patison
Posts: 44
Joined: Mon Feb 27, 2023 1:37 am

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by Patison »

To be honest, this is my main reason – imagine that a stack of 400 photos takes me 12-15 seconds :) – all in the field.

rjlittlefield
Site Admin
Posts: 24220
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by rjlittlefield »

Nicely done! How did you go about making sense of the communications protocol needed by the lens?

--Rik

iconoclastica
Posts: 552
Joined: Sat Jun 25, 2016 12:34 pm
Location: Wageningen, Gelderland

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by iconoclastica »

I am pleasantly surprised that you have been able to do this with the 50/1.8. To build stacks of a certain size class of objects I routinely shoot by refocusing the (unmodified) lens by software. This works very well with the 60mm-macro, but the 50mm won't refocus. A thing to be aware of in yor project is that I think the stepsize may vary depending on the focus distance. With 'step' I mean one movement of the focusing motor. When shooting close-up (1:1) I always must make the same number of steps as when the object is further away. I am sure someone here can say whether that's simply an optical effect in consequence of a constant rotation. (It is very convenient, though, for me).
--- felix filicis ---

Patison
Posts: 44
Joined: Mon Feb 27, 2023 1:37 am

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by Patison »

The lens has an extension of about 11mm, and in the control protocol, I divided this movement into an effective 4000 steps.

It works perfectly up to a 50:1 scale – I haven't tried more because I don't have the appropriate optics.

rjlittlefield – I created my own library for controlling EF and EF-S lenses.

here is 20:1 sample
Imagesample by Radoslaw, on Flickr

focus stack was done without any pause between stacks (light was from LED)
exposure time 1/20 so is very smooth

Darionett
Posts: 97
Joined: Mon Mar 07, 2022 4:45 am
Location: Sardegna, Italy

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by Darionett »

This is an impressive and ingenious work! my only doubt is due to the fact that the weight of the optics can flex the extension of the lens in a horizontal setup, while distorting the distance of the steps in a vertical setup. It would be interesting to check its efficiency with Zerenestacker

Best regards,
Dario Nett

Patison
Posts: 44
Joined: Mon Feb 27, 2023 1:37 am

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by Patison »

i have support, and it slides on mitutoyo lens, but if You want i can send you jpg sequence

rjlittlefield
Site Admin
Posts: 24220
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by rjlittlefield »

Patison wrote:
Wed Feb 05, 2025 1:44 pm
rjlittlefield – I created my own library for controlling EF and EF-S lenses.
I assumed you had written your own library.

The question I intended to ask was lower level -- how did you learn what sequences of signals need to be sent to the lens, to make it move the motor?

Is there a reference for that information? Or did you have to figure it out from scratch, and if so what methods did you use?

--Rik

Patison
Posts: 44
Joined: Mon Feb 27, 2023 1:37 am

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by Patison »

i start from scratch, there are some small info about aparature closing in binary thata, so i use it, and changing bytes i found out how to move focus forward and backward :D

PeteM
Posts: 217
Joined: Sat Jan 05, 2019 12:06 am
Location: West Coast, USA

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by PeteM »

Very impressive mods. Thanks for sharing this.

Patison
Posts: 44
Joined: Mon Feb 27, 2023 1:37 am

Re: I modified a lens into a macro stacking rail – it works super fast! = diy project

Post by Patison »

anyway if someone will be interested of copy i can share full working code and wiring

Post Reply Previous topicNext topic