I'm using 2 x 1.8-Degree Nema 14, 35 BYGHW Stepper Motors with a DRV8825 Stepper Motor.
I have tried all 24 combinations of wiring the damn 4 wires but it won't work. I am using a 9v battery as the motor power source, which is fine.
It sometimes turns when I have 3 wires connected??
I can guarantee the wiring is correct, and this is the sketch.
Here is the code, which I am almost certain is correct too, I just started this project and I can't even get a damn motor to work!
/* stepper motor control code for DRV8825
*
*/
// define pin used
const int stepPin = 9;
const int dirPin = 8;
void setup() {
// set the two pins as outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH); //Enables the motor to move in a perticular direction
// for one full rotation required 200 pulses
for(int x = 0; x < 200; x++){
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000); // delay for one second
digitalWrite(dirPin,HIGH); //Enables the motor to move in a opposite direction
// for three full rotation required 600 pulses
for(int x = 0; x < 600; x++){
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000); // delay for one second
}
Best Answer
There was no need to try 24 wiring combinations.
Your schematic shows that you have a two-coil motor. You identify the two coils with your multimeter and connect one coil to A1 - A2 and the other to B1 - B2. The motor should now run if you are using full-step mode. If using half-step mode (where more than one coil is on at time) you may need to reverse one of the coils.
A 9 V battery may not be adequate. Measure the battery voltage while trying to run the motor.
You can also increase the step delays by a factor of 100 and see if the motor turns slowly and whether or not you can feel any torque.
For further help please edit your question and add a link to the motor datasheet.