Go Down

Topic: EasyDriver stepper motor driver not fast (Read 1 time) previous topic - next topic

matinzk

Hi.

I have been using the bildr's tutorial for Easydriver stepper motor driver to run a stepper motor on my car cluster.

bildr.org/2011/06/easydriver/

It works fine to go back and forth but only at speeds of up to 0.3. For example:   rotate(4200, 0.3);

If I make it any faster "rotate(4200, 1);" , you can see that it tries to move but it doesn't at all! I need it to move as fast as possible. Is there any solutions at all?

Here is the code:

Code: [Select]

#define DIR_PIN 2
#define STEP_PIN 3

void setup() {

  pinMode(DIR_PIN, OUTPUT);
  pinMode(STEP_PIN, OUTPUT);
}

void loop(){

  //rotate a specific number of microsteps (8 microsteps per step)
  //a 200 step stepper would take 1600 micro steps for one full revolution
  rotate(1600, 1); //reverse
  delay(1000);

  rotate(1600, 1);
  delay(1000);
}



void rotate(int steps, float speed){
  //rotate a specific number of microsteps (8 microsteps per step) - (negitive for reverse movement)
  //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
  int dir = (steps > 0)? HIGH:LOW;
  steps = abs(steps);

  digitalWrite(DIR_PIN,dir);

  float usDelay = (1/speed) * 70;

  for(int i=0; i < steps; i++){
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(usDelay);

    digitalWrite(STEP_PIN, LOW);
    delayMicroseconds(usDelay);
  }
}

void rotateDeg(float deg, float speed){
  //rotate a specific number of degrees (negitive for reverse movement)
  //speed is any number from .01 -> 1 with 1 being fastest - Slower is stronger
  int dir = (deg > 0)? HIGH:LOW;
  digitalWrite(DIR_PIN,dir);

  int steps = abs(deg)*(1/0.225);
  float usDelay = (1/speed) * 70;

  for(int i=0; i < steps; i++){
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(usDelay);

    digitalWrite(STEP_PIN, LOW);
    delayMicroseconds(usDelay);
  }
}

Robin2

You don't say how long (in seconds or fractions) it takes the motor to do one revolution.

And you haven't said what stepper motor you are using or what voltage you are driving it at.

...R

Cactusface

Hi,
      Yes lots more info needed, could be that this motor will not move that fast!! if the interval between steps is too short, the motor just sits there twitching!!  Try a longer interval (delay()) between steps, what is the motor rated at??

Regards

Mel.
Open your mind! But not too far, your brains might fall out.
Also like Photography, model building and my 300+ Cacti and Succs.

matinzk

Here is a clip of it on the cluster. It goee about 270 degrees.

https://www.youtube.com/watch?v=hrXkIfIyvt8&feature=youtube_gdata_player

It's only getting power from the arduino.

It's a car stepper motor so theoretically should go pretty fast. I haven't got much info on it.

I've tried longer periods of up to 5 seconds without any luck.

Thanks.

Robin2

The video has me even more confused. Is that a picture of it working with your code? If so it seems to be doing fine.

Almost certainly the Arduino can't provide enough power for the motor, you should give it a separate supply with a common ground. And if it's an automotive product it is probably designed to work with 12v.

It would help if you can show us a diagram of the wiring you are actually using.

...R

matinzk

Yes the clip is what the code does. It's working fine but I need it to go faster.

The wiring diagram is exactly like in this link:http://bildr.org/2011/06/easydriver/

I'm going to try it with a12v PSU to see what happens.

sbright33

I have some code that will keep the motor Cool with a 12v PS.  But it is not designed for EasyDriver.  Maybe you can use it for some ideas to write your own.  http://forum.arduino.cc/index.php?topic=85335.90
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Robin2

Your wiring CAN'T be "exactly like" the link because the diagram in the link uses a 12v psu.

It's pretty much impossible to help you when you don't give the full details. You still haven't said how fast the motor revolves (rev/sec) or how fast you want it to go.

...R


Yes the clip is what the code does. It's working fine but I need it to go faster.

The wiring diagram is exactly like in this link:http://bildr.org/2011/06/easydriver/

I'm going to try it with a12v PSU to see what happens.

matinzk

Yes you're right, I was typing in a hurry.

The Easydriver board is powered with the Arduino via +5v and GND pins. No power to the PWR IN pins. I've tried the same code with a power supply via PWR IN pins but the stepper motor doesn't move at all.

matinzk


Robin2

Answer all the questions first ...

...R

Go Up