I'm trying to use the Arduino Uno R3 to drive a Applied Motion PDO2035 stepper drive. This is an older drive that only does 1/2 stepping. It has a built in oscillator which is good for testing. I have a NEMA 17 motor that's good for 1.7Amps/phase. I've worked a lot with industrial applications with stepper motors and never have any issues. With the built in oscillator I can drive this motor up through the entire speed range and reach a max speed of 12,000 steps/sec with a 400 steps/rev motor. I even only set the motor current for 0.5 amps. Of course to reach that speed I must set the acceleration. So I wouldn't think the drive would be the issue.
Now when I go to use the Arduino I have issues. First I tried using accelStepper. I read an analog input pot value and have some logic that uses elapsedMillis to check the pot every 100 msec and some deadband to filter out any noise of the pot, then I use setSpeed to set a new speed. Then I have runSpeed() going all the time. Even if I set the pot down low and slowly increase the speed I seem to hit spots where the speed doesn't appear to be changing (even though I have a println statement showing me what the new value is everytime I adjust the pot. I also hit spots that make the motor "squall or chatter". I'm only trying to get to 1200 steps/sec.
This isn't the entire code, and I know it's not pretty but I've butchered the heck out of it trying to figure out what the problem is. The analog read and calculation could be within the Readjust timer "If" statement but I needed it elsewhere for some other parts of the code thus it ended up outside where it is calculated every scan verses every 100 mSec. Even with the wasted cycle time of the extra code I wouldn't think it would be causing the problem.
elapsedMillis Readjust_Speed_Timer; // somewhere at the beginning of the program
.
.
AI_POT_Val = analogRead(AI_POT_Pin); // set AI_POT_Val to FLOAT so calc below done correctly, needs fixed in future
.
.
stepper_Mtr_Spd_Deadband = AI_POT_Fast_Val / 1023 * Stepper_Mtr_Max_Spd * 2 - Stepper_Mtr_Max_Spd;
.
.
if(Readjust_Speed_Timer >= Readjust_Speed_Timer_Setpt){
if(abs(Stepper_Mtr_Spd_Setpt - Stepper_Mtr_Spd_Deadband) > 5){
Stepper_Mtr_Spd_Setpt = Stepper_Mtr_Spd_Deadband;
Stepper_Mtr.setSpeed(Stepper_Mtr_Spd_Setpt);
Serial.println(Stepper_Mtr_Spd_Setpt);
}
Readjust_Speed_Timer = 0; //Initialize Readjust Timer
}
Stepper_Mtr.runSpeed();
I also tried doing my own pulses using elpasedMircos, it has the same problem.
What am I doing wrong? I'm new to this and having programmed in "C" for a long time, so I'm a little rusty. Or does the Arduino just have limitations on the output pins. What duty cycle should one pulse at, I tried 50% with the elapsedMicros, I'm not sure what accelStepper uses.