Hi Everyone!
Noob here,
Can i ask you guys what could be the problem of my servo motor. It does not rotate but only jerks.
I followed the tutorial video on youtube by Dejan. Just search "How To Control a Stepper Motor with A4988 Driver and Arduino" and his video should come out.
I followed it and copy his code from his website(http://howtomechatronics.com/tutorials/arduino/how-to-control-stepper-motor-with-a4988-driver-and-arduino/) and paste it to my sketch.
Can you explain to me guys what causing the jerking(not rotating smoothly or missing some steps).
Im Using a servo motor NEMA17 17HS1003 and a4988 driver. my supply is 24v 10amps for the motor and an Arduino Uno.
to make it easier for everyone here's the code:
// defines pins numbers
const int stepPin = 3;
const int dirPin = 4;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 200; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000); // One second delay
digitalWrite(dirPin,LOW); //Changes the rotations direction
// Makes 400 pulses for making two full cycle rotation
for(int x = 0; x < 400; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000);
}
Thanks!