Esp32 + stepper motor

last_not_used_login
Posts: 4
Joined: Fri Apr 07, 2023 10:46 pm

Esp32 + stepper motor

Postby last_not_used_login » Sun Jan 14, 2024 9:30 pm

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!

mikemoy
Posts: 627
Joined: Fri Jan 12, 2018 9:10 pm

Re: Esp32 + stepper motor

Postby mikemoy » Mon Jan 15, 2024 5:56 pm

Can you post your code?

last_not_used_login
Posts: 4
Joined: Fri Apr 07, 2023 10:46 pm

Re: Esp32 + stepper motor

Postby last_not_used_login » Tue Jan 16, 2024 12:02 am

Code is 1:1 as in the example https://www.makerguides.com/a4988-stepp ... -tutorial/

I have tried both - vanilla and accustepper solution

Thanks!

ves011
Posts: 20
Joined: Fri Oct 07, 2022 2:31 pm

Re: Esp32 + stepper motor

Postby ves011 » Tue Jan 16, 2024 4:54 pm

No, "jumping" motor is not a common problem :)
post your code AND wiring diagram

last_not_used_login
Posts: 4
Joined: Fri Apr 07, 2023 10:46 pm

Re: Esp32 + stepper motor

Postby last_not_used_login » Wed Jan 17, 2024 12:26 am

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

ves011
Posts: 20
Joined: Fri Oct 07, 2022 2:31 pm

Re: Esp32 + stepper motor

Postby ves011 » Wed Jan 17, 2024 10:05 am

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.

Who is online

Users browsing this forum: No registered users and 117 guests