I couldn't find a data sheet for this extension board and this stepper motor.
The board is from Amazon and looks like this.
There is another kind of board that behaves almost the same way. It says it accepts 9v for the motor but it seems to work up to 24v. The difference between this one and the one above is that the JST connector seems to be in reverse. What works as clockwise in the above board runs as COUNTERCLOCKWISE in this one.
The stepper motor was bought from ebay with other used motors. Looks like this.....
Things to note:
Motor:
Step angle 0.9 degrees (because of the "C" on the model number)
So it takes 400 steps per revolution (at full step)
21 ohms -- you can use this to figure out the max current
Has 4 wires: Red = 1A; Yellow = 1B; Brown = 2B; Orange = 2A
Extension board:
The colored headers (black, red, and yellow) were just labeled S, V, G. I guess that meant Stepper, Volt (internal), Ground
The V (red) should be connected to 5 volts to power the stepper driver.
The G (black).... you know what this is :)
The S is for the stepper controls that would come from your arduino (direction, step, and ENABLE)
The board has the enable pin of the driver default to HIGH. So you need to set this to LOW through your arduino. Therefore, if you have your arduion pins 2 and 3 for direction and step, you will need pin 4 (set to LOW) for enable.
// Define pin connections & motor's steps per revolution
const int dirPin = 2;
const int stepPin = 3;
const int enablePin = 4; // must be set to low; is default low already unless using an expansion card
const int stepsPerRevolution = 400; // taken from data sheet (360 / degree)
const int microSteps = 16; // options are 1 (full), 2 (half), 4 (quarter), 8 (eighth), 16 (1/16), 32, and 256
const int microsecondDelay1 = 1000; // increase this if you are doing full step (e.g. x10)
const int microsecondDelay2 = 2000;
int nLoop = 0;
void setup()
{
// Declare pins as Outputs
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
nLoop = stepsPerRevolution * microSteps;
}
void loop()
{
// Set motor direction clockwise
digitalWrite(enablePin, LOW);
digitalWrite(dirPin, HIGH);
// Spin motor slowly
digitalWrite(LED_BUILTIN, HIGH);
for(int x = 0; x < nLoop; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(microsecondDelay1);
digitalWrite(stepPin, LOW);
delayMicroseconds(microsecondDelay1);
}
digitalWrite(enablePin, HIGH); // turn stepper off
digitalWrite(LED_BUILTIN, LOW);
delay(2000); // Wait 2 second
digitalWrite(enablePin, LOW);
// Set motor direction counterclockwise
digitalWrite(dirPin, LOW);
// Spin motor quickly
for(int x = 0; x < nLoop; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(microsecondDelay2);
digitalWrite(stepPin, LOW);
delayMicroseconds(microsecondDelay2);
}
digitalWrite(enablePin, HIGH); // turn stepper off
delay(3000); // Wait 3 seconds
}