Pages: [1]   Go Down
Author Topic: EasyDriver stepper motor driver not fast  (Read 853 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 238
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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);
  }
}
Logged

UK
Offline Offline
Faraday Member
**
Karma: 47
Posts: 3531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Leicester UK
Offline Offline
Full Member
***
Karma: 3
Posts: 114
Half intelligent old fart.....
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Open your mind, but not too far, your brain might fall out!!

Also like model building, photography and keeping an eye on my 294? Cacti & Succs...

Take a look at http://melsaunders.x10.bz

0
Offline Offline
Full Member
***
Karma: 0
Posts: 238
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 47
Posts: 3531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 238
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 6
Posts: leet
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

UK
Offline Offline
Faraday Member
**
Karma: 47
Posts: 3531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 238
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 238
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anybody?
Logged

UK
Offline Offline
Faraday Member
**
Karma: 47
Posts: 3531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Answer all the questions first ...

...R
Logged

Pages: [1]   Go Up
Jump to: