Go Down

Topic: Stepper motor sped with A4988 (Read 255 times) previous topic - next topic

M4ddoX

Hey guys

Im trying to run a 42BYGHM809 stepper motor off a Pololu A4988 driver board with a 12 volt power supply and I am having a few problems getting the speeds I want. I can alter the delays to speed it up but once I get the delays too small (around 400 microseconds) the stepper will struggle to start and will simply whine. I can give the shaft a quick spin manually and it will start but if it tries to change direction same thing happens.

I have wired the circuit up in the exact same way as seen on the Pololu website

Just wondering if there is any way to increase the speed without just reducing the delays.

Cheers

Code: [Select]

//simple A4988 connection
//jumper reset and sleep together
//connect  VDD to Arduino 3.3v or 5v
//connect  GND to Arduino GND (GND near VDD)
//connect  1A and 1B to stepper coil 1
//connect 2A and 2B to stepper coil 2
//connect VMOT to power source (9v battery + term)
//connect GRD to power source (9v battery - term)


int stp = 13;  //connect pin 13 to step
int dir = 12;  // connect pin 12 to dir
int a = 0;     //  gen counter

void setup()
{               
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);       
}


void loop()
{
  if (a <  200)  //sweep 200 step in dir 1
   {
    a++;
    digitalWrite(stp, HIGH);   
    delay(10);               
    digitalWrite(stp, LOW); 
    delay(10);             
   }
  else
   {
    digitalWrite(dir, HIGH);
    a++;
    digitalWrite(stp, HIGH); 
    delay(10);               
    digitalWrite(stp, LOW); 
    delay(10);
   
    if (a>400)    //sweep 200 in dir 2
     {
      a = 0;
      digitalWrite(dir, LOW);
     }
    }
}

Robin2

Have you set the current limit on the A4988 to match your motor?
  And you don't say how much current the motor requires - post a link to its datasheet

Once the current is set to protect the motor try using a higher voltage - the A4988 can go up to 35v I think.

You could also try using the AccelStepper library which, as its name implies, allows the motor to start slowly.

I'm not sure that it has any bearing on your speed problem but this
Code: [Select]
digitalWrite(stp, HIGH); 
    delay(10);               
    digitalWrite(stp, LOW); 
    delay(10);


will also work like this
Code: [Select]
digitalWrite(stp, HIGH);           
    digitalWrite(stp, LOW); 
    delay(20);


and by putting all of the delay-between-steps in one place it can be easier to manage - especially if you want to get away from using the delay() function.

Also delay(40) is 40 millisecs. I presume you were using delayMicroseconds(400) for the limiting case.

If you have 2 delays of 400 usecs between steps - i.e. a total of 800usecs or 1250 steps per second - you are almost certainly limited by the voltage you are using. However I have no idea how much more speed you might get with a higher voltage.

...R

MarkT

Top speed should be roughly proportional to supply voltage, in theory at least.
[ I won't respond to messages, use the forum please ]

rmetzner49

I used to work for a company that manufactured industrial stepper drives, 5A, 65V.  During the testing phase, we ran many motors from 2.2" to 4.2" with torque monitored by an Eddy Current Brake.  The smaller physically the motor is, the faster it will go.  This I suspect is because the winding inductance goes up as size increases.  We could routinely run a 2.2" motor to 5,000 SPS but of course the torque was falling the whole time.  A smaller motor or a motor with less inductance is preferred when you want speed.

Not many steppers will start above about 200 SPS without "stalling".  So a stepper function that lets you set accel/deccel rates as well as target position is not just nice but pretty necessary. 



Robin2


I used to work for a company  .....


Very interesting information. Thanks.

Just out of curiosity do the numbers 2.2" and 4.2" refer to the length of the motor or the width across the front face ?

...R

rmetzner49

The approximate width.
We called them 2.2" motors and they were NEMA 23
The next larger 3.4" would be NEMA 34, and the largest 4.2" were NEMA 42.  Of course the stack length entered into the picture as well.  They come in 1, 2, and 3x.   We found the "single" stack length to be the fastest of the group (for reasons of lower inertia and lower inductance).

Robin2


...... We called them 2.2" motors and they were NEMA 23 .....


Thanks. I was aware of the Nema notation, I just thought you had something else in mind. And I guess it hadn't ocurred to me that the Nema numbers were tenths of inches.

...R

MarkT

Thare are at least 2 different NEMA numbering schemes, and the distances are
usually axle to side-mounting flange distances, not appropriate to small motors
which are face-mounting, so the standard is rather freely interpreted.  For instance
most NEMA17's have a 5mm shaft, NEMA23's a 8mm shaft (neither of which are
American units! - although encoder rear shafts are usually 1/4").  The face-plate
mounting hole positions in particular are not standard, note.
[ I won't respond to messages, use the forum please ]

pravda

>most NEMA17's have a 5mm shaft, NEMA23's a 8mm shaft

Most NEMA 23's have a 0.25" shaft (6.35mm). 


To respond to the OP: the magic word is 'acceleration'.





Go Up