Stepper motor not rotating, just vibrate when rotated manually

Hello! i want my stepper motor to rotate at 500rpm continuously without stoping. but it not rotating and when i try to rotate it manually it vibrates and make a weird sound. i am using esp32 c3 supermini, tmc2208 and stepper motor 17pm-j349-p3vs and a 16v 100uF capacitor.

here is my code


#include <AccelStepper.h>
// Define stepper pins
#define STEP_PIN 1      // Step pin
#define DIR_PIN 2       // Direction pin
#define EN_PIN 10
 
// Microstepping control pins
#define MS1_PIN 7
#define MS2_PIN 6
 
// Steps per revolution for the motor
const float stepsPerRevolution = 200;
// Microstepping multiplier (1, 2, 4, 8, 16, or 32)
int microstepSetting = 2;
 
// AccelStepper instance in driver mode
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
 
void setup() {
  // Set microstepping pins as outputs
  pinMode(MS1_PIN, OUTPUT);
  pinMode(MS2_PIN, OUTPUT);
  pinMode(EN_PIN, OUTPUT);
 
  // Set microstepping mode (adjust as needed: HIGH or LOW)
  digitalWrite(MS1_PIN, HIGH);  // Set to LOW or HIGH for desired microstep setting
  digitalWrite(MS2_PIN, LOW);  // Set to LOW or HIGH for desired microstep setting
  digitalWrite(EN_PIN, LOW);
 
  // Set the desired RPM and the max RPM
  float desiredRPM = 150; // Set the desired speed in rpm (revolutions per minute)
  float MaxRPM = 200; // Set max speed in rpm (revolutions per minute)
 
  // Calculate and set the desired and max speed in steps per second
  float speedStepsPerSec = (microstepSetting * stepsPerRevolution*desiredRPM) / 60.0;
  float Max_Speed_StepsPerSec = microstepSetting * stepsPerRevolution * MaxRPM / 60; // Specify max speed in steps/sec (converted from RPM)
  stepper.setMaxSpeed(Max_Speed_StepsPerSec);
  stepper.setSpeed(speedStepsPerSec);
}
 
void loop() {
  // Run the motor at constant speed
  
  stepper.runSpeed();
}

Here is my wire diagram

what do i do? i have checked every thing. i am troubleshooting this since 2 weeks. i swaped every cable, tried every wire combination, adjusted vref, changed pins on esp32, even changed motors but same result. i have tried many codes and followed many youtube videos but nothing worked.

Hi, @ahmad0040
Welcome to the forum.

Can you post a link to data/specs of the stepper?

Do you have a DMM? Digital MultiMeter?

Are you using an Example code from that library?

Tom.... :smiley: :+1: :coffee: :australia:

  • So you are powering the tmc2208 with 5v and the ESP is 3V3 ?

  • If you have a 5V Arduino try that.

i dont have its datasheet because i could not found one. i got this information from chatgpt.

17PM-K349-P3VS
step angle
1.8°
rated voltage
5V
rated current
1.0 A
holding torque
2.6 kg·cm (0.255 Nm)
resistance
5.0 Ω
inductance
4.6 mH
wire type
6 wires (Unipolar/Bipolar)

and i dont have multimeter, i have ordered one but it have not arrived yet. i have been testing it with clamp meter which can check for dc voltage but not in decimal points.

i dont have arduino.

How will you identify the winding connections.

The ESP32 works in the Arduino IDE environment.

Tom.... :smiley: :+1: :coffee: :australia:

chatgpt says it is rated for 5v but on its sticker it says 2.9v and 0.8 something, sticker is very damaged.

clamp meter does have a beep mode. i just checked which wires make a beep sound. thats how i found the pairs

Hi,
Thanks for that.

Can you post some images of your project?
So we can see your component layout.

Try for a slower speed, say 100rpm.

Tom.... :smiley: :+1: :coffee: :australia:

1 Like

sorry for my messy wiring.




sorry for my poor english.

i have tried for lower speed but it only makes the vibration slow when rotated manually.

Hi,
Habe you looked and tried this tutorial example;
It doesn't use a library, so should be good to test your hardware.

Tom.... :smiley: :+1: :coffee: :australia:

1 Like

Does it do one step at a time if you tweak things manually?

For instance, this controls an A4988 stepper driver with just buttons and wires:

If you get yours hooked up properly, you could tweak the step pin and see if it steps your motor.

In your pics, there looks like lots of junctions in between the driver and your stepper motor. A bad connection somewhere in there could have fried your driver.

i have finally got it to work. today i got my multimeter delivered and i upgraded from tmc2208 to tmc2209 and set Vref to 1.09v and swapped some wires and Baam... it works now. the only problem is that it goes to only 250rpm, i wanted 500rpm. i have tried 24v but that just increased its torque. i have ordered a frequency generator module online because its either esp32 c3 supermini limitation for generating frequency or nema 17 limitation. if it is esp32's than frequency generator should work, if its nema 17 than i will use gears to increase rpm. Finally at least i am getting somewhere. :grin:

Maybe try digitalWrite(MS1_PIN, LOW); for full steps and double the speed.

Just changing the supply voltage will not, as you have found out, increase speed, speed is a digital signal frequency.
So software controls speed.
Good to see you got it working and have "Solutioned" the thread.

Can you post your final schematic please?

Tom.... :smiley: :+1: :coffee: :australia:

I have tried everything. Multiple codes, all micro stepping modes. I am just waiting for my frequency pulse generator module. If that doesn't work I will use GT2 pully Gears.

sure... here is the image...


every thing is same except the wiring of the motor and vref.

this is the code

#define STEP_PIN 1
#define DIR_PIN 2
#define EN_PIN 10

void setup() {
  pinMode(STEP_PIN, OUTPUT);
  pinMode(DIR_PIN, OUTPUT);
  pinMode(EN_PIN, OUTPUT);

  digitalWrite(EN_PIN, LOW); // Enable driver
  digitalWrite(DIR_PIN, HIGH); // Set direction
}

void loop() {
  digitalWrite(STEP_PIN, HIGH);
  delayMicroseconds(10);  // Lower = faster
  digitalWrite(STEP_PIN, LOW);
  delayMicroseconds(10);
}

this code is giving me the best results. i have tried many codes. maximum i got my motor to move is 250rpm but with no torque at all. this code is simple and gives me 150 rpm with good amount of torque and the motor does not heat up alot with this code. the 250rpm code was heating my motor to 50C in 5 minuits. this code does not heat up the motor.