Generating A Step Table

pogerttpogertt Posts: 33
edited 2012-09-25 - 21:38:58 in Propeller 1
In the Stepper Motor Program

http://obex.parallax.com/objects/682/

there is a step table for controlling the time between steps of the motor while it is accelerating.
The table provides the delay times for how long to wait before issuing the next step pulse when accelerating or decelerating the motor.
I would like to be able to generate a new table, with different acceleration rates, different final speeds, and different number of steps.

The table provided starts the first step at approximately 31.6 Steps per Second, and accelerates the motor to 1,000 steps per second in 0.5 seconds.

dat Segments long 250 ' How many segments in the Ramp table STable long 2529822,1047887,804072,677864,597210,539919,496507,462137,434049,410534 long 390471,373090,357842,344324,332231,321330,311435,302402,294113,286469 long 279393,272816,266683,260946,255564,250502,245729,241219,236949,232897 long 229047,225382,221887,218549,215358,212303,209374,206564,203863,201266 long 198765,196356,194032,191788,189621,187526,185498,183535,181633,179789 long 178000,176263,174576,172937,171343,169792,168283,166813,165381,163985 long 162625,161297,160001,158736,157501,156294,155114,153961,152833,151730 long 150650,149592,148557,147543,146549,145576,144621,143685,142767,141866 long 140982,140115,139263,138426,137605,136798,136005,135225,134459,133706 long 132965,132236,131520,130814,130120,129437,128765,128103,127451,126809 long 126176,125553,124939,124334,123738,123150,122571,121999,121436,120880 long 120332,119791,119257,118731,118211,117698,117192,116692,116199,115712 long 115230,114755,114286,113822,113364,112912,112465,112023,111586,111154 long 110728,110306,109889,109476,109069,108665,108267,107872,107482,107096 long 106714,106337,105963,105593,105227,104865,104506,104151,103800,103452 long 103108,102767,102430,102095,101765,101437,101112,100791,100472,100157 long 99844,99535,99228,98924,98623,98324,98029,97736,97445,97157 long 96872,96589,96309,96031,95755,95482,95211,94943,94676,94412 long 94150,93891,93633,93378,93124,92873,92623,92376,92131,91887 long 91646,91406,91169,90933,90699,90466,90236,90007,89780,89555 long 89331,89109,88889,88670,88453,88238,88024,87811,87601,87391 long 87183,86977,86772,86569,86367,86166,85967,85769,85573,85377 long 85184,84991,84800,84610,84421,84234,84048,83863,83679,83497 long 83315,83135,82956,82778,82602,82426,82252,82078,81906,81735 long 81565,81396,81228,81061,80895,80730,80566,80403,80241,80080 long 80000 ' Traverse Speed (80_000_000/80_000 = 1000 steps/second) [/Code] I am looking for some help as I am having difficulties understanding the acceleration formulas.[Code]


dat



Segments long 250 ' How many segments in the Ramp table
STable long 2529822,1047887,804072,677864,597210,539919,496507,462137,434049,410534
long 390471,373090,357842,344324,332231,321330,311435,302402,294113,286469
long 279393,272816,266683,260946,255564,250502,245729,241219,236949,232897
long 229047,225382,221887,218549,215358,212303,209374,206564,203863,201266
long 198765,196356,194032,191788,189621,187526,185498,183535,181633,179789
long 178000,176263,174576,172937,171343,169792,168283,166813,165381,163985
long 162625,161297,160001,158736,157501,156294,155114,153961,152833,151730
long 150650,149592,148557,147543,146549,145576,144621,143685,142767,141866
long 140982,140115,139263,138426,137605,136798,136005,135225,134459,133706
long 132965,132236,131520,130814,130120,129437,128765,128103,127451,126809
long 126176,125553,124939,124334,123738,123150,122571,121999,121436,120880
long 120332,119791,119257,118731,118211,117698,117192,116692,116199,115712
long 115230,114755,114286,113822,113364,112912,112465,112023,111586,111154
long 110728,110306,109889,109476,109069,108665,108267,107872,107482,107096
long 106714,106337,105963,105593,105227,104865,104506,104151,103800,103452
long 103108,102767,102430,102095,101765,101437,101112,100791,100472,100157
long 99844,99535,99228,98924,98623,98324,98029,97736,97445,97157
long 96872,96589,96309,96031,95755,95482,95211,94943,94676,94412
long 94150,93891,93633,93378,93124,92873,92623,92376,92131,91887
long 91646,91406,91169,90933,90699,90466,90236,90007,89780,89555
long 89331,89109,88889,88670,88453,88238,88024,87811,87601,87391
long 87183,86977,86772,86569,86367,86166,85967,85769,85573,85377
long 85184,84991,84800,84610,84421,84234,84048,83863,83679,83497
long 83315,83135,82956,82778,82602,82426,82252,82078,81906,81735
long 81565,81396,81228,81061,80895,80730,80566,80403,80241,80080
long 80000 ' Traverse Speed (80_000_000/80_000 = 1000 steps/second)


[/Code]

I am looking for some help as I am having difficulties understanding the acceleration formulas.

Comments

  • Mark_TMark_T Posts: 1,975
    edited 2012-09-22 - 05:18:52
    s = 0.5 a t^2

    Where s is distance (or angle for rotation), a is acceleration (or angular acceleration). Since steps correspond to distance you invert the formula to get times:

    t = sqrt (2 Ns / a).

    [N is the number of steps, s is the distance per step]. Then your step tables are merely differences between successive t values as N increases:


    However there's another way to determine when to step using DDS (direct digital synthesis) - you incrementally calculate s each time t increases and compare to see if a step is due. Calculating t squared incrementally only takes addition since (t+1)^2 - t^2 = 2t+1. You can use this dynamically and eliminate the need for tables and it works for different accelerations.
  • idbruceidbruce Posts: 5,851
    edited 2012-09-22 - 05:49:42
    Perhaps this may be useful information for you. One of the engineers at Applied Motion Products (http://www.applied-motion.com/), which happen to make stepper motors and stepper drives, told me that a ramping profile should either increase or decrease 3 to 5 revolutions per full revolution.

    Bruce

    EDIT: And this formula has worked well for me. If you exceed 5 revs per revolution, your motors will stall and whine, or at least mine did, but I had Applied Motion stepper motors, controlled by Gecko Drives.

    EDIT: OOOPPPSSS That was for maximum acceleration/deceleration! Your minimum acceleration/deceleration can be anything above 0.

    EDIT: In addition to my previous comments, you do not need tables to create a ramping profile. You may want to take a look at this source code to see how ramping can be achieved programatically.
    http://forums.parallax.com/showthread.php?138282-StepperDriveErz


    Novel Solutions - http://www.novelsolutionsonline.com/ - Machinery Design • - • Product Development
    "Necessity is the mother of invention." - Author unknown.

  • StefanL38StefanL38 Posts: 2,286
    edited 2012-09-22 - 10:06:13
    you could copy and paste the values into an excel-sheet. First colum just counting 1..n second columm the values of the table
    then create a xy-chart from these values then there is an option to add an aproximation-curve. you can choose from different functions linear, polynom, exponential etc.
    from this you should get a good aproximation-function to reproduce the values. Then you can start to tweak the parameters of this aprox.function to your needs

    best regards

    Stefan
    [x] <== SLAM in nail here to hook up the new screen! :lol:
  • pogerttpogertt Posts: 33
    edited 2012-09-23 - 18:52:50
    I got some help from a Math teacher, and was able to figure the solution out.

    Co is the starting seed value in the table.......2529822

    Cn=Co
  • ManAtWorkManAtWork Posts: 302
    edited 2012-09-24 - 08:15:46
    pogertt wrote: »
    there is a step table for controlling the time between steps of the motor while it is accelerating.
    The table provides the delay times for how long to wait before issuing the next step pulse when accelerating or decelerating the motor.
    I would like to be able to generate a new table, with different acceleration rates, different final speeds, and different number of steps.

    Errm, if you have a little patience... I'm currently working on a new step/dir signal generator that I plan to release as obex. It will probably overlap with the work of idbruce somehow. As a true propeller enthusiast I tend to start coding immediately when I have an idea instead of seraching the web if somthing already exists...:smile:

    It will support
    * multiple, synchronized axes (1 cog/axis), targeted for CNC applications
    * step frequency up to 4MHz (useful for servos)
    * no need to adjust pulse timing, always 50% duty cycle, guaranteed dir to step setup&hold times
    * any trajectories, (linear, circular, free shape), well, not really, I mean it doesn't calculate trajectories, you have to feed the coordinates. But at least it's not limited to linear moves from stop to stop. Speed and direction can be changed on the fly.
    * adjustable acceleration/deceleration ramps without (static) tables
  • Alex.StanfieldAlex.Stanfield Posts: 198
    edited 2012-09-25 - 18:02:50
    idbruce wrote: »
    Perhaps this may be useful information for you. One of the engineers at Applied Motion Products (<a href="http://www.applied-motion.com/" target="_blank">http://www.applied-motion.com/</a>;), which happen to make stepper motors and stepper drives, told me that a ramping profile should either increase or decrease 3 to 5 revolutions per full revolution.<br>
    <br>
    Bruce<br>
    <br>
    EDIT: And this formula has worked well for me. If you exceed 5 revs per revolution, your motors will stall and whine, or at least mine did, but I had Applied Motion stepper motors, controlled by Gecko Drives.<br>
    <br>
    EDIT: OOOPPPSSS That was for maximum acceleration/deceleration! Your minimum acceleration/deceleration can be anything above 0.<br>
    <br>
    EDIT: In addition to my previous comments, you do not need tables to create a ramping profile. You may want to take a look at this source code to see how ramping can be achieved programatically.<br>
    <a href="http://forums.parallax.com/showthread.php?138282-StepperDriveErz" target="_blank">http://forums.parallax.com/showthread.php?138282-StepperDriveErz</a>;

    I don't quite follow the logic behind this limit of 3-5 revs/rev. Are those in RPM? That would give a max acceleration of +16pulses/sec^2 on a standard 200 steps/rev. Did the engineer give any references to study?

    According to theory, the amount of maximum acceleration/deceleration is in fact a matter of the "remaining" torque you have available in the motor for your given system (Driver+motor+load), i.e: At any given speed the driver+motor is able to create X amount of torque, some is used to bear friction losses. What is left is the only force you can use to change your loads speed and what you really need is a function of inertia and desired acceleration.

    See the theory here Formulas for stepper motor calculation.pdf

    I plan to release a PASM driver (steps/dir) which does ramping on a step by step basis with which I can drive more than 600 steps/sec^2 (on my system, YMMV)
    Precise ramping is the key to success so you don't create "bumps" in speed which would require a much higher torque to effectively force the load to a sudden speed change (if your system cannot handle it then it loses synch with the steps)

    Alex
  • idbruceidbruce Posts: 5,851
    edited 2012-09-25 - 18:53:39
    I don't quite follow the logic behind this limit of 3-5 revs/rev. Are those in RPM? That would give a max acceleration of +16pulses/sec^2 on a standard 200 steps/rev. Did the engineer give any references to study?

    No, it is not RPM, but pulses. For example, using a step angle of 1.8:
    • 5 Revs per revolution
      • Maximum ramp increase would be increments of 1000 full steps, but in my case, since I was using Gecko G251X microstepping drives, with a resolution of 1/10, that equated to 10,000 microsteps.
    • 4 Revs per revolution
      • Maximum ramp increase would be increments of 800 full steps, but in my case, since I was using Gecko G251X microstepping drives, with a resolution of 1/10, that equated to 8,000 microsteps.
    • 3 Revs per revolution
      • Maximum ramp increase would be increments of 600 full steps, but in my case, since I was using Gecko G251X microstepping drives, with a resolution of 1/10, that equated to 6,000 microsteps.
    No, he did not give me any references, since I was just looking for a quick answer on obtaining maximum speed with no load. Actually, I believe the maximum speed with no load and with the combination of the G251X Gecko drive and the HT23-400 Applied Motion motors was 4.5 Revs per revolution before I started losing steps. Of course, the maximum speed that can be obtained before steps are lost will be contingent upon the load.

    Bruce

    EDIT: OOOPPPS that is wrong. Those steps would be divided by 200 full steps or 2000 microsteps. So:
    • 5 revs per revolution
      • 10,000 microsteps / 2,000 microsteps = 5 microsteps added per microstep until maximum speed is obtained.
    And so on....

    EDIT: And of course these steps directly coincide with the pauses between pulses.


    Novel Solutions - http://www.novelsolutionsonline.com/ - Machinery Design • - • Product Development
    "Necessity is the mother of invention." - Author unknown.

  • Alex.StanfieldAlex.Stanfield Posts: 198
    edited 2012-09-25 - 19:58:42
    idbruce wrote: »
    No, it is not RPM, but pulses. For example, using a step angle of 1.8:
    • 5 Revs per revolution
      • Maximum ramp increase would be increments of 1000 full steps, but in my case, since I was using Gecko G251X microstepping drives, with a resolution of 1/10, that equated to 10,000 microsteps.
    ....

    EDIT: OOOPPPS that is wrong. Those steps would be divided by 200 full steps or 2000 microsteps. So:
    • 5 revs per revolution
      • 10,000 microsteps / 2,000 microsteps = 5 microsteps added per step
    And so on....

    Bruce, I believe there's a time unit missing in the equations. Speed is measured in angle/time (e.g: steps/sec, RPM, etc). But acceleration is measured in angle/Sec^2 (or Speed/time), so a 5x speed increase (5 microsteps per microstep) needs the time interval over which such an increase occurs.

    I have achieved no load accelerations of about 1000 fullsteps/sec^2 (i.e: the speed=frequency increments 1000steps each second in a linear acceleration ramp up to the speed limit of my PSU+driver+motor combination (about 22000 microsteps/sec @ 16microsteps/fullstep ~= 412RPM))

    Alex
  • idbruceidbruce Posts: 5,851
    edited 2012-09-25 - 21:38:58
    With the method I am talking about and without a load, I can achieve over 20 revs per second, which equates to at least 1200 RPM.

    Ramping is achieved by increasing or decreasing the pauses between pulses which coincides with the increment or decrement of the microsteps, and further directly affects the number of pulses in a given period of time.

    Study the drivers above, learn how to use them, and you can achieve very nice speeds and ramping profiles.

    EDIT: However it is worth noting that I am pumping 48V through a 50V drive.


    Novel Solutions - http://www.novelsolutionsonline.com/ - Machinery Design • - • Product Development
    "Necessity is the mother of invention." - Author unknown.

  • Hello,

    Manatwork, have you completed your step/dir signal generator?
    I couldn't find a step/dir in OBEX.
    Is it under a different name or posted in the forum?
    Errm, if you have a little patience... I'm currently working on a new step/dir signal generator that I plan to release as obex

    Thank You
  • Here's the product but I don't think the source was forthcoming.
    Failure is not an option...it's bundled with the software.
  • Thank You

    Mickster
  • To: Manatwork

    I have posted questions and PPM you directly with no replies. If this is a sore spot for you just say so.

    I was asking if you ever finish that code (Step/Dir signal generator for CNC) or was it replaced with something else?
    Was there anything more than the partial demo posted in 2012?
    I didn't see you(Manatwork) on the obex. Did you use your real name?
    Did you post it on the forum?

    Thank You
  • idbruce posted:
    In addition to my previous comments, you do not need tables to create a ramping profile. You may want to take a look at this source code to see how ramping can be achieved programatically.


    Here is the link i found (03/05/2019) to the post.
    https://forums.parallax.com/discussion/123946/eagle-drd-file-parsing-engine

    The file "StepperDriveErz.zip" is in the third post down.
  • To: Manatwork
    I have posted questions and PPM you directly with no replies. If this is a sore spot for you just say so.

    Ooops, I haven't seen them until today. I don't read every discussion in the forum and I also haven't found a way to get email notifications if there is a reply to one of my posts.
    I've replied to the other topic: http://forums.parallax.com/discussion/142705/step-dir-signal-generator-for-cnc
Sign In or Register to comment.