i am having trouble with my stepper motor and with driver i have DRV8825 driver and stepper motor heres moter description
|Brand|sunrobotics|
|Voltage|2.4 Volts|
|Horsepower|2.8 hp|
|Item Dimensions LxWxH|6.4 x 4.2 x 4.2 Centimeters|
|Item Weight|300 Grams|
- Current (A): 1.56
- Resistance (Ohms): 2.8
- High accuracy of around 3 to 5% a step.
I am using 24 V power supply
when i run motor it is not gattng that much power and it is making so much noise (i am not using microsteps) i wan t midum speed and high torque heres my code
// Define pin connections & motor's steps per revolution
const int dirPin = 2;
const int stepPin = 3;
const int stepsPerRevolution = 20000;
void setup()
{
// Declare pins as Outputs
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop()
{
// Set motor direction clockwise
digitalWrite(dirPin, HIGH);
// Spin motor slowly
for(int x = 0; x < stepsPerRevolution; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}
delay(100); // Wait a second
// Set motor direction counterclockwise
digitalWrite(dirPin, LOW);
// Spin motor quickly
for(int x = 0; x < stepsPerRevolution; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(100); // Wait a second
}
// Include the AccelStepper Library
#include <AccelStepper.h>
// Define pin connections
const int dirPin = 2;
const int stepPin = 3;
// Define motor interface type
#define motorInterfaceType 1
// Creates an instance
AccelStepper myStepper(motorInterfaceType, stepPin, dirPin);
void setup() {
// set the maximum speed, acceleration factor,
// initial speed and the target position
myStepper.setMaxSpeed(100);
myStepper.setAcceleration(50);
myStepper.setSpeed(200);
myStepper.moveTo(200);
}
void loop() {
// Change direction once the motor reaches target position
if (myStepper.distanceToGo() == 0)
myStepper.moveTo(-myStepper.currentPosition());
// Move the motor one step
myStepper.run();
}
