DIY Stack and Stitch System

Started Nov 26, 2018 | Discussions
mawyatt2002
mawyatt2002 Contributing Member • Posts: 502
DIY Stack and Stitch System
7

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

(Download)
US Automation THK KR-15

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

(Download)
ARCA Plate attached to Wemacro base

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

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

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

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

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

(Download)
Everything connected up

(Download)

Best,

-- hide signature --

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

mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System

Santa came early, and I purchased PTgui for stitching. I've reloaded an image on Nikon Image Space without the watermarks and cropped smaller, and another from 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,

-- hide signature --

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

mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System

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,

-- hide signature --

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

mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System

A few updates directly from "Mike's Labs" from over at Macro site.

https://www.dpreview.com/forums/thread/4342793

Also see from PM site.

http://www.photomacrography.net/forum/viewtopic.php?t=39396

http://www.photomacrography.net/forum/viewtopic.php?t=39756

http://www.photomacrography.net/forum/viewtopic.php?t=39755

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

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)

View: original size

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

View: original size

Another view of Quad Axis Controller

View: original size

Assembly of various controllers at "Mike's Labs"

View: original size

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

View: original size

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

View: original size

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

View: original size

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

View: original size

With Driver PCB removed

View: original size

Dual Channel Hall Effect Stepper Motor Current Probe PCB

View: original size

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

View: original size

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

View: original size

Best,

-- hide signature --

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

mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System

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

Ball Head mounted to stepper shaft

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

Rotation Stage mounted

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

Best,

-- hide signature --

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

Entropy512 Veteran Member • Posts: 4,839
Re: DIY Stack and Stitch System

Nice!

Trinamic stepper drivers have become extremely popular with the 3D printing community.

FYI a similar project hit Hackaday a few days ago - https://hackaday.com/2019/06/14/gigapixel-microscope-reveals-tiny-parts-of-the-big-picture/

-- hide signature --

Context is key. If I have quoted someone else's post when replying, please do not reply to something I say without reading text that I have quoted, and understanding the reason the quote function exists.

 Entropy512's gear list:Entropy512's gear list
Sony a6000 Pentax K-5 Pentax K-01 Sony a6300 Canon EF 85mm F1.8 USM +5 more
mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System
1

Entropy512 wrote:

Nice!

Trinamic stepper drivers have become extremely popular with the 3D printing community.

FYI a similar project hit Hackaday a few days ago - https://hackaday.com/2019/06/14/gigapixel-microscope-reveals-tiny-parts-of-the-big-picture/

Thanks.

Yes they seem popular with 3D crowd, at least 2200 types and earlier versions. I even thought about using the 3D community software and hardware developments (really great stuff) but decided that I would have to adapt to their way of doing things for massive Stack & Stitching Sessions, rather than the way I initially wanted, so ended up rolling my own.

I've done near gigapixel level (~240000 by ~20000) chip images for a couple years now. One of the early sessions was 19 tiles at 300~400 36MP images per tile, a total of more than 200 gigapixels initially. These initial gigapixel type levels were done manually in X and Y with automated Z axis, and took many days....why I decided to develop a fully automated setup!!

The project over on Hackaday is very interesting, great for starters to get involved and seems straight forward.

The wood platforms and the linear rails used will need to yield to higher levels of precision, stability, and repeatability to get close to the resolutions mentioned.  Most folks in higher precision and resolution stacking use precision rails and microscope objectives. Also it's usually better to move the camera/lens/subject in the Z axis rather than the usual in camera focus when you move to higher magnifications beyond ~2X for the best IQ. So not only the mechanical, electromechanical and electronics, but the optics can get quite involved. With stacking and stitching then telecentric optics become an important factor for consideration if subject distortion is important.

Some of the commercial offerings from Wemacro and Stackshot are pretty good for those that don't want to DIY for Z axis stacking, but for very high precision work you'll need to move to the industrial type rails.

Anyway, fun stuff indeed!! Thanks for posting.

Best,

-- hide signature --

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

Entropy512 Veteran Member • Posts: 4,839
Re: DIY Stack and Stitch System

mawyatt2002 wrote:

Entropy512 wrote:

Nice!

Trinamic stepper drivers have become extremely popular with the 3D printing community.

FYI a similar project hit Hackaday a few days ago - https://hackaday.com/2019/06/14/gigapixel-microscope-reveals-tiny-parts-of-the-big-picture/

Thanks.

The project over on Hackaday is very interesting, great for starters to get involved and seems straight forward.

The wood platforms and the linear rails used will need to yield to higher levels of precision, stability, and repeatability to get close to the resolutions mentioned. Most folks in higher precision and resolution stacking use precision rails and microscope objectives. Also it's usually better to move the camera/lens/subject in the Z axis rather than the usual in camera focus when you move to higher magnifications beyond ~2X for the best IQ. So not only the mechanical, electromechanical and electronics, but the optics can get quite involved. With stacking and stitching then telecentric optics become an important factor for consideration if subject distortion is important.

That appears to be the approach he's using for focus - "The focus was adjusted with the tripod z-direction." - but obviously that wemacro setup looks like it would be much better.  I'm likely going to get one if only for film copying purposes.  Using a tripod kinda sucks for this sort of purpose. 

The HaD guy's approach to telecentricity appears to be to add an additional aperture stop between the main lens and the reversed one in his setup.  I'm not sure what the validity of this approach actually is - but it's something I never tried and might explain why I had many weird issues when putting a reversed 28mm lens on a 100mm lens.

Some of the commercial offerings from Wemacro and Stackshot are pretty good for those that don't want to DIY for Z axis stacking, but for very high precision work you'll need to move to the industrial type rails.

You appear to be operating at much higher magnifications than the guy on HaD - but you've got a system that can handle some of those really extreme scenarios without costing much more from what I can see.

-- hide signature --

Context is key. If I have quoted someone else's post when replying, please do not reply to something I say without reading text that I have quoted, and understanding the reason the quote function exists.

 Entropy512's gear list:Entropy512's gear list
Sony a6000 Pentax K-5 Pentax K-01 Sony a6300 Canon EF 85mm F1.8 USM +5 more
mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System

Entropy512 wrote:

mawyatt2002 wrote:

Entropy512 wrote:

Nice!

Trinamic stepper drivers have become extremely popular with the 3D printing community.

FYI a similar project hit Hackaday a few days ago - https://hackaday.com/2019/06/14/gigapixel-microscope-reveals-tiny-parts-of-the-big-picture/

Thanks.

The project over on Hackaday is very interesting, great for starters to get involved and seems straight forward.

The wood platforms and the linear rails used will need to yield to higher levels of precision, stability, and repeatability to get close to the resolutions mentioned. Most folks in higher precision and resolution stacking use precision rails and microscope objectives. Also it's usually better to move the camera/lens/subject in the Z axis rather than the usual in camera focus when you move to higher magnifications beyond ~2X for the best IQ. So not only the mechanical, electromechanical and electronics, but the optics can get quite involved. With stacking and stitching then telecentric optics become an important factor for consideration if subject distortion is important.

That appears to be the approach he's using for focus - "The focus was adjusted with the tripod z-direction." - but obviously that wemacro setup looks like it would be much better. I'm likely going to get one if only for film copying purposes. Using a tripod kinda sucks for this sort of purpose.

The HaD guy's approach to telecentricity appears to be to add an additional aperture stop between the main lens and the reversed one in his setup. I'm not sure what the validity of this approach actually is - but it's something I never tried and might explain why I had many weird issues when putting a reversed 28mm lens on a 100mm lens.

Some of the commercial offerings from Wemacro and Stackshot are pretty good for those that don't want to DIY for Z axis stacking, but for very high precision work you'll need to move to the industrial type rails.

You appear to be operating at much higher magnifications than the guy on HaD - but you've got a system that can handle some of those really extreme scenarios without costing much more from what I can see.

Telecentric optics are very interesting, do a search over at Photomacrography site, there have been plenty of discussions on this subject by very knowledgable folks. There's also brilliantly simple test for this as well!!

Placing a aperture between the stacked lens is a very good solution "if" you can get to the right position, often that position is within one of the lenses and thus not realistic.

A 28mm on a 100mm is ~3.6X which is getting into the range where objectives begin to take over with higher IQ. Some aren't expensive like the Lomo 3.7X.

Sometimes not necessarily higher magnifications but higher resolutions. I have a Nikkor PN105 F2.8 1X which is stunningly sharp even at the pixel level, but requires an extremely stable setup. This is reproduction lens optimized for 1X, and kind of a benchmark at that magnification. I use a quality teleconverter (Nikon 1.4 TCIII) to keep the PN105 at 1X but give an overall 1.4X with the converter, it's better this way than moving the PN105 away from 1X to 1.4X because it's so highly optimized at 1X. I have used higher magnifications, like 20X with Mitutoyo with a stack and stitch of some tiny Indium Phosphide chips I designed, but the the bottom line is more about achievable resolution than magnification. Since stacking and stitching are available for serious work I try to achieve the best usable resolution for a given chip subject, then if I can stack without stitching that's good, if not,  then I'll need to stitch.

I just ordered another Vertical Stand from William at Wemacro. These are really good, you will like it for copying and other macro uses. Be sure and get the horizontal option, it works really well horizontally too!!

The cost of the systems range from reasonable to expensive, especially if you count all the developmental costs. Almost all of my precision stuff is DIY with surplus gear, I've even developed my own controllers & motor drivers (some multi-axis) since the commercial ones couldn't achieve the results I was looking for.

Obsession with precision is probably a good assessment 

Best,

-- hide signature --

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

mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System

As mentioned earlier I developed a motor current sensor/probe based upon the Hall Effect, and built a breadboard to verify the operation. Then developed a PCB with a few added features and improved precision and removed offset bias due to single supply bias.

The PCBs finally arrived and I was able to assemble a board. Got all the parts soldered in for the +-2.5A version (still waiting on one part for the +-5A version) and did a preliminary check to make sure everything was in order and powered up.

I've included the ability to power the sensitive analog circuitry 4 op amps from the filtered motor supply or the regulated +5V, and the DC to DC converter negative analog supply voltage from the same (just in case). +5 volts is required for the Hall Effect sensor. The entire design is based upon precision differential techniques which don't depend on precision components, nor supply or regulator voltages to a 1st order. Techniques learned over my career with precision electronics, applied to keep from using expensive precision components.

Checked the 5 volt regulator output and installed the jumpers to power from this initially. Set the negative DC to DC converter voltage, and then the offset potentiometers to 0.000 volts for the Sine and Cosine outputs. Switched the jumpers to the motor supply (~12V), the offsets remained at 0.000 volts, then changed the negative supply from -5 to -10 volts, the offset remained at 0.000 volts. This is what should happen based on the design concepts, almost complete independence for supply voltages.

Then hooked up a stepper motor and 1% sense resistors and went through a brief calibration. Hooked up a O-Scope and the waveforms looked really nice, quick response but not much chopper noise thanks to the dual 3rd order active filters.

Now came time to evaluate the current measurement precision. Used a Fluke 87 and 77 to measure current and voltages, along with some 1, 0.47 and 0.22 ohm 1% resistors. Used my very old lab supply to supply the current, and did a calibration at 1000ma for both Sine and Cosine for 1.000 Volt/Amp. Then ran the current from 0 to 1.7amps (range of my motors) to check the linearity and precision, judge for yourself.

Current Input ma, Current Reading Output mv:

0, 0.0
12.12, 12.3
30.13, 30.3
50.6, 50.9
76.0, 76.2
100.8, 101.0
125.8, 125.8
168.9, 168.9
200.3, 200.2
256.5, 256.3
301.0, 300.7
350.3, 350.0
401.3, 401.0
451.0, 451.0
500.0, 500.0
600.0, 600.0
700.0, 700.0
800.0, 800.0
900.0, 900.0
1000, 1000
1100, 1100
1501, 1500
1700, 1698

From 100ma to 1700m the error is less than 0.2%.

Hall Effect Stepper Motor Current Probe

Blank PCB

Assembled PCB, Note Negative Supply DC to DC Converter URC, 4 Potentimeters for Offset and Scale Sine and Cosine Trim RC, Power Connector ULC, Motor Input and Output LC, and Analog Output Connectors (2) RC & BR.

Another view

NEMA 17 Stepper Motor Current Waveforms for Start and Stop, note profiles from Trinamic Controller

Stepper Motor Currents, Scale is 500ma/Div

Best,

-- hide signature --

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

Clippingway
Clippingway New Member • Posts: 2
Re: DIY Stack and Stitch System

Great post, It's very helpful. Post if you have found another solution.
I have some 3 camera video panoramas from the 1980's I want to stitch. thanks mawyatt2002

-- hide signature --
mvbk New Member • Posts: 1
Re: DIY Stack and Stitch System

Such a great and developing setup!  I have a NOS marzhauser motorized microscope stage I want to do the same thing with.  I expect I'll have to swap the motors out though for compatibility...  I have no experience with the motors/controllers/interface components and assembly other than reading and researching on and off for a year or so.  So, a novice!

The hardest part has been trying to figure out what hardware I should go with.  High accuracy is important but on a budget unfortunately!  could you suggest from your work on your project a grocery list from motor to computer by any chance?

Your custom boards sound so cool!  The current probe made me think a proximity probe could be a life saver for microscope work.

Thanks!

Mark

mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System

mvbk wrote:

Such a great and developing setup! I have a NOS marzhauser motorized microscope stage I want to do the same thing with. I expect I'll have to swap the motors out though for compatibility... I have no experience with the motors/controllers/interface components and assembly other than reading and researching on and off for a year or so. So, a novice!

The hardest part has been trying to figure out what hardware I should go with. High accuracy is important but on a budget unfortunately! could you suggest from your work on your project a grocery list from motor to computer by any chance?

Your custom boards sound so cool! The current probe made me think a proximity probe could be a life saver for microscope work.

Thanks!

Mark

Hi Mark,

Follow all the threads over on the Photomacrography site list in this thread, this should help you get an idea of things. Also spend some time on the many useful threads and notes there.

Wemacro has some very good and reasonable macro use devices, including the Micromate which be useful for your application.

I have various NEMA 11, 14 and 17 motors I use. If precision is paramount, then the quality motors from Lin Engineering and Oriental Motor are very good, but not cheap. The eBay ones from Wantai and Moon are pretty good and very inexpensive. Try to get 400 step motors, with 2 phases if you want to use inexpensive controllers.

Various controllers are available, from Cognisys, Wemacro, MJKZZ to name a few. The custom controllers I've developed utilize the Trinamic core chips, which are quite involved but extremely powerful controllers, these all run on the Raspberry Pi. Pololu also has some drivers that I've used (Tic-500), but all these require custom developed software to control.

Best,

-- hide signature --

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

mawyatt2002
OP mawyatt2002 Contributing Member • Posts: 502
Re: DIY Stack and Stitch System

Updated link to Nikon Space showing older images captured with this setup. Note the last image, this is ~29,000 by 22,000 pixels test image of a very old and abused wafer sliver that cracked off during a failed wafer split.

http://img.gg/taIZ99M

Best,

-- hide signature --

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

Keyboard shortcuts:
FForum MMy threads