Hi there! Could someone help me ? I'm having a problem to control NEMA 23 stepper motor using arduino mega 2560, TB6600 driver and a 12V 10A power supply.
I can't get the electrical specs of the motor but it's 200 steps per revolution, its model is 23HS404-25. I bought it from one dealer who didn't have its data sheet and I can't find it on Google either.
The problem is the motor stalls only at 750 steps per second (roughly 3 revs/s) with no load and stop rotating, vibrate while getting very hot.
I'm using accelstepper library.
THIS IS THE CODE
int step_pin=3, dir_pin=2;
static int i=0;
static int steps=4000;
boolean is_running= true;
void setup() {
// put your setup code here, to run once:
pinMode(step_pin, OUTPUT);
pinMode(dir_pin, OUTPUT);
}
void loop() {
digitalWrite(dir_pin,HIGH);
while(Serial){
if(is_running)
{
digitalWrite(step_pin, HIGH);
delayMicroseconds(750);
digitalWrite(step_pin, LOW);
delayMicroseconds(780);
i++;
if (i==steps){
is_running=false; }
}
}
/*delay(1000);
// put your main code here, to run repeatedly:
digitalWrite(dir_pin,LOW);
for (i=0;i<steps;i++)
{
digitalWrite(step_pin, HIGH);
delayMicroseconds(350);
digitalWrite(step_pin, LOW);
delayMicroseconds(350);
}
delay(1000);*/
}
Actually I was trying to control the stepper through serial-by sending number of steps through serial. So, "while (serial)" is just a trash left while I was clearing unwanted stuff to leave only the code I tried to use, which gave me only 750 steps per second.
I mean I was trying to use the code with serial while I wasn't happy with the speed I got. So I want to be happy with the speed first then work on serial.
Before using this code which I wrote myself, I used accelstepper library too. It gave almost the same results: if I put speed more than 600 steps per second the motor stalls, vibrate like it is rotating but not, while getting hot.
THE CODE SHOULD LOOK LIKE THIS
int step_pin=3, dir_pin=2;
static int i=0;
static int steps=4000;
boolean is_running= true;
void setup() {
// put your setup code here, to run once:
pinMode(step_pin, OUTPUT);
pinMode(dir_pin, OUTPUT);
}
void loop() {
digitalWrite(dir_pin,HIGH);
if(is_running)
{
digitalWrite(step_pin, HIGH);
delayMicroseconds(750);
digitalWrite(step_pin, LOW);
delayMicroseconds(780);
i++;
if (i==steps){
is_running=false;
}
}
/*delay(1000);
// put your main code here, to run repeatedly:
digitalWrite(dir_pin,LOW);
for (i=0;i<steps;i++)
{
digitalWrite(step_pin, HIGH);
delayMicroseconds(350);
digitalWrite(step_pin, LOW);
delayMicroseconds(350);
}
delay(1000);*/
}
12V is a pretty low voltage if you want performance from your stepper motor,
24V or 36V would fare a lot better. Motor speed and torque-at-speed are mainly
controlled by winding inductance and supply voltage - please post your motor's
datasheet link or product page.