This note provides basic implementation details and procedural information to design and assemble a stepper motor system. The controller discussed here is the ATmel mega8, an 8-bit microcontroller (MCU).
The note consists of a general description and gives highlights of implementing a basic stepper motor system application. To amplify the application, the software was generated using Atmel mega8 microcontroller. The program created with the controller is shown in “Control software Explanation” section of this note. For convenience, a copy of the code is available and is included in a folder name “code”. For the sake of this note being educational, the hardware was also simulated with Proteus software prior to design of PCB. Code folder includes a file name 4lead stepper.prjpcb designed with Altium layout software. You may get the PCB of the controller circuit built by placing an order with any board fabricator.
Stepper motor theory
Originally, this controller was designed to control a car’s small sliding door related to the 4 Floor Elevator system project. As it is mentioned in that project, in the up graded version, I used a 4 wire stepper motor to open or close the sliding door.
A 4-phase stepper motor is really two motors sandwiched together. Each motor is composed to two windings. Wires connect to each of the four windings of the motor pair, so there are eight wires coming from the motor. The commons from the windings are often ganged together, which reduces the wire count to 4, 5, or six instead of eight.
A 4-phase stepper motor requires a sequence of four pluses applied to its various windings for proper rotation. By their nature, all stepper motors are at least two-phase. The majority are 4-phase, some are six phase. Usually, but not always, the more phases in a motor, the more accurate it is.
Stepper motors vary in the amount of rotation the shaft turns each time a winding is energized. The amount or rotation is called the step angle and can vary from as small as 0.9 degrees to 90 degrees. The step angle determines the number of steps per revolution. A stepper with a 1.8 degree step angle, for example, must be pulsed 200 times for the shaft to turn one complete revolution. A stepper with a 7.5 degree step angle must be pulsed 48 times for one revolution, and so on.
Controlling a Stepper motor
Steppers have been around for a long time. In the old days, stepper motors were actuated by a mechanical switch, a solenoid-driven device that pulsed each of the windings of the motor in the proper sequence. Now, stepper motors are invariable controlled by electronic means. Basic actuation can be accomplished via computer control by pulsing each of the four windings in turn. The computer can not directly power the motor, so transistors must be added to each winding, as shown in figure 1.
For more detail: Stepper motor control with an ATmega8 microcontroller