Actuator Interfacing With Arm
Actuator Interfacing With Arm
with LPC2148
Stepper Motor Basics
1. Stepper Motor Types: Unipolar and Bipolar. For interfacing a six-wire unipolar stepper
motor is used
2. Motor Connections: A six-wire unipolar motor has two center tap wires, each providing half
of the winding resistance when measured to either end of its coil. Only four wires (two for
each coil) are needed for controlling the motor.
3. ULN2003 Driver: The ULN2003 is a popular Darlington transistor array that can handle high
current for each motor coil and is connected to the microcontroller. Each motor coil can be
controlled through individual pins on this driver.
Interfacing the Stepper Motor with LPC2148
1. LPC2148 Pin Configuration: Connect four GPIO pins (say, P0.16 to P0.19) to the IN1 to
IN4 pins on the ULN2003.
2. ULN2003 Connections:
o Motor coils: The ULN2003 output pins OUT1 to OUT4 connect to the motor’s four
control wires.
o Center taps: These go to a 5V supply.
3. Power Supply: The motor requires a separate 5V power supply, while LPC2148 operates on
3.3V.
Program
#include <lpc214x.h>
void rotateClockwise() {
// Full-Step sequence for clockwise rotation
IO0PIN = (1 << 16); delay(200); // Step 1
IO0PIN = (1 << 17); delay(200); // Step 2
IO0PIN = (1 << 18); delay(200); // Step 3
IO0PIN = (1 << 19); delay(200); // Step 4
}
void rotateCounterClockwise() {
// Full-Step sequence for counterclockwise rotation
IO0PIN = (1 << 19); delay(200); // Step 1
IO0PIN = (1 << 18); delay(200); // Step 2
IO0PIN = (1 << 17); delay(200); // Step 3
IO0PIN = (1 << 16); delay(200); // Step 4
}
int main() {
IO0DIR |= (1 << 16) | (1 << 17) | (1 << 18) | (1 << 19); // Set P0.16-P0.19 as output
while (1) {
rotateClockwise(); // Rotate clockwise
delay(500); // Short delay
rotateCounterClockwise(); // Rotate counterclockwise
delay(500); // Short delay
}
}