You are currently viewing How to Interface Stepper Motor with MSP430F5529 MSP430 Development Board

How to Interface Stepper Motor with MSP430F5529 MSP430 Development Board

Spread the love

The MSP430 Development kit is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports with Code Composer Studio v4 and later through USB port.

Texas Instrument Microcontroller, MSP430 Development kit is proposed to smooth the progress of developing and debugging of various designs encompassing of speed 16-bit Microcontrollers. It integrates on board PS2, UART, ADC, PWM, Temperature Sensor, Relay, Buzzer, I2c Seven Segment, I2C Serial EEPROM, Temperature Sensor LM35, Matrix Keypad, Switch, LED, Stepper Motor Driver, Traffic Light Controller, I2C RTC, LCD & GLCD Display to create a stand-alone versatile test platform. User can easily engage in Development in this platform, or use it as reference to application Development.

Stepper Motor

stepper motor is a brushless, synchronous electric motor that converts digital pulses into mechanical shaft rotation. Every revolution of the stepper motor is divided into a discrete number of steps, and the motor must be sent a separate pulse for each step.

Interfacing Stepper Motor

Fig. 1 shows how to interface the Stepper Motor to microcontroller. As you can see the stepper motor is connected with Microcontroller output port pins through a ULN2003 array. So when the microcontroller is giving pulses with particular frequency to ULN2003, the motor is rotated in clockwise or anticlockwise.

Interfacing Stepper Motor with MSP430F5529

We now want to control a stepper motor in MSP430F5529 Development Board . It works by turning ON & OFF a four I/O port lines generating at a particular frequency.

The MSP430F5529 Development Board has four numbers of I/O port lines, connected with I/O Port lines (P4.0 – P4.3) to rotate the stepper motorULN2003 is used as a driver for port I/O lines, drivers output connected to stepper motor, connector provided for external power supply if needed.

Pin Assignment with MSP430F5529

Circuit Diagram to Interface Stepper Motor with MSP430F5529

C Program to control stepper motor using MSP430F5529

***************************************************************************************

Title : Program to control stepper motor rotations

***************************************************************************************

#include 
#include 
#define SW1 0x01 //SW1 (P2.0) void motor_cw(void);

void motor_ccw(void);

void delay1(int n)
{
int i;
for(i=0;i<n;i++)
asm("nop;");
}

void delay2(int n)
{
int i; for(i=0;i<n;i++)
{
delay1(10);
}
}

void motor_cw (void)
{
unsigned int k;
for (k = 0x01;
k <= 0x08;
k <<= 1)
{
delay2(250);
P4OUT |= ( k & 0x0F);
delay2(250);
P4OUT &= (~k & 0x0F);
}
}

void motor_ccw (void)
{
unsigned int k;
for (k = 0x08;
k >= 0x01;
k >>= 1)
{
delay2(250);
P4OUT |= ( k & 0x0F);
delay2(250);
P4OUT &= (~k & 0x0F);
}
}

void main(void)
{
unsigned char i = 0;
WDTCTL = WDTPW + WDTHOLD;
// Stop watchdog timer P2DIR &= 0x00;
// Define Switch-Pins SW1as input P4DIR |= 0x3F;
// Set P4.0-P4.5 to Output direction Stepper while(1)
// Loop forever.............. { if (P2IN & SW1)
//Check Switch SW1 ON/OFF motor_cw();
// Rotate clockwise else motor_ccw()
// Rotate counter clockwise
}
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.