Interfacing the MSP430 with the A4988 Stepper Motor Driver

Thread Starter

jean28

Joined Sep 5, 2012
76
Hello guys!

I am trying to interface 4-wire, 12 V stepper motor using the A4988 Stepper Motor Driver from Polulu. As far as I understand (and according to the A4988's Datasheet), all that it needs to make the motor move is a simple pulse to the STEP input. I did this and it is not making the motor move. I will attach a few pictures that will allow you guys to understand what's happening a little bit better:

This is how the chip is supposed to be connected:



Now, my configuration is the following:






The yellow and purple cables are of an external 12 V voltage supply. The red and black are the from the 5 V and GND pins in the MSP 430. The brown cable is from pin 1.2 of the MSP. The Red, Blue, Green, and Black cables are from the Stepper Motor.

This is the code I am using:

Rich (BB code):
#include <msp430.h>				

unsigned int i;

void delay(int val)
{
	for(i = 0; i < val; i++) {;}
}

int main(void)
{
	WDTCTL = WDTPW | WDTHOLD;		// Stop watchdog timer
	P1DIR |= 0x04;					// Set P1.0 to output direction

	while(1)
	{
		P1OUT = 0x04;
		delay(200000);
		P1OUT = 0x00;
		delay(200000);
	}

	return 0;
}
Maybe I have the color coding wrong? Does anyone have any experience with these generic 12V Stepper Motors with no datasheet?

Any help at all would be greatly appreciated.

Thank you all!
 

MrChips

Joined Oct 2, 2009
30,806
Did you check the stepping motor windings with an ohmmeter?
Find out how the wires are paired. Red-Blue and Black-Green perhaps as you have chosen.

In your code the value of 200000 exceeds the range of the int data type.

Use long instead of int.

Rich (BB code):
void delay(unsigned long val)
{
   unsigned long i;
   for (i = 0; i < val; i++) ;
}
 

THE_RB

Joined Feb 11, 2008
5,438
The enable pin needs to be low to enable the driver.

Is that it's default state or do you need to connect the enable pin to 0v?
 
Top