Max speed problem

351 views
Skip to first unread message

Sam

unread,
Feb 17, 2016, 3:58:26 AM2/17/16
to accelstepper
Hi all,

I am using arduino mega 2560 with just one stepper motor and i am not satisfied with the max speed (still very slow). Is it possible to increase pwm frequency so that the max speed can be increased further?

Thanks!

Sam

gregor

unread,
Feb 17, 2016, 4:09:15 AM2/17/16
to accelstepper
what motor driver are you using?

Sam

unread,
Feb 17, 2016, 7:35:41 AM2/17/16
to accelstepper
I am using this H2MD Bipolar Stepper Motor Driver

gregor

unread,
Feb 18, 2016, 5:12:39 AM2/18/16
to accelstepper
AccelStepper does not use PWM. Setting a shorter pulse width may help (http://www.airspayce.com/mikem/arduino/AccelStepper/classAccelStepper.html#af4d3818e691dad5dc518308796ccf154).
How fast do you want to go and what is the speed you can currently achieve?

James Pistorino

unread,
May 6, 2016, 12:22:55 AM5/6/16
to accelstepper
Did you ever solve this? 

I have the same issue with the MEGA.

Thanks,
James

ahmed essam

unread,
Aug 28, 2016, 11:01:01 PM8/28/16
to accelstepper
i have the same problem did you fix it  ???? 
how i use the microseconds in my code  :
 #include <AccelStepper.h>

#define LONG_MAX 2147483647     //maximum value for (signed) long int.
int accvalue=1000;
int speedvalue=9000;
int pot=A3;
 
 
 
 // Define a stepper and the pins it will use
AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
int sw=9;
int sw1=8;
int k;
int h;

int h_last;   //last state of h
int k_last;   //last state of k

void setup()
{  
  pinMode(sw, INPUT);
  pinMode(sw1, INPUT);
  stepper.setMaxSpeed(90000);
  stepper.setAcceleration(15000);

  h_last = digitalRead(sw);
  k_last = digitalRead(sw1);
  Serial.begin(9600);
}

void loop()
  h=digitalRead(sw);
  k=digitalRead(sw1);
  
  stepper.setMaxSpeed(90000);
  
 

  if (h != h_last)
  {
    h_last = h;
    
    if(h == LOW)
    {  
      stepper.moveTo(LONG_MAX / 2);   //move in positive direction
      digitalWrite(3,HIGH);
    }    
    else
    {
      stepper.stop();       //stop the stepper
    }
  }
  
  if (k != k_last) 
  {
    k_last = k;
    
    if(k == HIGH)
    {   
      stepper.moveTo(-LONG_MAX / 2);   //move in negative direction
      digitalWrite(4,HIGH);
    }
    else
    {
      stepper.stop();       //stop the stepper
    }
  }

  stepper.run();
  
}

 

 
Reply all
Reply to author
Forward
0 new messages