Hi, the servo i am using has a max rated rpm of 3000. It is set to 10,000 pulses per revolution.
Using the sample code with STEP and DIR, i am able to control speed and number of revolutions etc. and it works fine. We know that cnc softwares are able to have servos reach their rated max rpm. Question is, using Arduino, how can i reach a maximum rated speed of 3000 rpm using the sample code? so far using the following looping code, driver showing an rpm of around 653. Unfortunately it doesnt go lower than 1 microsecond. What method can i use in the code to achieve my goal?
/* Example sketch to control a stepper motor with TB6600 stepper motor driver and Arduino without a library: continuous rotation. More info: https://www.makerguides.com */
// Define stepper motor connections:
#define dirPin 4
#define stepPin 5
void setup() {
// Declare pins as output:
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
// Set the spinning direction CW/CCW:
digitalWrite(dirPin, HIGH);
}
void loop() {
for (int i = 0 ; i <= 10000; i++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(1);
digitalWrite(stepPin, LOW);
delayMicroseconds(1);
}
}
do you have a servo or stepper motor? step and dir suggest a stepper motor
i've found the steppers motors can't be stepped faster the ~1msec/step.
don't know how many steps/revolution your motors have, but if there were 32 step/rev, 3000 rpm would correspond to 50 steps/sec, 1600 steps/sec or 1 step every 625 usec which may not be achievable
a more typical RC servo is simply provided a 1-2 msec pulse that rotates it to a position
a "servo" typically uses a DC motor driven in either direction with a controller that measures position and often just drives the motor to that position.
the code you posted generates a step pulse, again suggesting a stepper motor.