# Embedded Systems Lab6 Stepper Motor Application

## Preview text

Embedded Systems Lab6
Stepper Motor Application
Objectives 1. To realize how stepper motors function 2. To get familiar with controlling stepper motors via microcontrollers
Tools Proteus, MPLAB Software
Theory A stepper motor is a brushless, synchronous electric motor that can divide a full rotation into a large number of steps, for example, 200 steps. Thus the motor can be turned to a precise angle. Stepper motors operate differently from normal DC motors, which simply spin when voltage is applied to their terminals. Stepper motors, on the other hand, effectively have multiple "toothed" electromagnets arranged around a central metal gear. To make the motor shaft turn, first one electromagnet is given power, which makes the gear's teeth magnetically attracted to the electromagnet's teeth. When the gear's teeth are thus aligned to the first electromagnet, they are slightly offset from the next electromagnet. So when the next electromagnet is turned on and the first is turned off, the gear rotates slightly to align with the next one, and from there the process is repeated. Each of those slight rotations is called a "step." In that way, the motor can be turned a precise angle. There are two basic arrangements for the electromagnetic coils: bipolar and unipolar. In a unipolar stepper motor, there are four separate electromagnets. To turn the motor, first coil "1" is given current, then it's turned off and coils 2 is given current, and then coil 3, then 4, and then 1 again in a repeating pattern. Current is only sent through the coils in one direction; thus the name unipolar. However, in our lab we will study unipolar stepper motor only.

A unipolar stepper motor will have 5 or 6 wires coming out of it. Four of those wires are each connected to one end of one coil. The extra wire (or 2) is called "common." To operate the motor, the "common" wire(s) is (are) connected to the supply voltage, and the other four wires are connected to ground. The following figure shows the block diagram for the unipolar stepper motor and a simplified clarifying figure of its internal connection.
One suggested way to drive the stepper motor is to connect the two commons to ground and then send a series of signals to A, B, C, D with a suitable delay between each. The following table shows how this series would look like.

It is clear that the stepper will respond to this series of signal by rotating in some direction; if we reverse the signals order, the motor will rotate in the opposite direction. The difference between the one coil excitation and the two coil excitation is that the second will cause the motor to rotate with a greater torque.
ULN2003 IC The ULN2003 is a high voltage, high current Darlington arrays containing seven open collector Darlington pairs with common emitters. ULN2003 has one pin for ground and need no VCC connection. If any one of the inputs (1-7) is logic high, the corresponding output will be logic low; if the input is logic low the corresponding output will be high impedance.

Lab Exercises:
Part 1 1. Connect the circuit shown in the Figure below on Proteus ISIS program. 2. Write an assembly program for the PIC such that when S1 is pressed the motor will rotate right and when S2 is pressed the motor will rotate left, and when neither of them is pressed the motor stopped. 3. Load the(.hex) file to PIC18f4550 microcontroller. 4. Simulate the circuit using Proteus ISIS program.
Part 2 Write a basic program that do the same thing as part1.
Best Wishesâ€¦ Dalia