Driving stepper motor

Some time ago I came across tutorial how to make a mini plotter from two CD/DVD drives. While drinking beer I told my friend about it and some time later as a birthday present I got a broken DVD drive from him.

Tearing the DVD apart was fun. I was most impressed when I discovered lens floating in a strong magnetic field created by two magnets. I found an engineering class materials about this incredible stuff.

Imagine the following: You are traveling at half the speed of light, along a line from which you may only deviate 1 m. The line is not straight but oscillates up to 4.5 km sideways, 23 times per second.

This is a scaled version of the control task in a DVD player, where the pick-up head needs to follow the bit-track. The real numbers are 3.5 m/s, with maximally 0.022 µm deviations from the track. A disk is always slightly asymmetric, causing it to oscillate up to 100 µm per rotation, and the rotation speed is up to 23 Hz (for single speed).

Since it was my first experience with a stepper motors I started slowly. First I did a simple board with 3 buttons to manually control a bipolar stepper motor. Each of these buttons inside has two two-position switches. Something like:

 off               on
      .-- 2             .-- 2
     /
1 --* .-- 3       1 --*-.-- 3

      .-- 5             .-- 5
     /
4 --* .-- 6       4 --*-.-- 6

By connecting them right way I was able to reverse current flow for one coil with one button; Second button for the second coil; Third button is a main on/off switch.

3 buttons board

3 buttons board

By using this board I was able to verify that my stepper motor actually works and find out what resistor I should use to limit the current flowing trough it.

Knowing that it works I connected it trough L293D to Forth enabled blue pill. Surprisingly, everything worked with no problems.

I tried full-stepping and half-stepping. I think half-stepping gives less vibrations and I see no difference in a torque... Please see Forth code I wrote to drive the motor if you are interested.