📜 ⬆️ ⬇️

Macrorails on MSP430

Hi, Habr!
May holidays parade around the country, which means the photo season is already open. Someone travels to distant countries, someone stays closer to nature somewhere in the village, and I shoot every little thing. How to make life easier for macro photography? I decided to tell about it today.

The main problem in macro photography is a very shallow depth of sharply depicted space (DOF).

As the wiki writes:
“The depth of the sharply depicted space (DOF) is the ability of the lens to display sharp objects located at different distances from it. It directly depends on the most important characteristics of the optical system: the main focal length and relative aperture, as well as the focusing distance. ”


The story about the depth of field is a topic for a separate article with pictures, tablets and GOST 25205-82. I leave the link to the theory below.
')
Usually, to increase the depth of field, the diaphragm is closed, which leads to other problems, for example, a lack of light causes us to raise the ISO, the larger values ​​of which generously send us noise. Yes, and the diffraction limit of optics can play a cruel joke when increasing the zone of sharpness, we will lose in the very sharpness.

One of the ways to deal with a small GRIP is a combined focus, combining several images in which the focus area shifts along the object of interest. Then the pictures are aligned relative to each other, and the composite is assembled using sharp parts from each frame.

For convenience of movement when shooting along one axis, macrorails are invented.

The cheapest models have such a construct:


But there are top models like StackShot STKS-100-PKG for $ 500. And this is without delivery!

Having come across this device, I decided to repeat it from the improvised trash.

The main thing that we need is a CD / DVD drive, In it there are those guides that already have quite high accuracy. Naturally, the fotik itself does not roll on them, but if you roll the object for shooting then it will come down. Since there is no way to find documentation for a control chip for a shaker CD drive, let's take the common StepStick driver on the A4988 chip.
The minimum scheme for connecting MK:


I skip disassembling the drive, it's boring. We need to remove the boards, the asynchronous device that turns the disk, the load / unload drive, and all that we can skip from the carriage, do not lose the good! Separately, I note that the open / closed switch is useful to us, and if our drive is old enough, we will also cut out the variable resistor of the audio amplifier. I cut it with a piece of board, it was very cool it was soldered.

It turns out like this:



Since we have a small engine, I decided to reduce the maximum current given by the driver. This is done by changing the value of the resistor R1 which changes the reference voltage responsible for the current.

We consider the current when the logic part of the 3.3v driver is powered:


Or graphically:



The driver will be controlled by the crumb MSP430G2231. And as limit sensors, I decided to use OMRON EE-SX1103 optocouplers (I hope they are looking for pictures) from old flops.


I hung up the tightening and current-limiting resistors directly on the sensors, and glued the sensors on the superglue to the base of the future rails.



Having cut the mikruhu blown off from the drive board, glue its remains into the plastic part of the carriage.



Refused the differential polling scheme of the sensor, since the ports of the MK are so few, and as the test showed, the sensor is not buggy with visible light:



On the graph, the test of the sensor flashlight in the strobe mode, and the noise in the area of ​​55 seconds - touched the findings with your finger.

Since there were still not enough conclusions, multiplexed the motion divider switch, and here’s the final scheme:



Further, as usual, we poison, pound, solder. And on the carriage on top we glue the largest bridge with a dead motherboard.



Ready device:



Work algorithm:

There are 2 modes in which we control either the speed of movement (the driver works in 1/16 step mode, accuracy is important for me, not speed), or a “bundle” of impulses to the driver input at a constant speed. The MK checks which mode we are in by querying the latching button (in this case, it’s not necessary to write the button's anti-bounce code, which slows down the work of our already slow u). then the ADC of the variable resistor is averaged 4 times for averaging, and the resulting number goes to the corresponding functions provided that the switch of the direction of movement and “silence” is activated from the corresponding limit sensor.

Mechanical characteristics:
In general, the carriages footsteps have 20 steps per revolution (info from PL15S-020). and lead screw 3mm (there are less). Then in theory it turns out 3/20/16 = 0.009375mm or 9.375 microns. In fact, the rigidity of the structure is not enough, plastic is the same, and therefore the “packs” that are worked out at small values ​​are different.

Shoals and ideas:
I confused the pinout of the LDO stabilizer, and I had to solder it the other way around, besides it was very hot, so I switched to a 5v USB bipolar power supply and a 12v power section.

I ordered a variable resistor with a logarithmic characteristic, now only about a quarter of the entire surface of the transistor is used, and it’s reluctant to load the stone with matane.

In order to have enough unipolar power, you can take the DRV8834 as an engine driver. Plus, we get the mode 1/32 step, and if you use the DAC, then almost "infinite" division (TI Application Report SLVA416, "High Resolution Microstepping Driver With the DRV88xx Series").
You can, for example, tie the feedback to increase the accuracy of movements on any linear (magnetic) encoder. I didn’t think much, in this case I’ll have to redo the electronics, then it’s already possible to add a connection to the computer.

As an example of stacking
Smoker's stack

Healthy person stacking


More details on the GRIP theory can be found here.
StepStick Wiki Drivers .

Source: https://habr.com/ru/post/221821/


All Articles