Hello,
I'm trying to build a project for my chemistry lab using Arduino Uno R3 and I need to use a stepper motor.
I chose a Nema17 17HS4401 and connected it with a A4988 driver using a stepper driver module that I bought of Amazon.
I am using a 12V 2A adaptor and powering the Arduino (as in the photo) with a USB cable plugged into my PC.
I also adjusted the current using the formula I x 8 x R.
The motor receives around 11,9V on each coil constantly.
However, I can't get the motor to show any sign of life (no vibration nor rotation).
Here is my code
#include <Arduino.h>
#define dirPin 2
#define stepPin 3
#define stepsPerRevolution 200
void setup() {
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop() {
digitalWrite(dirPin, HIGH);
for (int i = 0; i < stepsPerRevolution; i++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(1000);
}
Since I'm using PlatformIO to code, I tried using the dedicated library
#include <Arduino.h>
#include <A4988.h>
#define MOTOR_STEPS 200
#define DIR 14
#define STEP 15
A4988 stepper(MOTOR_STEPS, DIR, STEP);
void setup() {
stepper.begin(1, 1);
}
void loop() {
stepper.rotate(360);
delay (1000);
}
Same problem using a different motor and different pins.
The Arduino uno works fine for other projects.
I also checked both motors' coils and their resistances are ok.
Could you please help me if you know what I am doing wrong.
Thank you very much !!

