I'm making a rock tumbler out of 2 NEMA 17 steppers and an Arduino Uno with the CNC Shield. I can get it to work, but it's only going about 300-ish RPM. I have a very basic code i'm using and the only variable is the delay, but if i reduce the delay any more the motor just stalls. Is there something i'm missing? The stepper is currently quarter stepped. I can change it to half or full step, but i have to increase the delay to compensate, so it still only goes the 300rpm no matter how i configure it. It's all running off of 12v. Does it need higher voltage? The shield says 12v is minimum.
Here is my code:``` #define stepPinX 2 #define dirPinX 5 #define stepPinY 3 #define dirPinY 6
void setup() {
// Sets the two pins as Outputs
pinMode(stepPinX,OUTPUT);
pinMode(dirPinX,OUTPUT);
pinMode(stepPinY,OUTPUT);
pinMode(dirPinY,OUTPUT);
}
void loop() {
Yes. You need to use acceleration. Read the datasheet for the stepper and look for the "Run in, run out" parameters!
That's the maximum bang on speed the stepper manages, without any load.
That code would produce 1000000 / 200 = 5000 steps per second, 1500 RPM with a 200 step per revolution motor. Impossible without acceleration (ramp up/down).
Why two motors?
Post a drawing of your tumbler.
oh, yeah. i recall that from my 3D printer.
Well, i'll have to look for another solution. i really have no idea how to program Arduinos beyond the code i provided. Adding acceleration and anything else like that is way above what i'm able to do.
That's Your only option. Did You find the "Run in/Run out" parameters for Your steppers?
Using a stepper library is the solution. Knowing members have told about MobaTools library. You specify an acceleration, max speed and then calls for high speed stepping, and the library makes it happen.
I've managed to use the old AccelsStepper library. It can work in different ways but it's not easy to be successful. It often calls for work... Take a look into MobaTools!
You need to dive into that. Looking at examples, other projects done, and studying the components, like how acceleration is used, will help You.
What is the barrel diameter? What is the roller diameter? What maximum barrel RPM do you want? I would use the MobaTools library for speed ramp up / down.
Is the problem because one motor is dragging the other or pushing the other, causing reverse actions by the motor while it is trying to keep an exact position? What if one roller was freewheeling?