Yesterday I leaned that microstepping is easy to program, but equal sized steps are hard to do with two-axis microscope sliding-table 5V bipolar stepper motors. I looked at scene with high precision microscope for that:
https://forum.arduino.cc/index.php?topic=691123.msg4673372#msg4673372
I used L293D driver for the stepper motor. I read a lot that there are better drivers like A4988, and today I used that with my only NEMA 17 stepper motor:
Reason is that minimal voltage of A4988 is 8V, and I am not sure what the tiny stepper of sliding-table rated 5V does when powered with 8V. I will do that experiment later (I have three 1.60$/pc sliding tables already, and did order 10 more some time ago).
This is the setup, motor shaft upwards just below M12 180° lens mounted reversed to Raspberry HQ camera as macro lens. Because of the vibrations the stepper did, I had to clamp it and microscope holder to desk:
I used this sketch, setting MS1/MS2/MS3 to low is full-stepping. Product descriptions states that motor has 200 steps per revolution, but sketch had to do 800 steps for a full revolution:
#include <Stepper.h>
#define steps 800
Stepper myStepper(steps, 2, 3);
void setup() {
myStepper.setSpeed(3);
pinMode(6, OUTPUT); digitalWrite(6, 0);
pinMode(5, OUTPUT); digitalWrite(5, 0);
pinMode(4, OUTPUT); digitalWrite(4, 0);
}
void loop() {
myStepper.step(steps);
delay(2000);
myStepper.step(-steps);
delay(2000);
}
I took a youtube video.
800 steps clockwise, 2s pause, anticlockwise, 2s pause, clockwise, 2s pause, anticlockwise.
Microscope resolution 0.84µm/pixel here, so 1014x760 preview window is 3.40mm×2.55mm (tepper sound is quite loud):
I did cut out frames of no-movement phase and created animated .gif from those.
Precision of position is remarkable, although you can see the frame moving a few pixels right each time.
But few pixels is few micrometer, so that is fine for now (for 800 steps).
(I can control xy directions of microscope in 5µm steps, want microstepping for 1µm steps)