Nema 17 not working with ESP32

I've just bought a NEMA 17. I'm trying to make it work with all the equipment but it won't work.
Here is the simple code:

#include <AccelStepper.h>

#define dirPin 14
#define stepPin 12
#define motorInterfaceType 1

AccelStepper stepper(motorInterfaceType, stepPin, dirPin);

void setup() {
  stepper.setMaxSpeed(1000); // Steps per second
  stepper.setAcceleration(500); // Steps per second^2
}

void loop() {
  stepper.moveTo(200); // Move 200 steps forward
  stepper.runToPosition();
  delay(1000);

  stepper.moveTo(0); // Move back to start
  stepper.runToPosition();
  delay(1000);
}

I've got a 12v and 1.5 amp power supply.
I've got a Nema 17.
I've got a driver board.
I've got a DC Jack.




Can you help me make this work?

Post a wiring diagram of your project along the sketch you posted.

Pololu has a good reference page for configuring and adjusting the A4988.

Nope! you need to post the information you have been asked for. Realize none of us can see what you have or how you have connected it. Your pictures are nice but do not convey the information needed to solve your problem. When you post your annotated schematic also post links to technical information for each of the hardware items.

Nema17 is the size of the mounting flange (1.7 inch)
It tells us nothing about the electrical specifications of the motor.
Which one of the thousands of driver boards.
Leo..

Sorry. I'm am not an adult yet :frowning: .

Step 1: Connect the NEMA 17 to A4988

A4988 Pin NEMA 17 Wire Wire Colors (Typical)
1A Coil A+ Red
1B Coil A- Blue
2A Coil B+ Green
2B Coil B- Black

Step 2: Connect A4988 to ESP32

A4988 Pin ESP32 Pin Function
STEP GPIO 12 Step pulse to move the motor
DIR GPIO 14 Direction control
ENABLE GND (or GPIO) Enable motor (optional)
RESET VCC Keep HIGH for normal operation
SLEEP VCC Keep HIGH for normal operation
MS1, MS2, MS3 GND (Full-step mode)

Step 3: Connect 12V Power Supply to A4988

Barrel Jack Pinout:

  • Center Pin (+12V) → Connect to VMOT on A4988.
  • Outer Sleeve (GND) → Connect to GND (next to VMOT) on A4988.

Step 4: Power the ESP32

USB Cable

  • Keep your ESP32 powered via USB from your computer or power adapter.
  • Ensure that the GND of ESP32 and A4988 are connected.

It's missing A4988 VDD to Esp32 VCC

Are you sure the A4988 is the correct driver for your "Nema17".
Which motor do you have (model or web-link).
Did you adjust the current on the A4988 for the motor you have, before connecting the motor.
Leo..

I've got it all good I think.

Okay I've done that and my stepper is not working. What should I do?

Start answering the questions.
post a picture of your setup.
Leo..

Okay, I'll send it just give me a second or two. An FWI is that it is a video.


I cant send a video so this is what I sent

???

???

Post a picture of the whole setup.
I can't see where the wires go to.
Leo..

This tells the dimensions of the mounting (1.7" between holes on the flange). It tells nothing about the mechanical or electrical specifications of the stepper.

ESP32 VCC /GND doesn't seem to be connected to the driver (two left/bottom pins).
Leo..

Thanks for the notice. I will try harder to look for myself but I was quite tired then. I'm busy for 7-8 hours so I will catch up later. :slight_smile: