I have been trying to make use of any kind of a motor in my project. For this application, I need to drive my motor at exact constant speed (50rpsecond). The applied torque will be in turning direction of the motor and very very small (it can be even considered "zero Nm").
I already have a circuit, with DRV8825 stepper motor driver and NEMA17 stepper motor. I can reach the speed of the motor at 6 rps, however it is not enough.
If I use a DC motor does it start at constant velocity if every thing else remains the same or it increases gradually?
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Can you post a link to the spec of your motor please?
For quick answer, I couldn't specify my code with icons sorry.
My Code;
// defines pins numbers
const int stepPin = 3;
const int dirPin = 4;
int rp_m = 1;
int rp_mm = 0;
int zaman1;
int zaman2;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
Serial.begin(9600);
}
void loop() {
int zaman1 = millis();
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 1200; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(411);
digitalWrite(stepPin,LOW);
delayMicroseconds(411);
// int rp_m = rp_m+1;
// int rp_mm = rp_m / 200;
// Serial.println(rp_mm);
}
zaman2 = millis();
Serial.println(zaman2-zaman1);
delay(1000); // One second delay
// digitalWrite(dirPin,LOW); //Changes the rotations direction
// Makes 200 pulses for making two full cycle rotation
// for(int x = 0; x < 1200; x++) {
// defines pins numbers
const int stepPin = 3;
const int dirPin = 4;
int rp_m = 1;
int rp_mm = 0;
int zaman1;
int zaman2;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
Serial.begin(9600);
}
void loop() {
int zaman1 = millis();
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 1200; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(411);
digitalWrite(stepPin,LOW);
delayMicroseconds(411);
// int rp_m = rp_m+1;
// int rp_mm = rp_m / 200;
// Serial.println(rp_mm);
}
zaman2 = millis();
Serial.println(zaman2-zaman1);
delay(1000); // One second delay
// digitalWrite(dirPin,LOW); //Changes the rotations direction
// Makes 200 pulses for making two full cycle rotation
// for(int x = 0; x < 1200; x++) {
// digitalWrite(stepPin,HIGH);
// delayMicroseconds(400);
// digitalWrite(stepPin,LOW);
// delayMicroseconds(400);
}
// delay(1000);
//}
Which stepper motor, part number?
Have you set the current limit on the driver module to match the stepper motor?
EvrimYilmaz:
If I use a DC motor does it start at constant velocity if every thing else remains the same or it increases gradually?
A stepper motor will also need to be accelerated if you want it to operate at a high speed. If you try to start it at a high speed it will just miss steps.
I need to drive my motor at exact constant speed (50rpsecond).
50 revolutions per second is 3000RPM. 3000RPM is the synchronous speed of a synchronous motor fed from 50Hz AC. If you are in a country that uses 50Hz mains then get a synchronous motor and use that. This is exactly how electric clocks used to keep time before electronic clocks were invented.
The millis() function works well in the current application.
The motor: NEMA17-13-04SD-AMT112S which is the motor on the top of the datasheet.
Yes I have set the current limit to 0.6 as I calculated from the datasheet of the driver. It works fine I guess.
The arduino: UNO R3
I have seen many applications of 50 rps and even 150 rps stepper motor on biomechanics field on literature. Somehow people manage to do that I assume.
Perry can you give more information or share a link about driving a synchronous motor by using outlet, if I am didn't misunderstand.
Perry can you give more information or share a link about driving a synchronous motor by using outlet, if I am didn't misunderstand.
I know they used to be common as they were used in electric clocks before electronic clocks became common. A synchronous motor locks to the mains frequency, so 3000RPM for a 2 pole motor on 50Hz. I did a quick search on Amazon and got lots of them, all with gear boxes on the output. I couldn't find one without a gearbox. Maybe I didn't look hard enough. If you want 3000RPM and very little torque then maybe buy one and play with it, always understanding that it might not be what you need.
I think old record players used them as well in order to get the turntable speed right. These motors had a bit more torque than clock motors.