Bipolar stepper motor.
Having previously salvaged 3 stepper motors from an old(1997) Epson printer, I thought it was about time to try and get one working.
The one I am using has a code of EM-263 on the back.
There are 4 wires coming out of it, 2 for each coil.
I determined each pair by attaching a small battery to one wire, and
checking each of the other wires for a voltage.
As 1 wire has a black strip, I am counting this as 1, so my 2 pairs are 1 & 3 and 2 & 4.
Checking through all my books and magazine articles, the vast majority deal only with unipolar type stepper motors, unfortunately mine are all bipolar. Some did give a very brief explanation of how a driver should work, which is to use a dual H-bridge. On the plus side, I had a dual H-bridge that I used to control my robot with, before I changed it for a L298N.
I decided to use a PIC 16F628A to control the dual H-bridge, though any PIC with an 8 pin PORT will do.
As with all stepper motors, the coils need to be energized in a set sequence.
This was the tricky bit.
was a great help with this, and after a lot of trail and error, this is the PIC sequence I came up with.
Forward #DEFINE fstep1 b'00000101' #DEFINE fstep2 b'10100000' #DEFINE fstep3 b'00001010' #DEFINE fstep4 b'01010000' Reverse #DEFINE rstep1 b'01010000' #DEFINE rstep2 b'00001010' #DEFINE rstep3 b'10100000' #DEFINE rstep4 b'00000101'
If you find that the motor is stepping, say, something like 2 forward, then 2 reverse.
Try swapping the wires of 1 one coil, with each other.
If you find it is going in the opposite direction from what you would like, try swapping
each wire of both coils, with each other.
Or just swap the code around Forward -> Reverse, Reverse -> Forward.
2 x 4 core telephone cable is used to connect PORTB to each H-bridge.
The stepper motor is powered with a 6v lantern battery and the circuit is powered by a 5v regulated power supply.
NOTE: If you use 2 separate boards, like I have, the Gnds(0v) must be connected together.
Schematic using an H-bridge.
Complete setup excluding batteries.
Dual H-bridge stripboard circuit.
Bipolar stepper code.
31 March 2012
Using a L298 to control a bipolar stepper motor.
The microcontroller is the same as the one above(PIC16F628A), but this time is connected to a L298 to control the
bipolar stepper motor instead of a dual H-bridge.
4 core telephone cable is used to connect the PIC to the L298.
The circuit is a lot simpler than a H-bridge to construct, consisting of a L298, 8x1N5817(or similar) schottky diodes, a 0.1uf decoupling capacitor and connecting wires.
The image below gives a good indication of how the circuit could be set up.
Close-up of L298 circuit.
Diode connections for each I/O between L298 and stepper motor.
NOTE: care must be taken when mounting the L298, as it is not designed to sit in a plugboard or DIL socket.
The front pins need to be bent sideways to fit properly into the sockets.
A 5v regulated power supply is connected to the PIC and the Logic input of the L298, and a 9v PP9 is connected to the L298 to power the motor.
To make things easier, the enable pins of the L298 could be permanently tied to 5v, though I haven't tried this myself.
Complete bipolar stepper motor circuit with L298.
The code for the PIC16F628A is very similar to the one above.
FORWARD #DEFINE fstep1 b'00000110' #DEFINE fstep2 b'01010000' #DEFINE fstep3 b'00000101' #DEFINE fstep4 b'01100000' REVERSE #DEFINE rstep1 b'01100000' #DEFINE rstep2 b'00000101' #DEFINE rstep3 b'01010000' #DEFINE rstep4 b'00000110'
L298 bipolar stepper code.