So currently, I am developing a pulley system that will be moving only a string at a max speed of 30 rev/sec. This system must have the ability to be tested at different variable speeds (using potentiometer right now). The current speed I have been able to produce is nowhere near my goal. The torque should be low given I will only be pulling a string, so my loss through speed shouldn’t be an issue. I have tested without any load on the stepper with no difference in speed. Along with this, I have seen the stepper make lots of noise with a choppy rotation.
I have attempted to use microstepping to help with this choppiness with some success, but now I wish to speed up the rotation. Is there something I’m missing???
I have attempted this with a
- 12v, 2A power supply
- Nema 17 Stepper Motor with these Specs:
Motor type: Bipolar Stepper
Phase Resistance: 1.5Ohm
Phase Inductance: 2.8mH
Detent Torque: 2.2N.cm
Rotor Inertia: 54g.cm2
Holding Torque: 40N.cm
Rated current 1.7A
Step angle: 1.8 deg
Step angle accuracy: + - 5%(full step, not load)
Resistance accuracy: + - 10%
Inductance accuracy: + - 20%
Temperature rise: 80deg Max(rated current, 2 phase on)
Ambient temperature: —20deg ~+50deg
Insulation resistance: 100MΩ Min, 500VDC
Insultion Strength: 500VAC for one minute
- TB6600 Stepper Motor Driver with these Specs:
9-42V.
5 subdivision mode options (1/1, 1/2, 1/4, 1/8, 1/16,1/32) for microstepping.
Output current: IOUT = 4.0A (peak, in 100ms).
rated output: IOUT = 3.5 A
Resistance (a +) = 0.4
Alarm output pin current:Ialert = 1mA
Monitoring output pin (MO): Imo= 1mA
Here is what code I have currently being using:
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#define POT_PIN_SIG A0 //Speed Controller
#define ON_OFF_SIG A1 // On-Off Potentiometer (dont have switch on hand)
// 200 steps * 1.8 degrees/step = 1 rev
//Max speed = 30 rev/s = 6000 steps/s
// defines pins numbers
float cir_pulley = 8.16 ; /circumference for speed calculation
const int stepPin = 5; //steps output for motor
const int dirPin = 2; //direction of motor
const int enPin = 8; //enables motor
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(enPin,OUTPUT);
lcd.begin(16,2); // define lcd matrix
lcd.setCursor(0, 0); // define below message's start point
lcd.print("String Linear");
lcd.setCursor(0, 2);
lcd.print("Speed: ");
lcd.setCursor(12,2);
lcd.print("cm/s");
}
void loop() {
// read the sensor value:
int On_Or_Off = analogRead(ON_OFF_SIG);
if (On_Or_Off > 500) {
int sensorReading = analogRead(POT_PIN_SIG);
// map it to a range from -90 to 90:
int motorSpeed = map(sensorReading, 0, 1023, -90, 90);
// set the motor speed:
// define the speed using the potentiometer to update the delay
// which in turn will change speed
//microstepping of 1/4 tested here
if (motorSpeed > 3){
digitalWrite(enPin,LOW); //motor on
digitalWrite(dirPin,HIGH);//chnge direction to CW
digitalWrite(stepPin,HIGH);
delayMicroseconds(7500/(4*motorSpeed));
digitalWrite(stepPin,LOW);
delayMicroseconds(7500/(4*motorSpeed));
}
else if(motorSpeed < -3) {
digitalWrite(enPin,LOW); //motor on
digitalWrite(dirPin,LOW);//change direction to CCW
digitalWrite(stepPin,HIGH);
delayMicroseconds(7500/(4*abs(motorSpeed)));
digitalWrite(stepPin,LOW);
delayMicroseconds(7500/(4*abs(motorSpeed)));
}
else if(-3 <= motorSpeed <= 3 ) {
digitalWrite(enPin,HIGH); //motor off
delayMicroseconds(500);
}
lcd.setCursor(6, 2);
// print motor speed to lcd
lcd.print(float abs(motorSpeed)/3*cir_pulley) ;
}}