Motors not working on ESP32

@benedictdied I wanted to solve one problem at a time so I didn’t mention this but I flashed the firmware to a WEMOS D1 32 board with a CNC V3 shield on it. I was able to successfully flash the firmware through both platform.io and through your online flashing tool. I have a ring light attached to the board with a nema 17 motor on the x and y and a nema 11 motor for the z. The ring light works just fine in both the online flashing tool and in imswitch now that I have it up and working, however, none of my motors respond to commands. Occasionally, the x and y motors will click repeatedly and heat up while sitting plugged in but when I send a command it will either twitch or just not move at all. the y motor never responds to commands at all. The z motor will sometimes heat up and buzz but no stepping occurs during commands. I’ve seen a few people recently get it working but I can’t get it to work for the life of me. I’ve even changed out the motors and stepper drivers but to no luck. Has anyone experienced this issue and is there any suggestions you have on solving the issue?

@benedictdied Hey im still having some problems regarding this issue. In imswitch and the webserial GUI, I am able to run my nema 11 motor for my z-axis just fine but the nema 17 motors for my x and y-axis move erratically. They don’t go in the proper direction or step evenly. I feel like I have gone through every troubleshooting step to solve it and everything seems to be fine. I know the motors are picking up a signal and I have the proper power, Vref, and drivers connected. Is it possible it could be something wrong with the firmware or setting I can possibly change or play with?

Another thing I want to note is when I try to control them through the Imswitch GUI and I move the motor 1000 steps, it gives back a very large number (negative or positive) as its position so when I try to home it, it doesn’t truly home to the proper spot (was only able to test the homing with the working z-axis). I have tested several different speeds and step intervals in imswitch with no luck.

Are you able to provide any troubleshooting suggestions in terms of the firmware that might fix this? Or even hardware suggestions I will listen to as well. Just trying to get this working and this is my last issue at the moment. I feel like this should be the easiest thing to get working so I am not sure why I have so many issues with this

I’m affraid that it must be an electronics issue then. If the NEMA11 works without problems then I’m tempting to say that it’s a power issue. Not enough current probably. Did you check e.g. GRBL or something or the simple ACCELStepper example with modified pins?

@benedictdied Do you have any idea why the GUI gives back random large numbers when I use the “+” and “-” button? Even for the Z-axis motors that work well this happens? I assume this will become a problem if I want to set a home position.

Sorry, no idea. What does the serial return? Set debug:true in the json config, please.

@benedictdied I upgraded my power supply to 24V 15A spec and still having the same issue with my X and Y Nema 17 motors. Not able to upload a video of it here. I have basically exhausted all of my options here in terms of the electronics (replacing all components, adjust Vref on the driver, upgrading to a DRV9925 driver, etc…). I have included a few pictures of my setup. Is there any resources out there that can help with this?

I remember seeing an issue awhile back where the motors only moved in one direction but I now cannot find that specific issue. This happens as well with my x and y motors. Was there a specific fix for that issue?

Ive seen people on the repositories get this working with similar setups, at least they claim to (Farghal1 on github) so I am not sure what makes my situation different. Can you refer me to anyone that might be able to solve this issue or you know uses the same setup?


Hey @jsmithe2, thanks for reporting the issue. Could you try flashing the following code:

// Example sketch to control a stepper motor with A4988 stepper motor driver 
// and Arduino without a library. 
// More info: https://www.makerguides.com
// Define stepper motor connections and steps per revolution:
#define dirPin GPIO_NUM_16
#define stepPin GPIO_NUM_26
#define stepsPerRevolution 200
#define enPin GPIO_NUM_12

void setup() {
  // Declare pins as output:
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
pinMode(enPin, OUTPUT);
digitalWrite(enPin, LOW);
}

void loop() {
  // Set the spinning direction clockwise:
  digitalWrite(dirPin, HIGH);

  // Spin the stepper motor 1 revolution slowly:
  for (int i = 0; i < stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }

  delay(1000);

  // Set the spinning direction counterclockwise:
  digitalWrite(dirPin, LOW);

  // Spin the stepper motor 1 revolution quickly:
  for (int i = 0; i < stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1000);
  }

  delay(1000);

  // Set the spinning direction clockwise:
  digitalWrite(dirPin, HIGH);

  // Spin the stepper motor 5 revolutions fast:
  for (int i = 0; i < 5 * stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(500);
  }

  delay(1000);

  // Set the spinning direction counterclockwise:
  digitalWrite(dirPin, LOW);

  //Spin the stepper motor 5 revolutions fast:
  for (int i = 0; i < 5 * stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(500);
  }

  delay(1000);
}

I’ve taken it from here:

Let me know if the X motor will rotate in both directions. If not then something else is brocken.