# Nema23, TB6600 driver and Arduino Uno RPM

I have nema23, a TB6600 stepper driver and a Arduino Uno.
I need to run the nema at a speed of between 50 and 150 RPM variable if possible.
Direction is not important because I'm converting the rotary motion to linear.
Please advise if I can achieve this and point me to the appropriate coding.
Thanks

The RPM of your stepper is just a function of how fast you send step pulses to your stepper driver. 150RPM is 150 / 60 = 2.5 revs per second. Look at your NEMA 23 motor datasheet and check it has a step angle of 1.8 degrees. If so, then 360 / 1.8 is 200 steps per revolution. You would therefore need to send the stepper driver 2.5 x 200 = 500 pulses per second to get it to run at 150RPM. 50RPM would be 166.7 pulses per second. This assumes that you have set your stepper driver to full step mode. If you use micro-stepping, then you need to factor this in. For example, if you choose 1/16 micro-stepping, then you need 500 x 16 = 8000 pulses per second for 150RPM and 2667 pulse per second for 50RPM.

As far as code, something like the following will get you going, but you will need to adapt this for your particular circuit (output pins used etc.).

``````// Define pin connections & motor's steps per revolution
const int dirPin = 2;
const int stepPin = 3;

void setup()
{
// Declare pins as Outputs
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);

// Set motor direction clockwise
digitalWrite(dirPin, HIGH);
}
void loop()
{
// Will output 500 pulses per second
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}
``````

What are you trying to do - is this actually position control?

Anyway I'd suggest getting the AccelStepper library, you'll definitely need speed-ramping with a large motor like a NEMA23 frame stepper.

What drive mechanism is used? You'll probably need to use microstepping to avoid resonance issues, especially if using a leadscrew.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.