Microstepping macro fun! - Page 1
Forum section: electronics / beginners

author: jshaul
author_rank: Newbie
timestamp: April 28, 2021, 06:27:47 am
content: I'm working on a 3D printed microscope-objective-to-camera adapter project. However, having concluded that (a) my focus rail is garbage and (b) manually taking 50 photos is for the birds, I acquired a usedTHK KR20 linear actuatorand an A4988 3D printer microstepping driver board.The plan is as following:Replace the ancient Sanyo Denki 5-phase stepper with a cheap NEMA 11 1.8 degree unit that doesn't need a $400 proprietary driver.Connect the stepper to the driver to an Arduino board from Banggood.Attach an optoisolator to the ESP8266 module to trigger the camera shutter. (Suggestions?)Find a way to control the entire mess from my phone.I'm currently on Step 2; I've found a cheaper, torquier NEMA stepper for peanuts. That said, even with a flash to freeze motion blur, keeping the camera as steady as possible would be nice - the more smoothly I move the platform, the less time I need between exposures.Suggestions?

author: ahmetrcagil
author_rank: Newbie
timestamp: April 28, 2021, 08:17:36 am
content: I will have a few suggestions:I see that you plan to use an arduino board to control the microstepper, you can however instead use an ESP32 board, which is in the same ballpark price-wise, yet way more powerful and faster. It can be programmed via arduino-ide, and most arduino codes work on it with no modification.If you do use an ESP32, you can get rid of the ESP8266 as well. It has bluetooth+Wifi instead of just the Wifi connection of ESP8266. That would help a lot with controlling from the smartphone part. Though to be honest I didn't quite get why you would use an Arduino AND an ESP8266 in the first place so I may be missing why you would need a separate ESP8266.What is the interface for the camera shutter? I think that item is a little vague, so if you can clarify what you meant more useful suggestions can be made.Assuming that you used an ESP32, you can use the BTSerial library, which allows you to establish the usual UART serial connection over bluetooth. There is an app in the playstore called Serial Bluetooth Terminal which allows you to connect to a bluetooth device and send commands wirelessly, just like you would from the arduino's serial monitor to a deviceP.S.: While searching for the Serial Bluetooth Terminal app I noticed that the same author also has a Serial Wifi Terminal app as well so maybe esp32 may not be necessary after all if you already have the ESP8266, however I still suggest ESP32 over ESP8266 unless you need the ESP8266 specifically for whatever reason.Good luck with the project.

author: wizard69
author_rank: Super Contributor
timestamp: April 28, 2021, 03:24:52 pm
content: It isn't clear at all what you are trying to accomplish here. You talk about focus rail issues, but it sounds like you have this all mounted on some sort of platform. So is your problem with the focusing rail or the camera platform?One big issue with such systems is mechanical stiffness which only can be compensated for to a minimal degree with your controls. If the platform takes a long time to settle mechanically then you will need to work on that first as a mechanical problem.Now if you have an issues with vibration introduced from your servo / stepper solution that may push you to a higher end driver and motor solution. You also need to make sure that your tuning is good, especially in the case of a servo where you want a critically damped tune.Quote from: jshaul on April 28, 2021, 06:27:47 amwith a low end solution you can end up with low end performance. There is a wide range of stepper drivers available out there and how well anyone will work for you project is not always easy to determine. Beyond that be careful with respect to you power supply selection if an independent supply is being used. The power supply can have a huge impact on achievable performance.QuoteDepends upon the camera and its interface. Most (many) expect a "contact closure" to trigger a camera cycle. Note that is a camera cycle, driving the shutter by itself may not even be possible, again it depends upon the camera. I do ownder why you wnat to drive the shutter.QuoteThis is one of those things that is not simply an electronics problem, your mechanics have to be suitable for the task at hand. You can see this in the multi axis robots employed in industry. These machines start out with large and stiff bases and taper down structurally to the end effector. At the end there is surprisingly little capacity, at the end effector, to keep the mechanism within the specified operating conditions. In any event what I'm trying to get at here is that you need a suitable mechanical structure to get a steady hold and fast settling.

author: mawyatt
author_rank: Super Contributor
timestamp: April 28, 2021, 04:14:55 pm
content: You have made some excellent choices!! Consider a quality 400 step NEMA 17 motor over a 200 step, and also consider metal adapters over the 3D printed version. Many have tried the 3D route with little success, as the plastic tends to "droop" with age, weight of the objectives, humidity and temperature.We've done lots of work with the THK type linear rails, the KR15, KR20 and KR26, they are excellent for macro work. Also the Trinamic device are the best stepper controllers we've encountered, and we designed custom controllers based around the Raspberry Pi.Over at Photomacrography you can fine lots of information on macro work in general and specifics about using a focus rail. We've published many threads, and commented on many threads related to such, here are just a few.https://www.photomacrography.net/forum/viewtopic.php?f=25&t=38511&hilit=Stack+%26+Stitchhttps://www.photomacrography.net/forum/viewtopic.php?f=25&t=38512&hilit=Stack+%26+Stitchhttps://www.photomacrography.net/forum/viewtopic.php?f=25&t=39428&hilit=Stack+%26+Stitchhttps://www.photomacrography.net/forum/viewtopic.php?f=25&t=38353&hilit=Stack+%26+Stitchhttps://www.photomacrography.net/forum/viewtopic.php?f=25&t=39473&hilit=Stack+%26+Stitchhttps://www.photomacrography.net/forum/viewtopic.php?f=25&t=39756&hilit=Stack+%26+Stitchhttps://www.photomacrography.net/forum/viewtopic.php?f=25&t=38604&hilit=Stack+%26+Stitchhttps://www.photomacrography.net/forum/viewtopic.php?f=25&t=39396&hilit=Stack+%26+StitchThe WeMacro stand is an excellent cost effective stand, and with a few simple mods becomes a very good stand indeed capable of horizontal and vertical use.https://www.photomacrography.net/forum/viewtopic.php?f=25&t=38838&hilit=Stack+%26+StitchWe also have developed custom illumination capabilities, some based upon LEDs and modified LED lights.A few years back when we needed precision resolution beyond what the THK KR rails could deliver, we developed techniques and controllers for Piezo Electric Control down to the few nanometer levels of resolution.You can use the search function over at Photomacrography (use author mawyatt) to find more information on all these developments that we've been involved with the past decade.BTW a number of years ago we developed gigapixel images of silicon chips, many of which we designed. These endeavors were traveled to allow the details of our chips to be shown, help with our presentations, and supply to our special customers.Hope this helps,Best,

author: jshaul
author_rank: Newbie
timestamp: April 28, 2021, 07:49:40 pm
content: Quote from: ahmetrcagil on April 28, 2021, 08:17:36 amMy mistake; I'm referring to an Arduino-compatible ESP8266 board as an arduino. Can you suggest a cheap ESP32 board? I was not aware they had Bluetooth; I had assumed I needed an add-on module.Quote from: ahmetrcagil on April 28, 2021, 08:17:36 amIt's a standard camera shutter cable connnection - I believe a 2.5mm TRS jack is standard. You close a switch on the tip and it hits the shutter; you close a switch on the ring and it focuses.Quote from: wizard69 on April 28, 2021, 03:24:52 pmA focus rail in photography refers to a platform that may be advanced a fraction of a millimeter at a time for macro stacking. The platform is pretty much a brick with a ballhead on it.Moving the camera smoothly rather than abruptly stepping it forward and stopping it is still preferable, though it may not be much of an issue when advancing .05 millimeters at a time.As for the power supply, it's 7.4v at about five amps. Should be fine for a single stepper rated at 0.7 amps.Quote from: mawyatt on April 28, 2021, 04:14:55 pmI have a little experience with focus rails; I'm actually an adult student (former photographer's assistant) going to school for commercial photography and I'd like to have my own setup - preferably with substantially more automation than the school's manual platforms.The KR20 was selected based on recommendations from other users. As for the stepper motor driver, it is a standard 3D printer part known for good performance. Is it not suitable for purpose?I had great difficulty finding a reasonably priced 0.9deg stepper that was not prohibitively expensive or inadequate in performance. I figured on building a reduction drive if the current setup was inadequate, but 16-step microstepping at 1mm per rotation should provide adequate performance for my requirements.Quote from: mawyatt on April 28, 2021, 04:14:55 pmThe PLA is a temporary prototype to determine if theAMSCO microscope objectiveis spaced correctly to the sensor. The finished product will be produced using something exotic (glass-filled nylon?) or built from an aluminum tube and a little laser-cut acrylic. The objective in this case is unusually light, but I understand your frustration with 3D prints.Quote from: mawyatt on April 28, 2021, 04:14:55 pmI am in your debt for the benefit of your experience.As you can tell from the limited, magnification, low budget, and very light weight, this is a relatively unambitious setup. I was looking at using an A/C powered strobe triggered from the hot shoe for the power and high color fidelity....and because already own a few.As for the stand, I was hoping to retain the use of a conventional heavy-duty camera tripod - hence the emphasis on light weight. I have the daft idea of actually using this in the field. In my defense, it is a very expensive tripod. I also have some photographer's clamps and other bits to securely mount it to other objects.Part of the goal is to make it as light as possible

author: mawyatt
author_rank: Super Contributor
timestamp: April 29, 2021, 05:22:23 pm
content: Quote from: jshaul on April 28, 2021, 07:49:40 pmJust a few notes on this.First consider using a much higher voltage (12~24VDC) for the typical NEMA 17 type motors used with the KR20, there are many reasons for this and you should study the way stepper motors operate with modern controllers to understand why. With such a low supply voltage the switch mode operation of these modern controllers may bang up against the voltage rails during quick maneuvers and this will likley ruin your images with excessive motor vibration. The controllers we mentioned are superior to any of the standard controllers we evaluated, from the A4988, TI DVR types and Toshiba types. The TI DVR types have excessive non-linearity micro stepping and the Toshiba have a dead zone the the motor current around zero, all of which will fight your attempts at acquiring quality images. Most 3D printer drivers are nowhere near the performance of the Trinamic devices mentioned, especially when the Velocity and Movement profiles are employed with a proper characterized motor and rail, please check the videos on the links over at the PM site to see how well these work! Some of the later 3D printers are now being supplied with the baseline Trinamic devices and already showing benefits of smoother operation, and the reduction in noise levels is quite impressive, with the proper setup the motor can barely be heard, even a high velocity.The fundamental advantage of a 400 vs 200 step motor is the cogs are precisely positioned and much better precision is achieved with 400 steps. Micro-stepping is fundamentally imprecise as it "attempts" to position the rotor between the cogs, and variations in load torque will cause slightly more rotor movement with micro steps. A 400 step motor with a 1mm pitch KR20 can achieve 2.5 microns per step, and don't fall into the trap that makes you think you can do much better than this using micro stepping. With a 16 micro step you will be 2.5/16 microns which is ~156 nanometers, this is not going to happen!! Realistically you can get just below a micron with 4 step micro stepping but this requires a quality motor, rail and setup, anything below is just fantasy. This is exactly why we developed the piezo electric stages to operate below a micron, and this took a long time and very expensive to develop.We never tried any of the 3D printed adapters, even with the exotic fiber types, learned from the many others that had tried. You will soon find that anything possible will corrupt your images as you move into higher magnifications beyond about 1X, things like the AC air currents and thermal drifts, sounds, walking nearby, cars going by, doors closing, even airplanes flying over, pool pumps and so on. Everything contrives to corrupt your images and Murphy has a field day withs setups!! Tripods, regardless of cost, are nowhere near good enough at higher magnifications compared to the dedicated microscope and macro setups, the mentioned WeMacro is an excellent device, specifically designed for macro use, and very reasonable. Edit to add, a microscope or good macro setup attempts to keep the subject and lens/camera rigidly connected together and not isolate between them. The idea is to have the subject and camera/lens movement limited wrt each other, so they move together not separately. This is called Common Mode in engineering terms and works well at low external influences, however as the frequency of the external influence (vibration) increases the Common Mode behavior begins to deteriorate and you must do things to reduce the external influences. Another annoying source of movement is the camera shutter, when the mechanical shutter opens for the exposure it introduces vibration and can blur the image, so generally you must wait a delay to capture the image to allow the shutter induced vibration to subside, this is where flash helps since it can be configured to create the effective exposure. With the new electronic shutters this vibration is mitigated, but these introduce another issue (beyond the scope of this discussion) regarding the use of flash...so no free lunch!!If the objective lens is the AmScope 4X $18 verison mentioned many years ago on PM and discussed at Roberts site below, this is an excellent choice. You can also find loads of information on Robert's site regarding lenses (the old Soviet Lomo 3.7X is also a great value lens). Using an old dedicated bellows (stay away from the cheap eBay bellows, they are worthless for this application, get a old Nikon or Canon bellows) with these finite objectives makes changing magnification easy and works very well with the proper adapters and DSLR camera.https://www.closeuphotography.com/seventeen-dollar-plan-4x-objectiveYou don't need to spend lots of $ to achieve good results, but do need to start out with something that can at least support a reasonable attempt for starters. Many have "been there and done that" long, long ago, so you can save yourself emmese frustration and $ over the long run by starting out with something that is fundamentally capable as a baseline.BTW establishing quality lighting is a whole other topic, again lots of information over a PM. Studio strobes are very useful, but usually require many to get the proper levels of diffusion and intensity required, we've used up to 12 simultaneously triggered. Found that heavy duty "C stands" are the best for supporting the heavy strobes using the long extension arm to position the strobes close to the various diffusers utilized. A few years back we designed custom strobe equivalents to get the results we were looking for, in fact just about everything eventually ended up with full custom designs, from lenses, camera mounts, rails, motor controllers, stack & stitch automation, lighting devices, even means to bypass the trigger blocks by Nikon in the fully electronic shutter modes on the D7 and D850. Just the other day we were contacted by a group doing some sophisticated macro stack & stitch work for various museums, they are interested in our custom LED strobe equivalent setups. Here's couple images of one stack & stitch setup based around the Thor Labs optical lab devices.Should add stacking in the field at higher magnifications is more difficult than in the studio since you now have all the environmental effects against you, especially subject movements and lighting. We've never tried this, but a few others have with limited success. Some of the more successful field images were captured using 4k Video and then stacking the frames, this had the advantage of capturing a burst of high speed frames, rather than a long set of stacked images. With new 8k Video this might be worth considering for higher resolution results.Anyway, good luck with your endeavors!Best,

author: jshaul
author_rank: Newbie
timestamp: April 30, 2021, 04:03:05 am
content: Quote from: mawyatt on April 29, 2021, 05:22:23 pmThank you for your input.I wish to stress that this is abeginnerproject, not intended to produce professional images but to accomplish the following:Build a Bluetooth arduino deviceBuild a stepper motor device from scratchLearn to interface with a cameraAvoid multiple incredibly tedious student labs by building a robot to do it for me.The KR20 is a nice piece of hardware, but the standard of performance I'm trying to improve on is ahand cranked positioning slide and a shutter release cable.As for strobes...well, my kit is actually a lot closer to yours than you might think (2xAD600 + 2x SK300II).It looks like a setup suitable for the 4x objective is beyond me, so let's start with a less ambitious but still useful target - my cheapo Canon 100mm f/2.8 non-L non-IS poverty macro lens. The primary application for this device is *below* 1x magnification - simple product shots of small objects that benefit from not being shot at f/32. I will investigate a macro stand as you suggest, but I do not have the budget for such things right now.I appreciate the photomacography website is a valuable source of information, but it's incredibly opaque, poorly organized and - most importantly - frequently out of date. I have found much discussion of the Trinamic controllers you suggest, but few specifics. Isthis TMC2208unit suitable? Do I really need the TMC5130? And will I see any improvement without implementing advanced functions like acceleration?Remember, I'm a photographer, not an engineering student. People are genuinely excited I can solder a 1/4 TS jack on a length of lamp cord.

author: mawyatt
author_rank: Super Contributor
timestamp: April 30, 2021, 01:01:32 pm
content: You have a good start with the strobesStarting off with the standard Canon macro lens is good, then you can work your way into the 4X lens with a bellows and adapters. The TMC2208 StepStick is Ok, but might not have all the Trinamic features available that the 5130, 5160 and 5072 have. The older TMC5160 StepStick had the chip pin required to access these additional features grounded underneath the package, so you couldn't enable. The latest version has this pin brought out for a jumper resistor to enable.Many years ago we elected to go with the larger Trinamic BOB type PCBs since all the pins and features are available, and these still aren't expensive (~$20). Anyway, all these devices require custom software and need to be interfaced to whatever computer you choose.The PM site has an enormous amount of quality (read no BS) information, from many world class macro folks. You need to spend many days going over things there to get a good perspective of what's involved moving beyond 1X. Another member has a good macro site here:http://extreme-macro.co.ukGood luck,Best

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 30, 2021, 04:02:50 pm
content: GRBL has not yet been mentioned in this thread, while that is presumably the go-to for stepper motor controlgrblHAL is becoming the umbrella project for GRBL beyond 8-bit arduino and apparently works for STM32, LPC, Teensy, ESP32 and probably others.I have a bit experience with bCNC. It has a pendant interface which can be controlled via a web browser (But have not really used it myself). That should work on your phone.

author: mawyatt
author_rank: Super Contributor
timestamp: April 30, 2021, 06:25:22 pm
content: A number of years back when we began working with the Trinamic devices, we looked into the software for the 3D and CNC use and thought about trying to adapt it to our intended use for focus stacking and stack & stitch work. What we found then was that the 3D software algorithms used did not take full advantage of the Trinamic device features, and simply used the device as a "driver" with just Step and Dir commands like used with the other driver chips, that may be different now tho. The mentioned Trinamic devices have a built-in micro-controller which hosts all the advanced velocity, positioning, motor control algorithms, which include the very effective motor noise reduction techniques which employ pulse modulation spreading, and motor current waveform manipulation. We decided to develop our own custom software to take advantage of these Trinamic algorithms which work quite well indeed!! Keep in mind we were attempting to achieve sub-micron performance, so not the usual requirements.Stacking work at 1X can also be somewhat difficult if you are attempting to achieve very accurate renditions of the subject, we were imaging large silicon chips which required very accurate positioning and high resolution for the quality images we were after. The lens employed to do this needed absolutely flat field and no distortion, along with very high resolution. The old Printing Nikkor PN105 F2.8A (somewhat rare & expensive) was selected. This old lens was designed for duplicating studio movie video film at 1X (movie theater quality) and can out resolve the Nikon D850 or D7 with a proper setup. Here's a note from Coin Imaging.http://coinimaging.com/lens_tests_new.html?"Conclusions:This is an unusual and hard to find lens that is expensive and optimized for a narrow magnification range (optimized for 1:1) It is difficult to adapt to a camera, but it can be done either through a Rodenstock or through a custom adapter. The results are worth it, given a few caveats.This lens has exceptional resolution and sharpness, outperforming every other lens that I have tried from about 0.60:1 to 1.5:1. There is a slight dip in the sharpness and resolution at 1:1. The field is dead flat at 1:1, but the corner sharpness suffers a bit above and below this magnification. There is almost a total lack of distortion and virtually no chromatic aberration. Since it has a focal length of 105mm, the working distance is very good across the magnification. It has very good contrast, similar to a modern macro lens."So even 1X can be challenging depending on what you are attempting to achieve image wise.BTW do you know if the GRBL supports the Trinamic builtin algorithms?Best,

author: jshaul
author_rank: Newbie
timestamp: May 01, 2021, 02:57:53 am
content: Quote from: Doctorandus_P on April 30, 2021, 04:02:50 pmIn this case, the function of the device (move a camera 1mm-100mm over several minutes; close a switch repeatedly during this time) that I'm not sure I'd benefit from such functionality. The arduino (or compatible board) isn't a control device; it's theentiredevice - it's simply not that complicated. The phone simply dictates the number and size of steps. (I could use buttons, but I would like to learn to use Bluetooth and one of the off the shelf IoT control systems.)Is there a motion control benefit from using this system for this application? This is essentially a toy that is electrically and in software the simplest possible implementation of a CNC machine. If I build a professional version, I will definitely consider it.Quote from: mawyatt on April 30, 2021, 06:25:22 pmTrinamic has some arduino code to access their boards over serial on their website.If I use that, is everything good to go? Just tell it to step via serial and the board takes care of the rest?

author: mawyatt
author_rank: Super Contributor
timestamp: May 01, 2021, 01:54:41 pm
content: Quote from: jshaul on May 01, 2021, 02:57:53 amWe didn't use the Arduino, nor the code, because we wanted a full computer interface that could support the complex Stack and Stitch efforts envisioned, as well as enable all the required features of the Trinamic devices. Also since the Trinamic devices have built-in microcontrollers and motor drivers, the need to do all the control details and speed of the external controller isn't required. This ended up being a custom software development on the Raspberry Pi using Python. The RPi can be operated over WiFi, so remotely can be controlled, or one can use a USB or Bluetooth Keyboard and Mouse, very flexible and useful setup. We've even used a tiny 7" HDMI monitor on the RPi with a Keyboard and Mouse.You need to setup the Trinamic devices with the proper parameters, check out the data sheets to get familiar with the various parameters and features. They can do simple Step and Dir commands like other drivers, or much more complex movements involving profiles for acceleration, deceleration, peak velocity, motor current waveform manipulation, start and stop steps, motor stall detection, and so on. If you follow the links to PM provided and spend some time there you can see the RPi and Trinamic developments, also allocate some quality time studying the Trinamic data sheets to select the device you will use.Best,

author: mawyatt
author_rank: Super Contributor
timestamp: May 02, 2021, 06:22:07 pm
content: We routinely work where the DOF (region that is in acceptable focus) is +-1.6 microns. For stacking it's generally acceptable to move the camera/lens 1/3 to 2/3 the DOF to maintain a smooth transition between stacks in the final image rendering, this is with resolutions as small as 700 nanometers (0.7 microns). So extremely precise positioning is required, much more so that with general 3D or CNC work, and another reason we opted to develop our own setups based around the THK Linear Rails you selected, and 400 step motors with Trinamic controller/drivers. Some others over at the PM site decided to use the Arduino with modified 3D printer code, and got this working OK, but could never achieve the results they were looking for. Finally they decided to enable the Trinamic Velocity, Acceleration and Motor Profiles, the comments were "Wow, what a difference in performance!!".You are also constantly fighting optical diffraction and striving for the lower possible effective aperture, where effective aperture is the lens actual aperture times (magnification + 1). Many get confused by this since they think the reading on the camera or lens is the effective aperture, these are usually with the magnification near zero since they are relative to imaging much larger subjects than the camera sensor where magnification is small. Special microscope lenses use numerical aperture, or NA, where effective aperture is Magnification/(2*NA). NA follows the bigger the better, as does NA vs resolution, so most seasoned macro folks work with NA and not the aperture from the camera or lens setting.Lots of things change from conventional photography when you enter the macro region, so plan on spending some time leaning about this area and how it relates to conventional photography.Anyway, you are in for loads of fun with your macro work, it can become addictive.Best,

author: jshaul
author_rank: Newbie
timestamp: May 04, 2021, 08:51:19 pm
content: Quote from: mawyatt on May 02, 2021, 06:22:07 pmI'm a bit confused because Trinamic lists code for Arduino on their website. Does this code not support uploading profiles as you describe?https://blog.trinamic.com/2017/04/05/how-to-use-tmc5130-eval-with-your-arduino-mega/Quote from: mawyatt on May 02, 2021, 06:22:07 pmI am quite familiar.In this case - as strange as it sounds - the primary application is actuallylarger than 1:1.I've been taking a lot of pictures of flowers with fancy lighting due to covid restrictions, and shooting everything at F/22 sucks.Stopping down to f/5.6 (iris setting, not actual f-stop) should do wonders for image quality and stacking a dozen images will fix my depth of field issues.I may well invest in a pan-n-scan setup, but it's mostly because I'm too poor for the Hasselblad you're supposed to use for the job.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 04, 2021, 09:05:19 pm
content: A few days ago my response (and about 5 others) got eaten by this forum.If you just want to control a single axis, then GRBL is indeed overkill. If you want to add multiple axis, for example for pan and tilt for your camera, then GRBL can still be interesting.You could use GRBL in several ways.The simplest is probably to see it as a "black box", and just send text strings to it from another microcontroller.GRBL of course has an input buffer somewhere in the code, so you could just add your own code to GRBL (It's an open source project) and then write those text strings (as G-code) to GRBL's input buffer. GRBL also has a "pendant" interface for jogging axis etc, so manual control is also possible.Support for Trinamic stepper drivers is also being integrated into GRBL. GRBL is moving.For the curious: 1200 lines of code in:https://github.com/grblHAL/Plugins_motor/blob/master/trinamic.c

author: mawyatt
author_rank: Super Contributor
timestamp: May 04, 2021, 11:55:16 pm
content: Quote from: jshaul on May 04, 2021, 08:51:19 pmThe code they were using did not invoke the Trinamic internal profiles, the 3D printer code was used with many of the stepper drivers that don't have a built-in microcontroller with the various profiles. Once they enabled the Trinamic built-in profiles the results improved significantly. Don't know if they used the Arduino code from the website tho, since we selected the RPi we never did anything with the Arduino.We've been using the THK KR linear rails for almost 10 years is seems, many others have discovered these lately and they are becoming scarce. If yours is in good shape and the bearings are clean, you have a jewel of a linear rail!! If it has 1mm screw pitch all the betterOthers that don't know much about focus stacking end up DIY using components from 3D and CNC use and don't get the precision performance of these THK rails. Every THK rail we have has zero measurable backlash and wobble, and we have a few (8 I think). I'm sure there is some backlash and wobble but we can't measure it, or see the effects. Long ago before the THK we had commercial linear rail setups which exhibited some backlash and wobble, ended up having to "load" the rail with an off-axis load to keep the backlash and wobble from causing issues.Best,

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 05, 2021, 12:53:49 am
content: I'm not familiar with the KR20 nor with focus stacking but if you want sub micrometer accuracy you're pushing the limits of a stepper motor directly coupled to a (ball?) screw.I believe that 400steps/revolution steppers have a real advantage here, but probably so does a bit of gearing down, for example with a timing belt and 1:4 pulleys, but the cheap chines pullies (or 3D printed ones) have bad centering and wobble and are not suitable here.What is the total needed adjustment? Maybe a few cm? (Apart from a coarse initial setup for the lens length if you want to use different lenses)If so, then I'm more thinking around some parallelogram construction and a flexure.Flexures are inherently free of any play or backlash.Micrometer heads are also common mass produced items and pretty cheap.Maybie Piezo motors? Very precise, but they may be hard to find and/or expensive.

author: mawyatt
author_rank: Super Contributor
timestamp: May 05, 2021, 04:47:17 pm
content: Quote from: Doctorandus_P on May 05, 2021, 12:53:49 amYou should spend some time studying Focus Stacking techniques and equipment, the THK KR20 type linear rail the OP mentioned and the THK unique screw thread coupling mechanism utilized, this way you can become knowledgable about techniques and equipment involvedSub micrometer accuracy can be achieved with the THK KR20 type rails with 1mm pitch threads and a quality 400 step motor utilizing the Trinamic controllers. Although everything must be in perfect order to achieve this level of precision, however you are near the limits of performance.QuoteYes, quality 400 step motors are superior to 200 step motors for focus stacking, mainly because of the precise machined cogs rather than relying on controller microstepping. Gearing down usually has the issues of gear backlash and non-uniform motion unless very expensive quality gears are utilized, and belts are much worse. The mentioned KR20 utilizes some very high quality screw threads and coupling mechanism to enable the kind of performance levels discussed, anything between the quality 400 step motor and the THK linear rail will likely degrade this level of performance.QuoteThis depends on the setup, lenses, camera and subject. We've centered around 100mm full THK linear rail movements which hasn't become a limit but our subjects are small chips which are under 30mm on a side. Some of the custom lenses we've developed are quite long, ranging to ~300mm in length, so our setups involve an arrangement where the THK KR rails are directly mounted to secure sliding clamps (like the Thor 95mm sliding clamps) which allow coarse positioning of the rail sliding along a heavy extruded aluminum bar, and the KR rail holds camera/lens directly mounted. Quality long ARCA plates and clamps also work well if setup and configured properly, here the THK rail is directly bolted to the long ARCA plate or clamp depending on what the setup requires, and the other side of the ARCA slides along the extruded bar for coarse positioning.QuoteA few years ago we developed Piezo Electric actuators around the Physik Instrumente devices that utilize flexures (they are also noiseless) for the purpose to go beyond sub-micron performance for focus stacking and have achieved tens of nanometer levels of performance. This undertaking took some time and was expensive as we developed full custom open and closed loop controllers, the closed loop controllers utilized complex feedback based upon multiple strain guage bridge structures to measure and feedback the deflection of the flexures.Here's a link to the developements over at PM, fun reading the entire post especially if you are into precision systems and feedback control theory.https://www.photomacrography.net/forum/viewtopic.php?f=25&t=40510&hilit=Piezo+ElectricEdit: Here's couple images showing how the rails are setup. The first shows a Thor Labs vertical 95mm clamp setup and the others show a horizontal & vertical setup based upon the modified WeMacro stands. Note the pair of KR15s on the end which are used to move the subject for S&S work.Best,

author: mawyatt
author_rank: Super Contributor
timestamp: May 05, 2021, 06:04:30 pm
content: Here's couple more images.Best,