Page 1 of 1

Esp32 + stepper motor

Posted: Sun Jan 14, 2024 9:30 pm
by last_not_used_login
Hi,

I'm trying t o connect my ESP32 to this stepper motor(17HS19-2004S1): https://www.amazon.pl/STEPPERONLINE-kro ... B00PNEQKC0

using a driver (drv8825): https://www.amazon.pl/dp/B07CNJR2Z6?ref ... tails&th=1

I'm following this instruction: https://www.makerguides.com/a4988-stepp ... -tutorial/

- setting up Vref to 1V

- Green and Black go to 1A 1B

- Red and Blue go to 2A, 2B- Dir goes to GPIO12

- STP goes to GPIO14

- Logic is powered by esp32 5v

- Motor is powered by 12V DC

- I don't have capacitor

When I power everything driver are getting hot, and motor is "jumping". It doesn't want to do one full rotation. It's going two-three step forward and then one-two step back.

I was even trying to connect in different configuration wires from motor to the drive and result is similar.

Could you advise? I guess "jumping" motor is a quite common problem. I don't understand what could be wrong.

Thanks!

Re: Esp32 + stepper motor

Posted: Mon Jan 15, 2024 5:56 pm
by mikemoy
Can you post your code?

Re: Esp32 + stepper motor

Posted: Tue Jan 16, 2024 12:02 am
by last_not_used_login
Code is 1:1 as in the example https://www.makerguides.com/a4988-stepp ... -tutorial/

I have tried both - vanilla and accustepper solution

Thanks!

Re: Esp32 + stepper motor

Posted: Tue Jan 16, 2024 4:54 pm
by ves011
No, "jumping" motor is not a common problem :)
post your code AND wiring diagram

Re: Esp32 + stepper motor

Posted: Wed Jan 17, 2024 12:26 am
by last_not_used_login
ves011 wrote:
Tue Jan 16, 2024 4:54 pm
No, "jumping" motor is not a common problem :)
post your code AND wiring diagram
That is the code:

Code: Select all

#include "AccelStepper.h"

// Define stepper motor connections and motor interface type. 
// Motor interface type must be set to 1 when using a driver
#define dirPin 12
#define stepPin 14
#define motorInterfaceType 1

// Create a new instance of the AccelStepper class:
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);

void setup() {
  // Set the maximum speed in steps per second:
  stepper.setMaxSpeed(1000);
}

void loop() {
  // Set the speed in steps per second:
  stepper.setSpeed(400);
  // Step the motor with a constant speed as set by setSpeed():
  stepper.runSpeed();
}
Image

Dir and step go to gpio 12,14.

I was trying manipulate vtef, using weaker stepper motor (0,4A) but without success.

Thanks

Re: Esp32 + stepper motor

Posted: Wed Jan 17, 2024 10:05 am
by ves011
Wiring looks ok, assuming you correctly identified the beginning of each motor winding. However i wouldnt let DRV8825 inputs unconnected, even they are internally pulled down.
I cannot say how accelstepper library works, but arduino loop() function it loops forever.
Hence setSpeed() and runSpeed() are executed on each loop pass. It might be they do some state reset of DRV8825.
I would move at least setSpeed() in the setup() section.