I am driving each motor using the unipolar driving method, shown below (pic from motor datasheet).
In order to rotate the stepper motors , each of its windings must be excited in a sequence. To reverse the direction of rotation, I simply reverse the sequence. This is illustrated below (pic also found in the datasheet).
If you are a beginner with the raspberry you will quickly realise that you cant just plug the motors into the PI's GPIO port and hope it to work, this is true for anything that requires more power that the Pi can source.
Switches to switch switches!
Instead, I used the Pi to switch externally powered MOSFET's (instead of the BJT's shown in the unipolar method pic... whos awake?) to drive the motors. I need four externally powered switches for each stepper motor, giving a total of 8, a pic of a single externally powered switch circuit is shown below (please note that the pin labelled "GPIO" is meant to be a single arbitrary GPIO pin, not the entire GPIO port).
I first sort to buffer the motor winding from the Pi, to this end i used a simple optocoupler, connected between the Pi's GPIO and the gate of the MOSFET.
When the GPIO pin is high, the LED is off, and the BJT in the optocoupler is also off. The MOSFET gate is the pulled to 12V through R1, turning it on. Current then flows through the motor energizing it.
Conversely,, when the GPIO pin is low, the cathode of the optocoupler LED goes to zero volts, the anode of the LED is at 5V and the LED turns on. This in turn, switched the optocoupler BJT on and its collector is pulled to zero volts, which also pulls the MOSFET gate to zero volts. When this happens the MOSFET is off and no current flows through the motor winding. The shottky diode provides a path for back EMF.
I calculated the value of R1 so that the current that flows through it is the collector emitter current of the optocoupler, which is 50mA. Using our trusty Ohms law and knowing the input voltage is 12V, i calculated a value of 240R
Simply rinse and repeat for the remaining 7 and populate onto vero board.
Here's one i made earlier.
The Pi was connected to the board with an expansion board (the red T lookin thing in the top left hand corner).