Anatomy, A DIY Precision S & S System (Electronics)

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

Moderators: rjlittlefield, ChrisR, Chris S., Pau

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

Anatomy, A DIY Precision S & S System (Electronics)

Post by mawyatt »

Hello,

Here's the second part which is about the electronics and final configuration of the DIY Precision S&S System.

I've done a lot of investigating into what to use for the computer and stepper motor controllers for the DIY Precision S&S System. I didn't want to use a PC as mentioned, but would consider using a Mac, or something that runs on a Mac.

The Arduino is the logical choice for this task if one is familiar with it and has a good software background, I fail on both accounts and thus chose the Raspberry Pi 3B. The Raspberry is an exceptionally complete computer with just about everything, way overkill but it only costs $35!!!

The Raspberry boots up with a proper OS, that has all the features required to do just about any task at hand already built-in, things like WiFi, Bluetooth, 4-USB, micro-SD card, HDMI, Ethernet, dedicated I/O and so on.

First off I got some various motor drivers from Adafruit, I tried everything they had. They all worked, this was acceptable for a simple robot or hobby toy, but not what I was looking for. Then I ordered some stepper motor drivers boards from eBay based upon various driver chips (later I discovered these are copies of Pololu boards). After I discovered Pololu and their special section on motor controllers, I ordered more motor driver boards only to find out that the Ti parts (DRV8825) have some issues with micro stepping. Then I ordered some other boards that were not based upon the Ti parts, these worked well but not quite as good as I was looking for. The Raspberry Pi can't really keep tabs (various reasons) of the precise motor location at higher speeds, and I wanted things to operate as fast as possible without giving up precision, since I was planning many massive S&S sessions.

I ordered the Pololu Tic-500 which is micro-controller based and uses the MPS6500 stepper motor driver chip. This proved to be what I was looking for!! I can interface to the Tic-500 with USB (Pi has 4), the controller keeps tabs of the precise motor location, and handles things like max speed, acceleration, motor current, motor voltage and so on. The steppers can run very fast to reduce time, but are exactingly precise without missing steps nor position errors. The acceleration and deceleration methods allow excellent motor control from start and stop positions without imposing sluggish movements or severe speed limitations. It just works, and works very well indeed!!!

Now that the motor controller was selected, I needed to create an few cables and get to using the Raspberry to trigger the camera and strobe. Since I will be using EFCS & ESCS (no mechanical shutter curtains) I wanted to include the strobe delay effect to position the firing of the strobe near the end of the exposure when EFCS & ESCS is used. Nikon blocks the hot shoe trigger in this mode, as do other cameras. I used a simple optical coupler based design and also included and LED so you can see when the camera is triggered (Green) and then when the strobe is triggered (Red). Here's the notes from my notebook and the actual circuit built up on a prototyping board. The dual connectors allow the use of 3.5 or 2.5mm connectors without adapters. The extra space on the board is for a future 12V to 5V converter to allow everything to operate from a single 12V supply, now the system requires 5 & 12 volts. The 6 pin connector interfaces with the Raspberry Pi GPIO connector, and the 3 2 pin connectors are for suppling 12 volts to the 3 Tic-500 controllers.

Image
Image

Here's an image of the Raspberry Pi 3B, interface board, and 3 Tic-500 controllers. Red marked is for the Z axis, Blue the X axis and Yellow the Y axis, also the cables that are required.

Image
Image
Image

This is all it takes to run the DIY Precision S&S System since the Raspberry has built-in WiFi which allows direct VNC use and the setup can be operated anywhere on the wireless WiFi router range from another computer. I'm amazed at how well this works, it's not just a window, but the entire Raspberry screen is available remotely....just like you have a keyboard, monitor and mouse plugged in to the Raspberry!! You can operate the entire computer remotely as well, including shutting it down! It's like having a full Raspberry Pi 3B inside a Mac window, but the Raspberry is completely remote.....very cool indeed!!!

Image
Image
Image
Image
Image

The software is written in Python and a few thousand lines of code. It's designed to allow reruns with minimal effort and keystrokes, and supports user file names to store and recall stacking parameters. Operation is from a Python shell and requires a couple "sudo" commands to load up things before the program begins for first time execution.

Rail zero, start, end and step size are input, positioned (actual rail check out) and stored for Y and X axis. The Z axis zero is stored, however the start, end and step size are separate parameters for each Y and X position if desired, and the Y and X rails travel to each position to allow the Z parameters to be established. This allows fine tuning the Z axis focus stepping and not taking extra images of out of focus areas, especially when tilted subjects are used. I've included a black/dark image (no strobe) to identify each Z axis stacking session, which should help when doing the post collection stacking (I use Zerene for this). This is an evolving effort, so additions, updates and error corrections are expected.

I'll be adding details on the Thor Labs based setup soon, probably in another thread so as not to clog this one up.

In the interest of keeping this thread from becoming a boring "assembly manual" and supporting those with a keen interest in these DIY efforts, please use PM for any information which might involve long drawn out answers.

I really hope this helps folks that are tempted to tackle a project like this, you can do it!!

Remember I have no real prior experience with programming and with the Raspberry Pi computer, my computer experience is somewhat limited to using the Macs :shock:

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

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

Post by mawyatt »

Here's a few screen shots of a Mac screen with the Raspberry Pi running with a VNC. This is a demo S&S Routine file (stackdemo1) I use to help check things out.

It starts a Y Sweep at 12mm to 16mm with 4mm steps and X sweeps from 10mm to 20mm with 5mm steps, so a 3 by 2 X & Y stitch. Z stacks are at each X(Y) position with 10 micron steps at different start and end points.

This is a work in progress and needs some cleaning up and such, but is pretty stable and doesn't crash except with highly erratic inputs (it's not totally key entry foolproof). Anyway, this is certainly good enough at this time to begin to consider some serious stack and stitch sessions.

Best,

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

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

Post by mawyatt »

If anyone is interested, Pololu has a Black Friday Sale that started at 9am EST today. The Tic-500 stepper motor controllers I'm using are only $9 each!!

This is for the 1st 50 customers and a limit of 4 per customer.

https://www.pololu.com/blackfriday2018? ... sneak-peek

Happy Thanksgiving,

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

elimoss
Posts: 41
Joined: Wed Sep 12, 2018 11:31 am

Post by elimoss »

Discovering the wonders of VNC is always fun!
Bravo, great work here!

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

Post by mawyatt »

Thanks.

Yes it is, and VNC works even better than I expected!!

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

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

Post by mawyatt »

Finally got the components for the 12V to 5V conversion, this took 2 months from eBay, but they finally arrived.

This works beautifully and can run all the rails as well and the Raspberry Pi 3B from a single 12 volt 2.5a supply!

Wiring modern converters up in series can be a problem, because these are by design negative input impedance devices. What that means is the input current goes down as the input voltage goes up, or the rate of change of input current with respect to input voltage is negative, Ohms law tell us this has a negative impedance. Add to this the complexity of the energy recovery with the stepper drivers I'm using (returning partial motor current back to the supply) and I would not have been surprised if the whole system became a motor-boat oscillator (old term to describe non-linear low frequency oscillatory behavior, usually highly undesirable). Knowing about this I added additional loading capacitance (220uF) on the inputs and outputs, since most converters like heavy load capacitance. Also used a couple LEDs (Blue and Red) to indicate Input and Output Activity and supply a little real positive resistance too.

I used a micro-USB connector to supply the 5 volts to the Raspberry, and wired the other end to a 3 pin eBay connector. All the connectors are different, so no chance of plugging in the wrong thing.

Plugged in the 12 volts and set the output to 5.30 volts with the blue pot before connecting the Raspberry. Good thing I did since the output voltage was ~11 volts initially, and the Raspberry would have gone up in smoke!! No hints of motor boating or any other misbehavior, so I plugged everything in and then the 12 volts.

The Raspberry booted up and I loaded the XYZ Controller program and ran some demo routines. Everything works fine and the 12 volt to 5 volt converter isn't even warm (it's supposed to be ~90% efficient)!!

Only problem I have is the Blue LED (~10ma) is really bright!!

I had ordered different converters (different design) just in case this didn't work, but they won't be necessary.

I like it when things work and sometimes even better than envisioned, however the reverse is usually the case!!

BTW all these electrical components are cheap, and available from multiple sources on eBay with exception of the Raspberry Pi 3B and Pololu Tic-500.

Best,

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

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

Post by mawyatt »

I've been thinking of putting a kit together of some of the electronic parts. This wouldn't include the stands, rails, Raspberry Pi 3B or Pololu Tic-500s, but some of the basic components required to pull this all together. Might also include the Python code on a micro-sd card for the Raspberry Pi.

This would be for those folks with a real interest and capable of this level of DIY project. I'll provide help and guidance but don't want to get into a "handholding" mode where I spend lots of time with stuff that should be straight forward for a knowledgable DIYer.

This setup is completely customizable and should work with any cameras, strobes/flashes, rails and small stepper motors typical (NEMA 11 & 17) of macro use.

I'll probably do this for free, or pay what you want, as long as it doesn't get too expensive on my part.

I'm not committing to do this, just "thinking" about something with a Holiday Spirit for some of the great folks here.

PM me if your interested.

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

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

Post by mawyatt »

Per discussions on another thread I've looked into creating a Z Axis Limit detection system based around the Panasonic GX-F12A sensor.

https://www.photomacrography.net/forum/ ... sc&start=0

This sensor is interfaced to the Z axis motor controller/driver (Pololu Tic-500) to allow "Home" detection for getting the camera/lens out of the way. So periodically, or when things are changed, a "Find Home" routine can be executed to establish a "Safe Home" position for the Z axis. At this time I don't think this is necessary for the Y or X axis since they only move the subject, but later if I find I require a "Home" detect for Y and/or X axises, I'll be able to implement these axises without much additional effort.

The GX-F12A has 3 additional wires, so I decided to move the motor controller/driver onto the THK KR20 rail/motor assembly I'm using as a Z axis focus rail. Because of this only 2 cables were required to the THK KR20 assembly, a USB and 12 volt power cable.

Here's some images of the configuration.



Image
Image
Image

Edit: I've added the GX-F12A and moved a controller to a HIWIN KK50 (THK KR26 type), here's a couple images. The initial Homing routine is also working well and integrated with the S&S developmental software (Python). This works by driving the motor slowly towards the start until the limit sensor is activated (ON-goes low), then changing direction and moving very slowly until the sensor returns to deactivated open state (OFF) then this is defined as zero start home position, with position set to 0.

Best,

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

Post Reply Previous topicNext topic