stepper.setMaxSpeed

1,838 views
Skip to first unread message

Student Center

unread,
Jan 15, 2017, 4:51:56 PM1/15/17
to accelstepper

Hello,
Hello my friends

I have been working with my micro stepping 25600 per revolution and i want to rotate at 60 RPM ,SO I CALCULATE 

60 RPM * 25600 SPR = 1536000 steps every minute, or 25600 steps per second (ONE REVOLUTION PER SECOND) 

im still using the AccelStepper.h library but need to know the speed unit for this library im already reed this page but not found clear answer http://www.airspayce.com/mikem/arduino/AccelStepper/classAccelStepper.html

since my code setup is 
stepper.setMaxSpeed(3000);
    stepper.setAcceleration(3000);

and give me very slow speed it's give me 1 revolution per about 15 second and tried to change increase or decreed the max speed value but not working 


also i have reed the each pin in arduino have specific pulse value for each pin 
http://playground.arduino.cc/Code/PwmFrequency
https://www.arduino.cc/en/Tutorial/SecretsOfArduinoPWM
http://playground.arduino.cc/Main/TimerPWMCheatsheet


and the data sheet for my motor has related info with these pulse value specifications 
like 

2.6+-20%mH/PHASE  THE MAX SPEED FOR THE MOTOR IS 700/RPM

IS THIS RELATED WITH CONTROLLING THE SPEED .


Really i can not mange these information and need to know how i can calculate the values witch matched with my motor and do the best code 

may any one help me to assigned the relative speed for my motor since i want to rotate 60 rpm ?
i have attached the information for my Processor
 Inline image
 please tell me how i can appropriate calculations for the speed 

also i need to combining these two steps in a simple one code form any help please 
 for (int x = 0; x < 2; x++)
{
 s.move(25600);s.runToPosition();delay(3000);
}  

for (int x = 0; x < 2; x++)
{
 s.move(-25600);s.runToPosition();delay(3000); 
}

Finally Thank you so much and please HELP me 

Thank you  

Processor.JPG

gregor

unread,
Jan 15, 2017, 5:05:16 PM1/15/17
to accelstepper
AccelStepper's speed unit is steps per second.
AccelStepper does not use PWM. 
Maximum speed depends on your Arduino. You'll probably need a Due to achieve the speed you want (see: https://groups.google.com/forum/#!msg/accelstepper/IpwyCOzZNY4/hmKfsk5KBAAJ )

Student Center

unread,
Jan 15, 2017, 5:49:33 PM1/15/17
to accelstepper
Thank you Mr.gregor 

please may tell me what is th subtitle speed(  the calculation method )for arduino uno since i dont plane to change my Uno now 

also advice if any simple for to combined this two steps in just one function since there are many common factor between the two steps code
 for (int x = 0; x < 2; x++)
{
 s.move(25600);s.runToPosition();delay(3000);
}  

for (int x = 0; x < 2; x++)
{
 s.move(-25600);s.runToPosition();delay(3000); 
}

Thank you 

gregor

unread,
Jan 16, 2017, 3:15:27 AM1/16/17
to accelstepper
speed = DESIRED_RPM * STEPS_PER_REV / 60
1 revolution per 15 seconds equals ~1700 steps / second, which is expected for an Arduino Uno. If you can do without acceleration, using setSpeed() and runSpeed() will yield a maximum speed of about 4000 steps / second, for higher speeds you will have to use a faster microcontroller (e.g. a Due)

you may be able to simplify your code like this:
//define an array of positions
uint32_t positions
= [25600, 51200, 25600, 0];
int length = sizeof(positions)/sizeof(*positions);  //length of positions array

for (int i = 0; i < length; i++) {
    s
.move(positions[i]);
    s
.runToPosition();
    delay
(3000);
}

Student Center

unread,
Jan 16, 2017, 8:39:05 PM1/16/17
to accelstepper
Sorry my friend there is "expected identifier before numeric constant"
expected identifier before numeric constant.JPG

gregor christandl

unread,
Jan 17, 2017, 1:35:14 AM1/17/17
to accelstepper

this should be correct:
uint32_t positions[] = {25600, 51200, 25600, 0};


--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Student Center

unread,
Jan 20, 2017, 4:45:44 PM1/20/17
to accelstepper
Thank you very much Mr.gregor 
its working very good ,and please may be you recommend good reference to learn and make more function like this ,really its very very excellent function 
also really i need to control the stepper motor using frequency and pluses how i exactly know the best electric configuration for my stepper 

Thank you again 
Reply all
Reply to author
Forward
0 new messages