İ am using a4988 step motor driver and 17hs4401 step motor. İ will use them in a system. before it, i made i simple test. Just make 1 revolution every in 3 seconds. But motor had shifted around 10 degree in every hour. There was no load at the motor. İs there any way to reduce this?
is this because of motor or driver?
is this reduce if i use half step or quarter step?
my budged is low, so may be i added rotary encoder is this a good solution?
4)(+ question)when upload empty code to my Arduino, motor wiggling turn slowly? Or just in setup function, i still turning. Why is this happening
İ am using Arduino mega
// Define pin connections & motor's steps per revolution
const int dirPin = 2;
const int stepPin = 3;
const int stepsPerRevolution = 200;
void setup()
{
// Declare pins as Outputs
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop()
{
// Set motor direction clockwise
digitalWrite(dirPin, HIGH);
// Spin motor slowly
for(int x = 0; x < stepsPerRevolution; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(3000); // Wait a second
}
The speed might be too high. Usually the pulse itself can be 10 microseconds but the other delay, deciding the speed. I would try 10 mS, 10 000 microseconds.
Oh i will definitely try this thank you so much. So is there any chance to make damage motor or driver if i increase this time let's say 50 Ms? İs there any upper limit?
Sending the pulses at a too high frequency the motor will only make noise but not move. Stopping and starting are the most critical parts.
Read the datasheets and lok for "pull in" and "pull out". That's the maximum rate versus a stand still.
With the motor enabled but not stepping (standing still), measure (carefully) from 1A to 1B and 2A to 2B. Motor winding resistance is 1.5 Ohms, times 1.7 Amps, volts should be around 2.5V.
The A4988 cannot deliver 1.7A, so it may be overheating and shutting down. Set the current limit to 1 Ampere, maximum.
Also, unless you are using the original Pololu A4988 driver, the current limit Vref setting that they recommend will probably not work. The formula (see the A4988 data sheet) depends on the current sense resistor, which is different for different board manufacturers.