DIY Stepper Controller (1/2)
The stepper motor is a very accurate and easy to use motor that is great for beginning as well as advanced hobbyists. The precision that stepper motors through its unique 'stepping' method of movement let's us always know where the motor is without any feedback or encoding circuitry.
Understanding how to build proper control circuit for the stepper motor is vital. Knowing how much current will be drawn by the motor and the planned system voltage is essential. Throughout this tutorial my system voltage will be 12v for the motors and current draw will not exceed 300mA. Stepper motors can draw a lot of current so check the specs on what you're using.
Complete DIY Stepper Motor Controller Board
Purpose & Overview of this project
The goal of this project is to build a board specifically for controlling a 2 coil stepper motor. The board should have 4 terminal block ports for the 4 stepper motor wires, and 4 input ports for the L297 controller.
The board should be able to reliably control the steps that the motor takes. Each clock pulse into the circuit will put the motor through exactly 1 stepping cycle.
2x 10uF Capacitor
8x 1n5822 Diode
DC Power Jack
Red LED (5mm)
4x Dual Terminal Blocks
Resistors: 10Ω, 240Ω, 360Ω
Resistors: 370Ω, 11kΩ
Copper PC Board (3"x5")
Parts List Details
The board will require all of the parts above. Later in the schematic you will see how they are all interconnected and where exactly they will end up on the board.
L297 and L298
These two pair together perfectly for controlling a stepper motor. In fact if you check out the datasheets for these two devices (which I strongly recommend) you will see that they have some schematics already made for connecting these two devices together.
This is the voltage regulator that will be used on the board. Specifically we need +5v going to the L297 for the digital side of the board. The L297 uses +5v to send the approriate control signals on to the L298.
Since the board is being made from scratch you are going to need to drill the holes out and solder all the parts in by hand. Since all parts are through-hole, the soldering skill required is still at the amateur level, but you can still make mistakes and solder something in backwards. Double check everything!
Copper PC Board
The PC board used in this tutorial was standard 1-side copper clad pc board. 3" by 5" in size. There's not tricks here, any type of pc board will work as long as its copper that can be etched away with ferric chloride.
Resistors, Capacitors & Diodes
The rest of the pieces for this board are the current sense resistors, RC circuit for the L297 'clock' and some voltage dividers for the voltage regualtor. The big 1n5822 diodes are used on the output to the motor as part of a protective circuit so you don't mess up the motor or the board.
The schematic for the board can be seen below. The three main elements of the board are (1) the power input and voltage regulation, (2) the L297 input and outputs and (3) the L298 stepper motor control circuit.
While the motor is powered by a raw +12v input, there is a voltage regulator circuit for +5v going to the L297. The LM317 uses a voltage divider 240Ω and 720Ω on its output and adjust pins to create this +5v output.
•L297 Control Signals
The L297 has 4 inputs supplied by the user, a ground, step input (clock), direction and enable. From these inputs the L297 decides what outputs should be given to the L298 in order to control the stepper motor properly.
•L298 Motor Control
The L298 will constantly be supplying current to the stepper motor unless you add additional sensing circuitry, so make sure you don't forget the 10Ω resistors off of pins 1 & 15, the sense pins. This limits the current to 300mA and means out L298 won't get hot enough to burn finger tips. If you want to see what I mean, connect pins 1 and 15 directly to ground and the L298 will burn up.