DIY Stack and Stitch System

mawyatt2002

Forum Enthusiast
Messages
499
Reaction score
139
Location
Clearwater, US
Hello,

As somewhat of a followup to this older thread on another site regarding modifying the Wemacro Vertical Stand for horizontal use, I've been developing a S&S setup based upon the Wemacro Vertical Stand and a Precision Thor Labs setup.

https://www.uglyhedgehog.com/t-539182-1.html

You can follow the details in these threads below at PM.

https://www.photomacrography.net/forum/viewtopic.php?t=38511
https://www.photomacrography.net/forum/viewtopic.php?t=38512
https://www.photomacrography.net/forum/viewtopic.php?t=38548

Stack and Stitching involves taking multiple image focus stacks, usually with somewhat high magnifications, then move the camera/lens and/or subject and repeat. You end up with a bunch of images that need to be first focus stacked using specialized software (Zerene for example) at each location, then the post stacked images are stitched together like a panorama. The resultant final image has very high resolution, much more than a normal camera/lens can deliver, but utilizes available components. I have done this (~19000 X 13000 pixels) partly manually, and can tell you first hand it's very time consuming and tedious.

Commercial systems are available to help, but are expensive, and some have limited computer compatibility. So after doing a few S&S sessions manually, I decided to attempt with my cheap Harbor Freight drill press, a few drills and taps, and a soldering iron to create my own precision S&S system. I also don't have any programming skills, and my computer knowledge is quite limited!!

I've spent lots of time "thinking" about how I wanted things to work and decided not to use available software or other techniques...I wanted this work the way I wanted rather than adapted to "fit" another protocol.

I decided to have the initial system be vertically based and move the camera/lens with a precision motorized rail for focus stacking and move the subject for the stitching regions with other less precise motorized rails. My precision setup is horizontally based, so I ordered a 95mm vertical extruded bar (Thor Labs) which is bolted to a sliding rail. The idea was to have the camera/lens attached to a motorized focus rail and move Z axis vertically mounted to this 95mm bar. The subject would be mounted to a X and Y positioning motorized rails, which can be less precise. Then I realized I could use the Wemacro Vertical Stand for this as well, so I decided to use the Wemacro setup as my developing setup rather than the Thor Labs setup, since the Wemacro is smaller and portable.

Small motorized rails were what I wanted for the X and Y stage, I could (and did) use larger rails but they were too big and awkward for my usual subjects (Silicon chips). Ebay came to rescue with some small US Automated THK KR15s. These are nice small rails that with a little work can be modified for our macro use, please see the other threads for details. I removed the electronics and wired the stepper motor to an external connectors as shown. I need 2 stepper rails for X and Y and mounted one KR-15 on top the other at right angles, the bottom KR-15 is directly mounted to a long ARCA clamp.

Now mounting this X & Y setup to the Wemacro base was by way of a secured (4 M5 bolts) ARCA plate attached to a Wemacro plate that bolts (4 1/4-20 bolts) to the base as shown. The Z axis is handled by the standard Wemacro setup using a THK KR20 (or 26) bolted to a ARCA plate, the THK KR20 is a slightly larger rail than the KR-15 and a good choice for handing the camera and lens assembly.

For the electronics the Raspberry Pi was chosen as the base computer, with Pololu Tic-500 as the motor controllers (3). For triggering the camera (and strobes) an optical isolated circuit was used and this allows separate triggering of the strobe/flash without using the camera hotshot. Almost all cameras EFCS and ESCS (all electronic shutter) blocks Hot Shoe triggering during this mode, the work around is to create a separate trigger for the strobe/flash that places the exposure within the shutter opening.

Operating software was created on the Raspberry Pi 3B in Python, these are amazing computers and only cost $35!! Even the tiny $10 Raspberry Pi Zero W will run the entire setup without issue (a little slow though). These Raspberries can operate under VNC mode where no monitor, keyboard or mouse is required with the Raspberry, you have a true remote desktop application which can operate anywhere within your router range!! All 3 Tic-500s are connected by USB, these are splendid controllers (from the folks from MIT, as is Python I believe) that can operate just about any stepper motor system that a macro photographer would need. They have a mode where the motor currents are partially recycled back to the power supply rather than wasted to ground, this allow the entire system, including Raspberry Pi 3B and all controller and electronics, 2 NEMA 11 Stepper motors (KR-15) and a NEMA 17 Stepper motor (KR-20) to operate from a single 12 volt 2.5 amp supply!!

For more details on the development & components of this system and the Thor Labs setup please use the links provided.

Anyway, I hope this helps some DIYers with limited resources (like me!) that may be thinking of tackling a project like this...you can do it!!

US Automation THK KR-15

t1-630108-dsc_0022.jpg


(Download)
US Automation THK KR-15

t1-630994-dsc_0023.jpg


(Download)
KR-15 Mounted on top another with ARCA clamp below

t1-633582-dsc_0036.jpg


(Download)
ARCA Plate attached to Wemacro base

t1-636497-dsc_0027.jpg


(Download)
X and Y KR-15 Mounted on Wemacro base

t1-638060-dsc_0007.jpg


(Download)
X and Y KR-15 Mounted on Wemacro base

t1-642171-dsc_0008.jpg


(Download)
Wemacro Vertical Stand with X and Y USA KR-15s

t1-643076-dsc_0009.jpg


(Download)
Trigger electronics and 12v to 5 v converter

t1-647999-dsc_0054.jpg


(Download)
Raspberry Pi 3B, 3 Pololu Tic-500 and early version of Trigger Circuit (no converter)

t1-649107-dsc_0037.jpg


(Download)
Everything connected up

t1-662713-dsc_0045.jpg


(Download)

Best,

--
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
 
Last edited:
Thanks for the great post !!!

You might also want to post this in the " DIY and Photo Experiments Forum ".
 
View attachment 50e079d76dba49fc94f9a04035e4913d.jpg

Old scratched Silicon Wafer sliver captured with S&S System

I've run the system now with a couple test subjects, here's a link to the latest (see entire thread for details.

https://www.photomacrography.net/forum/viewtopic.php?p=242291#242291

This was a silicon wafer sliver that was completely automated hands off captured (~2000 images ~ 3hrs). The test image is on Nikon Image Space, see link.

This was a 16mm by 13.75mm section (tilted back about 8mm), with 30 tiles taken with 25 micron steps (~2000 images). D500 camera with Mitutoyo 5X objective and Raynox 150 tube lens. Final image rendered as 21793 by 20314 pixels (443MP).

No image processing was done other than stacked in Zerene with all alignments OFF, and stitched with PTgui with default parameters.

Hopefully Santa will get me a paid version of PTgui!!

Best,

Edit:

Santa came early, and I purchased PTgui. I've reloaded the image on Nikon Image Space without the watermarks and cropped smaller, and another for a session just completed where a small light tent was used to help diffuse the light. Be sure to download the image to see the detail.

http://img.gg/10oj9Jm

Best,

--
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
 
Last edited:
Here's an update on the development of the DIY Precision S&S System. This effort has now evolved to try to implement motor control algorithms and setups to allow very fast stepping, but still maintain IQ, with a goal of 1~2 second steps. This will be achieved hopefully by reducing motor movement induced vibrations with adaptive motor control algorithms and fully electronic curtain shutters.

Here's a test image that took ~ 3hrs to complete with ~2000 images (others have taken days at ~6000 images). Be sure an download the image to see the resolution achieved with S&S techniques. If the step time can be reduced to ~1.5sec then this 2000 image session can be reduced to ~1hr. Download last image, it's ~27,500 by 21,500 pixels!

http://img.gg/10oj9Jm

Here's a link over at Photomacrography for more information and setup images.

https://www.photomacrography.net/forum/viewtopic.php?p=246910#246910

Best,

--
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
 
Last edited:
A few folks have asked that I post a video of the Precision Stack & Stitch System I'm developing. So I'll start out with a single axis system shown, first with the hardware description, second with the software and last with the operation.

Don't expect much as far a video quality as this is the 1st video I've done and nothing was edited, just shoot the setup and post to Google Drive.

The Single Axis System is based upon a Raspberry Pi Zero W computer with a custom interface board to trigger the camera and strobes as well as supply the Pi with 5 volts from the nominal 12 volt motor supply. The interface board sits on top on the Pi using the 40 pin connector.

VNC is utilized to connect to the Pi via wireless WiFi, so no monitor, keyboard nor mouse required to connected to the Pi.

The base is a Wemacro Vertical Stand operated horizontally with a THK KR20 focus rail (1mm pitch) driven by a 400 step NEMA 17 motor. Motor control is by way of a Pololu Tic-500 connected to the Pi by USB. The KR20 has a Panasonic SUNX magnetic sensor for rail "home" detection which is connected to the Tic-500.

Here's the videos, hardware, software and operation. The Precision Automated S&S System will follow when I get some time to shoot the videos.

https://drive.google.com/file/d/1xjGAkQmkn_gmHV0OYKyyY_0YoI7zEhee/view?usp=sharing

https://drive.google.com/file/d/1QpSaV75roRLvFpi7NDzDKK84Tw2Li3J0/view?usp=sharing

https://drive.google.com/file/d/1X7IHTnLEQbniC4MwrMhaN8zjQdshzOrS/view?usp=sharing



Raspberry Pi ZERO W with Custom Interface Board

Raspberry Pi ZERO W with Custom Interface Board



Single Axis Stacking Setup

Single Axis Stacking Setup



WeMacro Vertical Stand (used horizontally), D850, Nikkor 105mm, Pololu Tic-500, Raspberry Pi Zero W

WeMacro Vertical Stand (used horizontally), D850, Nikkor 105mm, Pololu Tic-500, Raspberry Pi Zero W



[ATTACH alt="SUNX Magnetic "Home" Sensor"]2169760[/ATTACH]
SUNX Magnetic "Home" Sensor



Pololu Tic-500 Motor Controller/Driver

Pololu Tic-500 Motor Controller/Driver



Raspberry Pi ZERO W and Custom Interface Board

Raspberry Pi ZERO W and Custom Interface Board



























--
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
 

Attachments

  • 07459908d31e4aeea02807f25343b453.jpg
    07459908d31e4aeea02807f25343b453.jpg
    16.6 MB · Views: 0
Here's a few videos of the Fully Automated S&S System (3 axis) I've been developing. Watch the Single Axis Videos above before these because these reference those Single Axis Videos and don't go into the detail they do.

These videos aren't very good, I've only done the previous mentioned videos as my 1st attempts and they haven't been edited, so don't expect much!

The setup uses a THK KR20 with 1mm threads on the Z axis and a pair of KR15s on X and Y. All are controlled by Pololu Tic-500 and these are USB connected to a Raspberry Pi 3B. The Pi is used with VNC to allow remote operation without need for a monitor, keyboard, nor mouse.

Here's the videos, first is the hardware, then software and a couple operational videos (last is long test stack operating quickly).

https://drive.google.com/file/d/1gZqxISGSvuFUqvRiHP5Bf0SFkAyqziCI/view?usp=sharing

https://drive.google.com/file/d/1J4eaSVyoya0N83O2n_-Ty6pVvdF73_fJ/view?usp=sharing

https://drive.google.com/file/d/1s4lN3Qi4PYMHuO6swIcT6YPGpDOKjcaZ/view?usp=sharing


Best,
 
Last edited:
Here's a list of the videos that have been updated.

Single Axis Focus Stacking System Updated Videos

https://drive.google.com/file/d/1elblFjdob9-MGcsZnNiCspKWZu25G33w/view?usp=sharing

https://drive.google.com/file/d/19g4uJzEgxS5SRHteb8iqJWizakuQmsXt/view?usp=sharing

https://drive.google.com/file/d/1j8hIgvMViMYzZWRZ6W3x-5TfrV-E1Xgc/view?usp=sharing

Fully Automated Stack & Stitch System Update Videos

https://drive.google.com/file/d/1XHR1tIL02lJmklQYdRg9v67ytTmAJYhD/view?usp=sharing

https://drive.google.com/file/d/1gm8jZBt4cXJrfoLKiRWcX1HO-Wl3yNrz/view?usp=sharing

https://drive.google.com/file/d/1p5SklfGI3iO9Axe3CcM7GhXplleME_9J/view?usp=sharing

https://drive.google.com/file/d/18GxU2UnlrG4TGF2vXnAgTPAC6ogPKGIN/view?usp=sharing

Vibration Reduction Demo utilizing a IC package pin of 400 microns diameter as subject. 10X lens with D850 at maximum digital zoom shows almost no induced vibration when rail is moved to position, but still produces reasonable rail speeds. This is the result of optimized motor current waveforms, timing and velocity/acceleration/deceleration profiles.

You can judge for yourself

https://drive.google.com/file/d/1z3bgXYc2gXYYY7rJ-g34RcwsC-RTplLY/view?usp=sharing

Chip subject with 20X lens and 16X digital zoom on D850, effective 320X magnification.


Chip subject with 20X lens and 16X digital zoom using Trinamic TMC-5130 Motor Controller.


Best,
 
Last edited:
A few updates directly from "Mike's Labs".

The above video demos showing the effects of mitigating motor/rail movement induced vibration has been extended to an effective magnification of 800X!

https://drive.google.com/file/d/19wE-B-dMesEXNtEZ552h_VnpWOjA0n0B/view?usp=sharing

Also see from PM site.




The Raspberry Pi based multi-axis Stack and Stitch Controllers have also been expanded and custom Printed Circuit Boards designed and fabricated (a few are still available for select DIYers). These include those listed, and in addition high current, voltage and speed stepper motor controllers have been developed for expanding Focus Stacking and Stack and Strict efforts. All these controllers are designed to allow multiple parameter optimization for various motors/rails and setups, even including the development of a Hall Effect Sensor PCB for viewing the Sine and Cosine motor currents for improved motor/rail performance. These systems include programmable camera and strobe optical isolated trigger outputs.

The Trinamic 5130 based controller (used with Pololu Tic-500 in some 3 axis systems) has been extensively tested and evaluated with many flavors of motors & rails, WeMacro, Stackshot, MJKZZ, THK KR15 with NEMA 11, THK KR20 with NEMA 17, HIWIN KK50 with NEMA 17 for example. Other systems are in evaluation and all are working well.

Best,

TMC5130 Based 3 Axis Controller using Tic-500 for X and Y and TMC5130 for Z (1.4A rms at 12~16V)

TMC5130 Based 3 Axis Controller using Tic-500 for X and Y and TMC5130 for Z (1.4A rms at 12~16V)

Quad Axis Controller with 4 independent motor controller outputs (0.76A rms at 12~16V)

Quad Axis Controller with 4 independent motor controller outputs (0.76A rms at 12~16V)

Another view of Quad Axis Controller

Another view of Quad Axis Controller

Assembly of various controllers at "Mike's Labs"

Assembly of various controllers at "Mike's Labs"

High Motor Current (2.8A rms) and Voltage (12~24V) Controller with discrete MOS FET devices

High Motor Current (2.8A rms) and Voltage (12~24V) Controller with discrete MOS FET devices

High Current (3.5A rms) and Voltage (12~24V) Controller

High Current (3.5A rms) and Voltage (12~24V) Controller

Dual Axis Controller with driver PCB removed (0.76A rms at 12~16V)

Dual Axis Controller with driver PCB removed (0.76A rms at 12~16V)

Triple Axis Controller (1.4 & 0.76A rms at 12~16V)

Triple Axis Controller (1.4 & 0.76A rms at 12~16V)

With Driver PCB removed

With Driver PCB removed

Dual Channel Hall Effect Stepper Motor Current Probe PCB

Dual Channel Hall Effect Stepper Motor Current Probe PCB

Sine and Cosine Motor Currents TMC5130 controller NEMA 17 with KR20 Rail under movement (Scale 1A/div)

Sine and Cosine Motor Currents TMC5130 controller NEMA 17 with KR20 Rail under movement (Scale 1A/div)

Sine and Cosine Motor Currents for TMC5130 based controller with NEMA 17 motor (Scale 1A/div)

Sine and Cosine Motor Currents for TMC5130 based controller with NEMA 17 motor (Scale 1A/div)

Best,

--
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
 
Last edited:
Oh man!! What perfect timing. I just started digging in to my own project. My brother is helping because a lot of this stuff is greek to me, but Ive been learning. Building a prototype using bread boards and an arduino 1st and then hopefully something a bit more solid/permanent, given we get a proof positive. My brother 1st built a circuit and rig to time liquid collision/drop photos. Using rasberri pi might make more sense, as one of the issues using the arduino is mobility. Another issue weve been solving is how to "frame the rails" and picking which rails to use, but it looks as though you may have a solution -- if price is right. The entire point for me is wanting a high precision stacking rail without dishing out $400-$1500. Price as of now looks to be under $100.

Im going to read links and share thread with my brother. Thank you SO MUCH for sharing.
 
Oh man!! What perfect timing. I just started digging in to my own project. My brother is helping because a lot of this stuff is greek to me, but Ive been learning. Building a prototype using bread boards and an arduino 1st and then hopefully something a bit more solid/permanent, given we get a proof positive. My brother 1st built a circuit and rig to time liquid collision/drop photos. Using rasberri pi might make more sense, as one of the issues using the arduino is mobility. Another issue weve been solving is how to "frame the rails" and picking which rails to use, but it looks as though you may have a solution -- if price is right. The entire point for me is wanting a high precision stacking rail without dishing out $400-$1500. Price as of now looks to be under $100.

Im going to read links and share thread with my brother. Thank you SO MUCH for sharing.
Hi Chuck,

Rolling your own Precision Stacking System can get quite involved, and expensive, if you try for the very high precision capability. I use the THK type surplus rails, and they are expensive even as surplus, some you will need to add motors and or adapters for the motors.

If you haven't been involved with focus stacking utilizing rails, a simpler approach that will get you up and running quickly and not too expensive is the WeMacro system. This system is quite good and reasonable. I have and still use the WeMacro system.

Not trying to discourage, just make you aware of the tasks ahead with rolling your own High Precision Stacking System, but can be fun too!!

I'll try and help as much as possible if you decide to go forward with your project.

Here's the referenced video showing the effects of motor induced vibration control that might be of interest.


Best,
 
Last edited:
Rotational axis has now been added for a XYZR System utilizing the Quad Axis Controller mentioned. Rotary resolution is 0.00352 degrees.

0.9 Degree NEMA 17 Stepper Motor used as Rotational axis stage, mounted to small 40mm square ARCA plate

0.9 Degree NEMA 17 Stepper Motor used as Rotational axis stage, mounted to small 40mm square ARCA plate

Ball Head mounted to stepper shaft

Ball Head mounted to stepper shaft

Small ARCA Clamp mounted to X and Y THK KR15 Rails.

Small ARCA Clamp mounted to X and Y THK KR15 Rails.

Rotation Stage mounted

Rotation Stage mounted

Thinner (~13mm vs 34mm) 0.9 Degree Stepper motor

Thinner (~13mm vs 34mm) 0.9 Degree Stepper motor

Best,

--
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
 
Update on the earlier mentioned stepper motor current sensor/probe.


Best,
 
What application would use rotation?
 
What application would use rotation?
One application is the alignment of subjects with precise orthogonal X and Y details like the semiconductor chips and wafers I often image. Getting these to sub-pixel level alignment across the entire sensor frame isn't easy unless you have a rotary stage capable of very precise rotations like a manual micrometer based rotary stage or this stepper based rotary stage.

This is my main application, I'm sure others have different uses.

Best,

--
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
 
Last edited:
I just looking for details on your HW setup with RPi's and it looks like you use "default" SD card slot for storing "everything" for RPi.

Last weekend i lost (reliable) control of RPi (3B+ too) on my μGUN and first point was test if it is caused by SD card. And it does. If you didn't noticed that be careful and just change the way to some USB mass storage as prevention. Otherwise you can expect malfunctioning. Now i see that SD cards are big pain of the RPi's still. I am going to use the SSD solution, inspired by this article:

 
I just looking for details on your HW setup with RPi's and it looks like you use "default" SD card slot for storing "everything" for RPi.

Last weekend i lost (reliable) control of RPi (3B+ too) on my μGUN and first point was test if it is caused by SD card. And it does. If you didn't noticed that be careful and just change the way to some USB mass storage as prevention. Otherwise you can expect malfunctioning. Now i see that SD cards are big pain of the RPi's still. I am going to use the SSD solution, inspired by this article:

https://blog.mivia.dk/solved-sd-card-corrupted-raspberry-pi
Yes, I use the SD card as a baseline for the RPi. The SD card is backup as an "Exact Digital Copy" to my Mac and then can create exact SD Card Copies. This is different than just copying files and directories as it creates the exact digital duplicate of the card bit for bit. This is a long process tho, and best run overnight or in the background. 64GB takes about 5 hours!

I'm tied up with the custom Piezo Stages & controller developments now, but will look into this later.

Thanks for the note.

Best,
 
I have ordinary images of my SD card from RPi for "fast geting back to work". But it was to soon to be satisfied with: ok, i'll put another card. Truth is that i use a lot of write requests to the SD card. So i could expected that the lifetime of some cells on SD card should come to troubles. Even i didn't start to use my machine more yet. So few pieces of SD cards cost like SSD + other necessary accessory and reliability should be more than acceptable than overfeeding by SD cards. :)
 
What application would use rotation?
Another use of precision rotation is in the possible positioning of the subject (or camera/lens, but this is much heavier and more difficult to stabilize) for pixel shifting. Some of the new cameras have pixel shifting capabilities to improve the sensor resolution, but others don't, so this may allow pixel shifting for specific use in other cameras.

To be able to pixel shift with the subject for example, you will need to move the subject in precise increments of the camera pixel size at magnification. To do this requires perfect alignment with the camera pixels in X, Y and R.

Much effort is being applied to utilize modified ultra-precision Piezoelectric stages, cable of 1nanometer resolution and +-10nanometer repeatibility for possible use in X and Y. These stages are available on eBay as surplus and you can view the OEM source at Physik Instrumente. Custom controller are being developed for macro use, you can see some of the efforts here at PM.

https://www.photomacrography.net/forum/viewtopic.php?p=253885#253885

Best,

--
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
 
Last edited:
Hallo,

64db13c88af3428bac5238a2f145c79b.jpg


Nice you to try extreme macro panorama. I’ve tried different way to x y axis step of the subject to photograph but the problem occurred to have stitching problems because the subject changes its perspective for the pano stitching is that not the right way. I found a easy way semi automatic.
Are you interested to know about ?

Best regards

Olivier
 

Keyboard shortcuts

Back
Top