Stepper motor driver, Arduino, and mystery motor

Hello, pololu board. I’m used to electronics and robotics, but new to stepper motors and arduino (but I have some programming experience). Currently, I’m trying to get the A4983 Stepper Motor Driver Carrier (without regulators) to work with a surplus-bought stepper driver, a PC power supply, and an Arduino mega.

On the stepper driver board, I have VMOT and VDD attached to 12V and 5v (respectively) from the power supply. 1A, 1B, 2A, and 2B are attached to the wires from the motor. EN goes to pin 22 on the arduino, MS1 to pin 23, MS2 to pin 24, MS3 to pin 25, RST to pin 26, SLP to 27, STEP to 28, and DIR to 29.
Here is my arduino code:

int enable =  22;
int MS2 = 23;
int MS2 = 24;
int MS3 = 25;
int reset = 26;
int sleep = 27;
int stp = 28;
int direct = 29;

void setup()   {                
  pinMode(enable, OUTPUT);   
  pinMode(MS2, OUTPUT);    
  pinMode(MS3, OUTPUT);   
  pinMode(reset, OUTPUT); 
  pinMode(sleep, OUTPUT); 
  pinMode(stp, OUTPUT);
  pinMode(direct, OUTPUT); 
  pinMode(ledPin, OUTPUT);   
 
  digitalWrite(enable, LOW);
  digitalWrite(sleep, HIGH);
  digitalWrite(reset, HIGH);
  digitalWrite(MS1, LOW);
  digitalWrite(MS1, LOW);
  digitalWrite(MS1, LOW);
}


void loop()                     
{
  delay(10);   
  digitalWrite(direct, HIGH);  
  digitalWrite(stp, HIGH);   
  delay(100);                 
  digitalWrite(stp, LOW);    
  delay(1000);          
  digitalWrite(direct, LOW);  
  digitalWrite(stp, HIGH);   
  delay(100);                 
  digitalWrite(stp, LOW); 
  delay(900); 
}

From my understanding, this should make it go one step one way, and one step the other way, repeating indefinitely.The catch is that I’m what I’m getting is a wonderful lack of movement.

The stepper driver I’m using is this one. It’s cheap, but, unfortunately a little low on specifications. I realize there are a lot of variables here, but mostly I want to know if this should be working, or whether I have the code or connections wrong.

Thanks!
-tim

Hello.

That generally sounds okay (though your calling the stepper motor a “stepper driver” doesn’t help). What kind of tools do you have? Can you look at the voltages on the pins, and see what currents the power pins are drawing? Is the motor getting any power (i.e. is it holding its position)?

- Jan

This is a pretty standard setup wayland. I would look into changing a few things:

1.) If you are going to use MS1 on your 1201, you need to use a resistor. Although there is one built in for MS2 and MS3, if you read the info on #1201, there is no resistor built in to MS1, so use something like 100Kohm and you should be fine.

2.) Your code seems a little aggressive to me. Maybe try running your stepper one way to start with, then go from there.

int dirpin = 8;
int steppin = 9;

void setup() 
{
Serial.begin(9600);
pinMode(dirpin, OUTPUT);
pinMode(steppin, OUTPUT);
digitalWrite(dirpin, LOW);     // Set the direction.
}
void loop()
{
digitalWrite(steppin, LOW);  //The LOW to HIGH change is what signals the 1201 to step
digitalWrite(steppin, HIGH);
delayMicroseconds(400); //Higher = slower RPM, lower = faster RPM
}

Remember also that you cant just START at full speed which is why we have the delayMicroseconds(400). The proper way to do this is to implement some sort of speed profiling

Here’s a short video showing how to start using the #1201: Here. Sorry it’s a little fuzzy I’m not sure what happened.

-Edward