1

I have been trying to run stepper motor via Arduino Uno and A4988 motor driver via this tutorial: https://howtomechatronics.com/tutorials/arduino/how-to-control-stepper-motor-with-a4988-driver-and-arduino/ The schematic for my wiring:schematic

So far I have checked the connections multiple times, tried different Arduino boards and A4988 drivers, even tried using a DRV8825 driver, manually declaring HIGH for SLEEP and RESET pins and LOW for ENABLE via arduino. Checked with several batteries which show no problem, even had a friend check the motors via other different driver(YS-DIV268n) he had and the motors worked fine. I even tried increasing the current from driver via the potentiometer on it but none of these worked.

All this time I observed that the driver got hot quite a lot and that's it. The arduino code is as follows:

 *      
 *  by Dejan Nedelkovski, www.HowToMechatronics.com
 *  
 */

// 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);
}```
2
  • 1
    In your for loops you have 2 delays each 500us, so 1ms per step. You are doing this for 200 steps, so each for loop would take 200ms, so only 1/5 of a second (ignoring the execution time of digitalwrite). Have you tried changing the numbers a bit? Using higher delays and doing more steps?
    – chrisl
    Feb 27, 2023 at 15:04
  • test the driver standalone ... remove the arduino ... use switches to control STEP and DIR
    – jsotola
    Feb 27, 2023 at 17:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.