So I am trying to use a esp32 to move a motor but nothing is happening. I have changed out the a4988, changed the motor, moved the potentiometer, moved the cables, and nothing is working. The a4988 isn't even getting hot but I am pretty sure that my code is executing. I am recycling my motor from my ender 3 pro 3d printer.
Hi, @johnsonprojects
Welcome to the forum.
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
What is your power supply?
Can you please post a link to data/specs of the stepper, NEMA17 tells us very little about it but it physical profile.
Do you have a DMM? Digital MultiMeter?
Thanks.. Tom....
![]()
You need to know the specs of the stepper to set the power supply requirements and the current setting of tthe driver.
Please draw a circuit diagram.
Please post your code.
Can you measure the resistance of the stepper windings please?
Tom....
![]()
In the first post photo of the wired A4988, the "step" pin solder looks like the solder is floating above the pad, and most pins look like the solder is "tucked under" with a clear distinction between solder and pad... like the pad was not heated during soldering... add flux and reflow the solder onto pads and pins.
I don't have a multimeter. Do I absolutely need one? This is my first project and I am unsure if I will continue to do these things so I don't want to get one unless I really have to. Is there any other way to do this project without needing it? All the Youtube videos I watched seemed relatively easy compared to what I am experiencing.
This is the most similar motor I could find: Creality 42-40 Stepper Motor – FDM3D
Yes, that looks like your motor. See the 1.5 Amp per phase statement? That means some of the time your motor will use both windings and draw 3 amps. You were asked about the power supply but never answered. what is it's voltage and current ratings? Will it handle the motor?
https://www.ebay.com/itm/157861399159?chn=ps&mkevt=1&mkcid=28&google_free_listing_action=view_item This is my power supply.
Thank you for the link. If you had a DVM you could watch the voltage drop as you got closer to the 5 amp current point. But at 3 amps it should stay close to 12 volts.
So what should I do. Should I buy these electrical tools or is there a way to solve my issue without them?
Is time of any value to you?
I would like to get this done as soon as possibly but I am willing to wait. I just do not know if I am willing to spend all this money to never use it again.
#define STEP_PIN 18 // Step pin connected to A4988 STEP
#define DIR_PIN 19 // Direction pin connected to A4988 DIR
#define ENABLE_PIN 21 // Optional, connected to A4988 ENABLE
int stepsPerRevolution = 400; // Adjust based on your motor
void setup() {
Serial.begin(115200);
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
pinMode(ENABLE_PIN, OUTPUT);
digitalWrite(ENABLE_PIN, LOW); // Enable driver (LOW = ON)
Serial.println("Stepper Motor Test Start");
}
void loop() {
// Rotate clockwise
digitalWrite(DIR_PIN, HIGH);
stepMotor(stepsPerRevolution); // One full rotation
delay(1000);
// Rotate counterclockwise
digitalWrite(DIR_PIN, LOW);
stepMotor(stepsPerRevolution);
delay(1000);
}
void stepMotor(int steps) {
for (int i = 0; i < steps; i++) {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(5000); // Control speed (lower = faster)
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(5000);
}
}
This is my code
Did you reflow the A4988?
You can simulate controlling a motor by connecting an LED and resistor to each pin used (18, 19, 21). The DIR LED will be on for one rotation, then off for a rotation. The STEP pin will flutter as the motor steps and the ENBL LED will be ON (or is it off?) all the time.
The stepper motor datasheet says the motor is rated at 1A, so the power supply shouldn't be too weak with 5A available.
Your code works in a simulation. I assume you are 1/2 stepping, or your motor is 400 steps per revolution.
I just tried this and it works just like you explained. So is it the driver that is the problem?
Probably the driver is not configured correctly.
This page descibes the process...
Is there a way to check if my driver is working fine, and is there a way to limit my driver without using a multimeter?
or should i just get a cheap 10 dollar multimeter and use that
Yes, I have seen them on sale from china where you could get 2 for that amount.







