Robin2:
Looking again at the video with the knowledge of the program you used I wonder if you have accidentally mixed up the step and direction connections.The program should cause the motor to run smoothly for a half revolution (100 steps) in one direction, pause, and then run back for a half revolution in the other direction.
Try the program with millisbetweenSteps increased to 1000 for much slower operation. And uncomment his line
// delayMicroseconds(pulseWidthMicros); // probably not neededThere was another Thread very recently where someone's stepper motor behaved erratically when the Arduino was starting and that was solved, IIRC, by putting a 5600 Ohm resistor between the step pin and GND. My own A4988 drivers do not have that problem.
...R
I try to uncomment the line but nothing change.
I'll try with the resistor twomorrow because now i don't have it.
i hope it will work
.
rpt007:
Having set up my driver's current limit I normally use the following sketch, which more or less is equal to Robin2's program:int dirPin = 8;
int stepperPin = 7;
void setup() {
Serial.begin(9600);
pinMode(dirPin, OUTPUT);
pinMode(stepperPin, OUTPUT);
}
void step(boolean dir, int steps) {
digitalWrite(dirPin, dir);
delay(50);
for (int i = 0; i < steps; i++) {
digitalWrite(stepperPin, HIGH);
delayMicroseconds(500);
digitalWrite(stepperPin, LOW);
delayMicroseconds(500);
}
}
void loop() {
step(true, 3000);
// Time to measure the current:
delay(2000);
step(false, 3000);
// Time to measure the current:
delay(2000);
}
The delay between the direction changes is used to measure the current (just a level indication) flowing through one coil by having an amp meter in series with that one coil. This gives me a solid proof that the driver was set up properly.
I try you code and this is the result:
I don't think it's working well.