The drivers kinda work but I am getting a lot of problems doing the most simple of stepper motor exercises. I'll list a few problems I have encountered and what I tried to do to fix them.
I can not check the vRef on the driver. I have checked and rechecked a bunch while referencing this. https://a.pololu-files.com/picture/0J4232.600.png?f2f6269e0a80c41f0a5147915106aa55
I get no reading on the trim pot when I connect it with the GND pin or the arduino ground directly. I can read the logic PSU voltage when I go between the trim pot and other pins.
Glossing over the last issue, I adjust the pot until the motor starts to work. The motor should only take 1.5amps or so. But it constantly sets off my PSU's current limited light. But is should be able to give 3Amps! Way over how much the motor needs. The drivers get super hot, but I already saw people mention that is fairly normal. I just get a lot of whining/beeping from PSU. I don't know if this is a driver thing or if it is normal.
Finally I get some whining and stuttering from the motor. The code should just be :
speed is an amount of time for a delay
void motorStep() // This is the function that sends pullses to the steppers. Each iteration of the loop is one pulse
{
for(int x = 0; x < 6; x++) // Here is where we set the number of revolutions. 1rev = 200 stepps
{
digitalWrite(STEP,HIGH); // Sending the pulse
//delayMicroseconds(Speed); // By sending the Speed parameter we get a pulse time of 2*speed
digitalWrite(STEP,LOW);
delayMicroseconds(Speed);
}
}
I hope for some feedback because I'm sure other people have gotten these cheapo drivers. I'm hoping this is all salvageable.
Here is the code.
Speed ot set to 1000 which should be fine. And I should be able to go much higher. Because at 1000 its pretty fast.
There is some other stuff in the code for some stuff in my project.
Also anything less than like 5 steps just shakes the motor around.
/*pseudo code
#define stepPin 9 // Step pin on the drv8825. Inputs sent here determine the speed of the motors revolution #define dirPin 8 // Changing the state of this pin changes the direction of the stepper motor
int Speed = 1000; // This is the value that determines the speed of the motor
volatile byte balls; // This value is the counter for Hall effect detection
// It uses a variable type Volatile that allows a value to be changed outside of the currently running block of code
// This allows us to run code that while constantly checking on the hall effect count
void setup()
{
Serial.begin(9600); // Begins the Serial
attachInterrupt(0, magnet_detect, RISING); // Initialize the intterrupt pin (Arduino digital pin 2)
// This attatches the function magnet_detect() to the arduino interupt pin.
// Now this function is called every time the condition is met. In this case the condition is RISING.
balls = 0; // Initializes the ball count.
pinMode(stepPin,OUTPUT); // Copnfiguring pins
pinMode(dirPin,OUTPUT); //
}
void loop() // Main loop. It is not really a loop becuae for this test we run one revolution and then exit the program
{
digitalWrite(dirPin,LOW); // Sets direction of motor rotation
motorStep(); // Calls motorStep() funtion. See below.
exit(0); // Exits the experiment.
}
void magnet_detect( ) //This function is called whenever a magnet/interrupt is detected by the arduino
{
balls++; // This adds to the count 'balls' every time the HE sensor gets a hit
Serial.println(balls); // This just prints to the serial monitor so we can see the results
}
void motorStep() // This is the function that sends pullses to the steppers. Each iteration of the loop is one pulse
{
for(int x = 0; x < 200; x++) // Here is where we set the number of revolutions. 1rev = 200 stepps
{
digitalWrite(stepPin,HIGH); // Sending the pulse
delayMicroseconds(Speed); // By sending the Speed parameter we get a pulse time of 2*speed
digitalWrite(stepPin,LOW);
delayMicroseconds(Speed);
}
}
Start your tests with a much lower speed. You are trying to make 500 steps per second. Start with 5.
If your DRV8825 is not working properly there is little option but to get a good one. And if you have one that you know is good it may help you to debug the faulty one.
Be VERY CAREFUL never to disconnect the wires between the motor and the stepper driver while the driver is powered up. The driver will be instantly destroyed,
And yeah I would like a slower speed. But it stopped working at Speed = 1300; for some reason.
The other day it was working at 5000.
I just ordered 5 more knock offs and one actual Pololu one to see a difference. I hope I can get this to work.
The strangest thing is that I can't see the Vref on the knock offs at all. Hopefully the Pololu will be better.