how to control stepper motor with gear reducer, i am very confused, please someone give me a code to control stepper motor with gear ratio 1:14 using arduino, thank you very much!!!
Which Arduino board are you using ?
How is the stepper powered ?
Have you got a sketch to move the stepper motor ?
What is your motor's part number? Which motor driver are you using?
What is your power supply's voltage and current ratings?
Forum is not a free give away institution.
Look at any stepper project. The gearbox only divides the movement by 14 and multiplies the torque by 14 relative to the stepper alone.
I am using arduino uno,driver tb6600, power 12V 2Ahttps://cuahangvattu.com/products/dong-co-buoc-42-kem-hop-giam-toc-step-motor-42-robot
#define stepPin 2
#define dirPin 3
#define en 4
int microStep = 32; //đây là số điều chỉnh trên tb6600, cần sửa s1 s2 s3
float angleStep = 1.8;
float stepsPerRound = microStep * 360.0 / angleStep; //200 xung
long steps = 1 * stepsPerRound;
int speedV = 240; //rpm
float speeds = 1.0 / (speedV/60 * stepsPerRound) / 2.0 * 1000000;
void setup() {
Serial.begin(9600);
// Declare pins as output:
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(en, OUTPUT);
digitalWrite(en, LOW);
delay(5000);
Serial.println(speeds);
}
void loop() {
delay(1000);
// 2 round in clock
digitalWrite(dirPin, HIGH);
steps = 15 * stepsPerRound; //400
Serial.print("Move to ");
Serial.print(steps / stepsPerRound, 0);
Serial.print(" rounds ");
Serial.println(steps);
for (long i = 1; i <= steps; i++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(speeds);
digitalWrite(stepPin, LOW);
delayMicroseconds(speeds);
}
delay(1000);
// 5 round in unclock
digitalWrite(dirPin, LOW);
steps = 15 * stepsPerRound;
Serial.print("Move to ");
Serial.print(steps / stepsPerRound, 0);
Serial.print(" rounds ");
Serial.println(steps);
for (long i = 1; i <= steps; i++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(speeds);
digitalWrite(stepPin, LOW);
delayMicroseconds(speeds);
}
}
Control it the same way you control any stepper.
The gearbox just reduces the step size by a factor of 14, with added "backlash".
Look up backlash, if you don't know that term.
Thank you very much, I look forward to receiving your comments on my code.