Interfacing the MSP430 with the A4988 Stepper Motor Driver

Discussion in 'The Projects Forum' started by jean28, Apr 7, 2014.

  1. jean28

    Thread Starter Member

    Sep 5, 2012
    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:

    Code ( (Unknown Language)):
    1. #include <msp430.h>            
    3. unsigned int i;
    5. void delay(int val)
    6. {
    7.     for(i = 0; i < val; i++) {;}
    8. }
    10. int main(void)
    11. {
    12.     WDTCTL = WDTPW | WDTHOLD;       // Stop watchdog timer
    13.     P1DIR |= 0x04;                  // Set P1.0 to output direction
    15.     while(1)
    16.     {
    17.         P1OUT = 0x04;
    18.         delay(200000);
    19.         P1OUT = 0x00;
    20.         delay(200000);
    21.     }
    23.     return 0;
    24. }
    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!
  2. MrChips


    Oct 2, 2009
    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.

    Code ( (Unknown Language)):
    2. void delay(unsigned long val)
    3. {
    4.    unsigned long i;
    5.    for (i = 0; i < val; i++) ;
    6. }
  3. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    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?