0% found this document useful (0 votes)
11 views2 pages

Actuator Interfacing With Arm

Uploaded by

forgeryfraud420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Actuator Interfacing With Arm

Uploaded by

forgeryfraud420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Stepper Motor (Actuator) Interfacing

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 delay(unsigned int count) {


for (unsigned int i = 0; i < count * 1000; i++);
}

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
}
}

You might also like