I know this might sound dump, but I will ask anyway. If I have a motor which has an acceleration rate of 50rps/sec ^^, does this mean that once I initiate the motor to start turning, that when 1 second is over, it should be turning at a rate of 50rps? If so, then how do I control this acceleration? I have tried to have two timer circuits A and B such that A controls the current RPS of the motor while B is 0.001 sec updates to readjust the A timer for the acceleration to occur. The problem is that I have not had much success with this on a stepper motor. using this, it turns really slow for awhile and then ramps right up to the full speed. Is there a better way of doing this? Thanks, James
Acceleration Question
Started by ●October 9, 2004
Reply by ●October 9, 20042004-10-09
James Williams wrote:> I know this might sound dump, but I will ask anyway. If I have a motor > which has an acceleration rate of 50rps/sec ^^, does this mean that once I > initiate the motor to start turning, that when 1 second is over, it should > be turning at a rate of 50rps? > > If so, then how do I control this acceleration? I have tried to have two > timer circuits A and B such that A controls the current RPS of the motor > while B is 0.001 sec updates to readjust the A timer for the acceleration to > occur. The problem is that I have not had much success with this on a > stepper motor. using this, it turns really slow for awhile and then ramps > right up to the full speed. Is there a better way of doing this? > > > Thanks, > > > > James > >It depends on your motor. A stepper motor either follows the pulses that you give it or everything goes to hell. So an acceleration specification on a stepper is the acceleration that the stepper is _capable_ of, not the amount that it _will_ accelerate automatically. Furthermore, the acceleration specification on a stepper is derived from the torque it generates and the rotational inertia of its armature. If you attach it to something with significantly higher inertia then it won't be able to accelerate nearly as fast. Your two timer idea sounds solid -- this is how I've controlled steppers in the past, and within the limitations of a stepper it works pretty well. Given that the general technique is correct, are you sure you're implementing it correctly? It sounds like you may be changing the period of your pulse timer by constant steps, when you want to be changing the _frequency_ by constant steps -- changing the pulse period would give a hyperbolic velocity profile, which sounds like what you have. Just a note: I vastly prefer a DC (brushed or brushless) for tasks that require "high performance". Unless you have an encoder that you can use for commutation, a stepper can be a nightmare to use above it's starting speed. Even if you get it working right in the lab, when you expose your equipment to real world aging, vibration, temperature and other effects your stepper can fail in ways that are hard to fix and infuriating to customers. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●October 9, 20042004-10-09
James Williams wrote:> I know this might sound dump, but I will ask anyway. If I have a motor > which has an acceleration rate of 50rps/sec ^^, does this mean that once I > initiate the motor to start turning, that when 1 second is over, it should > be turning at a rate of 50rps? > > If so, then how do I control this acceleration? I have tried to have two > timer circuits A and B such that A controls the current RPS of the motor > while B is 0.001 sec updates to readjust the A timer for the acceleration to > occur. The problem is that I have not had much success with this on a > stepper motor. using this, it turns really slow for awhile and then ramps > right up to the full speed. Is there a better way of doing this? > > > Thanks, > > > > JamesMotor control, despite recent threads, isn't really this group's charter. I guess from your message that you're using a stepper motor, but I won't put much thought into the answer you want until I'm fairly confident that I know what you what to do to what, with what, and to whom, as the limerick goes. Briefly, you control acceleration by controlling the speed to follow the speed contour you want, assuming that the motor is capable of it. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●October 9, 20042004-10-09
Jerry Avins wrote:> > Motor control, despite recent threads, isn't really this group's > charter. I guess from your message that you're using a stepper motor, > but I won't put much thought into the answer you want until I'm fairly > confident that I know what you what to do to what, with what, and to > whom, as the limerick goes. > > Briefly, you control acceleration by controlling the speed to follow the > speed contour you want, assuming that the motor is capable of it. > > JerryAt least what passes for a charter (see http://www.dspguru.com/comp.dsp/culture.htm). But sci.engr.control will get you _lots_ of help -- most of the traffic is by folks who work on great big dirty things and use PLCs to do it, but there's a fair number of folks who work on itty bitty clean things with embedded processors (myself included). -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●October 9, 20042004-10-09
The way that I am determining the new speed is as follows. First, set update timer to 1ms intervals. - take finaly speed count divide into 1ms. I use this as the update speed per 1ms. on each 1ms timer interrupt, add to the new speed calcuation. When the current speed timer times out, I move the new speed timer value into the speed timer registers. Is this the right way I should be doing it? Or should I immediately update the speed timer the moment that a new speed is calculated? "Tim Wescott" <tim@wescottnospamdesign.com> wrote in message news:10mgtlaevq5abe6@corp.supernews.com...> James Williams wrote: > > > I know this might sound dump, but I will ask anyway. If I have a motor > > which has an acceleration rate of 50rps/sec ^^, does this mean that onceI> > initiate the motor to start turning, that when 1 second is over, itshould> > be turning at a rate of 50rps? > > > > If so, then how do I control this acceleration? I have tried to havetwo> > timer circuits A and B such that A controls the current RPS of the motor > > while B is 0.001 sec updates to readjust the A timer for theacceleration to> > occur. The problem is that I have not had much success with this on a > > stepper motor. using this, it turns really slow for awhile and thenramps> > right up to the full speed. Is there a better way of doing this? > > > > > > Thanks, > > > > > > > > James > > > > > It depends on your motor. A stepper motor either follows the pulses > that you give it or everything goes to hell. So an acceleration > specification on a stepper is the acceleration that the stepper is > _capable_ of, not the amount that it _will_ accelerate automatically. > Furthermore, the acceleration specification on a stepper is derived from > the torque it generates and the rotational inertia of its armature. If > you attach it to something with significantly higher inertia then it > won't be able to accelerate nearly as fast. > > Your two timer idea sounds solid -- this is how I've controlled steppers > in the past, and within the limitations of a stepper it works pretty > well. Given that the general technique is correct, are you sure you're > implementing it correctly? It sounds like you may be changing the > period of your pulse timer by constant steps, when you want to be > changing the _frequency_ by constant steps -- changing the pulse period > would give a hyperbolic velocity profile, which sounds like what you have. > > Just a note: I vastly prefer a DC (brushed or brushless) for tasks that > require "high performance". Unless you have an encoder that you can use > for commutation, a stepper can be a nightmare to use above it's starting > speed. Even if you get it working right in the lab, when you expose > your equipment to real world aging, vibration, temperature and other > effects your stepper can fail in ways that are hard to fix and > infuriating to customers. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com
Reply by ●October 9, 20042004-10-09
James Williams wrote:> The way that I am determining the new speed is as follows. > First, set update timer to 1ms intervals. > - take finaly speed count divide into 1ms. I use this as the update speed > per 1ms. > on each 1ms timer interrupt, add to the new speed calcuation. When the > current speed timer times out, I move the new speed timer value into the > speed timer registers. > > Is this the right way I should be doing it? Or should I immediately update > the speed timer the moment that a new speed is calculated?I don't see a reason to do it that way at all. Your motor moves in steps, but the speed curve needn't be a staircase. If you want the motor to accelerate, each pulse should come after an interval a little shorter than the one just before. How much shorter depends on the rate of acceleration you want. If the motor ramp you want is always the same ans there aren't too many steps involved, you can index a pointer through a look-up table. Sometimes, ramping down is done by stepping backward through the LUT by twos. Separate the problem into two parts: how to drive the motor so it does what you want, and only when you decide that, what code you need to accomplish that. Picking a procedure whose action you don't really grok and hoping it will make the motor behave as you want takes too much trial and error. Adding to the job, when you finally get what you want, you still have to figure out exactly what's happening in case you need to do some tweaking. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●October 10, 20042004-10-10
I appologise, but for some reason I am missing your point. Let me try to understand this from a math approach. I have a motor for which I want to accelerate from 0 to final speed at a rate of 50rps/s squared. For my stepper motor, it takes 3200 steps to make one revolution. My PIC is operating at 40M. Assuming that I what to have a final speed of 50RPS Timer 0 is the step control timer which commands each step which will occur. Timer 1 is the acceleration interveral timer used to change the Timer 0 frequency during acceleration. The time interrupt for timer 1 is set at 1ms. With a 1ms update I would need to change the frequency of Timer 0 by (50*3200)/1000 = 160 Hz. Or the timer valve intrement would be (65535 - (FOsc/4)/(50*3200))/1000=65.4725 or 65. So, every time Timer 1 times out (1ms), I add (65535-(FOsc/4)/(50*3200))/1000 or 65. This would occur until final speed has been achieved. In this case 50 RPS, which should occurr in the 1 sec. Does this make sense. Also my acceleration rate of 50 is configuratable, so this has to be calculated when it changes. Now, it this case, it would take about 16 ms before Timer0 will begin timing out between each Timer1's 1ms interval. Which is ok. "Jerry Avins" <jya@ieee.org> wrote in message news:2srkbfF1otk56U1@uni-berlin.de...> James Williams wrote: > > > The way that I am determining the new speed is as follows. > > First, set update timer to 1ms intervals. > > - take finaly speed count divide into 1ms. I use this as the updatespeed> > per 1ms. > > on each 1ms timer interrupt, add to the new speed calcuation. Whenthe> > current speed timer times out, I move the new speed timer value into the > > speed timer registers. > > > > Is this the right way I should be doing it? Or should I immediatelyupdate> > the speed timer the moment that a new speed is calculated? > > I don't see a reason to do it that way at all. Your motor moves in > steps, but the speed curve needn't be a staircase. If you want the motor > to accelerate, each pulse should come after an interval a little shorter > than the one just before. How much shorter depends on the rate of > acceleration you want. If the motor ramp you want is always the same ans > there aren't too many steps involved, you can index a pointer through a > look-up table. Sometimes, ramping down is done by stepping backward > through the LUT by twos. > > Separate the problem into two parts: how to drive the motor so it does > what you want, and only when you decide that, what code you need to > accomplish that. Picking a procedure whose action you don't really grok > and hoping it will make the motor behave as you want takes too much > trial and error. Adding to the job, when you finally get what you want, > you still have to figure out exactly what's happening in case you need > to do some tweaking. > > Jerry > -- > Engineering is the art of making what you want from things you can get. > �����������������������������������������������������������������������
Reply by ●October 11, 20042004-10-11
James Williams wrote:> I appologise, but for some reason I am missing your point. Let me try to > understand this from a math approach. > > I have a motor for which I want to accelerate from 0 to final speed at a > rate of 50rps/s squared. > For my stepper motor, it takes 3200 steps to make one revolution. My PIC is > operating at 40M. > > Assuming that I what to have a final speed of 50RPS > Timer 0 is the step control timer which commands each step which will occur. > Timer 1 is the acceleration interveral timer used to change the Timer 0 > frequency during acceleration. > The time interrupt for timer 1 is set at 1ms. > > With a 1ms update I would need to change the frequency of Timer 0 by > (50*3200)/1000 = 160 Hz. Or the timer valve intrement would be (65535 -value?> (FOsc/4)/(50*3200))/1000=65.4725 or 65. > > So, every time Timer 1 times out (1ms), I add > (65535-(FOsc/4)/(50*3200))/1000 or 65. This would occur until final speed > has been achieved. In this case 50 RPS, which should occurr in the 1 sec. > > Does this make sense. Also my acceleration rate of 50 is configuratable, so > this has to be calculated when it changes. Now, it this case, it would take > about 16 ms before Timer0 will begin timing out between each Timer1's 1ms > interval. Which is ok.The explainee incurs no need to apologize. Any communication shortcoming weighs on the explainer. I think a concrete example is best, an I need a few preliminary numbers. The motor takes 3,200 steps per revolution, and its final speed is to be 50 revolutions -- 160,000 pulses -- per second. I assume you want the acceleration to be uniform during the speed ramp. As I see your procedure, you output a steady frequency for a while, then jump to a higher one. I suppose that's OK, but I prefer a steady ramp. Second, you change the timer increment by a fixed amount. Unless it's a very special "timer", such as a BRM, doing that yields a linear ramp of the period, which is a hyperbola (1/x) in frequency. Or maybe I just don't understand. Whatever the characteristics of the motor, there must be a maximum time it requires between the first and second pulses. That sets a frequency at which it will start reliably (the reciprocal of that time, of course). Ramping is often starting from that frequency, so the long tail of the hyperbola is truncated. During a linear ramp starting at standstill and ending one second later at 50 rps, the motor will have made 25 turns and been fed 80,000 pulses. With a linear speed ramp, the interval between pulses decreases steadily but not linearly as the one-second mark is reached. The zeroth pulse will be followed by an infinite delay; the motor actually moves on the first pulse. For a linear frequency ramp, the area under the ramp divided by the number of pulses is the area that must exist during one pulse. In our case, the wight triangle has a base of one second and a height of 160,000 pulses per second, and an area of 80,000 pulses. Divide the triangle into smaller similar ones with areas of 1, 2, 3, ... 80,000, all from time zero. The abscissas of each of the ordinates represent the appropriate times to put out a pulse. I leave it for you to work out the decrements from one pulse to the next. It's past midnight, nut I might tackle it tomorrow. Should you elect to use a hyperbolic ramp starting at some low speed, you will need a slower initial acceleration in order not to exceed the maximum rate. Even with the "jump start" scheme, linear acceleration reaches the final rate in less time. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●October 11, 20042004-10-11
Jerry Avins wrote:> James Williams wrote: > >> I appologise, but for some reason I am missing your point. Let me try to >> understand this from a math approach. >> >> I have a motor for which I want to accelerate from 0 to final speed at a >> rate of 50rps/s squared. >> For my stepper motor, it takes 3200 steps to make one revolution. My >> PIC is >> operating at 40M. >> >> Assuming that I what to have a final speed of 50RPS >> Timer 0 is the step control timer which commands each step which will >> occur. >> Timer 1 is the acceleration interveral timer used to change the Timer 0 >> frequency during acceleration. >> The time interrupt for timer 1 is set at 1ms. >> >> With a 1ms update I would need to change the frequency of Timer 0 by >> (50*3200)/1000 = 160 Hz. Or the timer valve intrement would be (65535 - > > value? > >> (FOsc/4)/(50*3200))/1000=65.4725 or 65. >> >> So, every time Timer 1 times out (1ms), I add >> (65535-(FOsc/4)/(50*3200))/1000 or 65. This would occur until final >> speed >> has been achieved. In this case 50 RPS, which should occurr in the 1 >> sec. >> >> Does this make sense. Also my acceleration rate of 50 is >> configuratable, so >> this has to be calculated when it changes. Now, it this case, it >> would take >> about 16 ms before Timer0 will begin timing out between each Timer1's 1ms >> interval. Which is ok. > > > The explainee incurs no need to apologize. Any communication shortcoming > weighs on the explainer. I think a concrete example is best, an I need a > few preliminary numbers. The motor takes 3,200 steps per revolution, and > its final speed is to be 50 revolutions -- 160,000 pulses -- per second. > I assume you want the acceleration to be uniform during the speed ramp. > > As I see your procedure, you output a steady frequency for a while, then > jump to a higher one. I suppose that's OK, but I prefer a steady ramp. > Second, you change the timer increment by a fixed amount. Unless it's a > very special "timer", such as a BRM, doing that yields a linear ramp of > the period, which is a hyperbola (1/x) in frequency. Or maybe I just > don't understand. Whatever the characteristics of the motor, there must > be a maximum time it requires between the first and second pulses. That > sets a frequency at which it will start reliably (the reciprocal of that > time, of course). Ramping is often starting from that frequency, so the > long tail of the hyperbola is truncated. > > During a linear ramp starting at standstill and ending one second later > at 50 rps, the motor will have made 25 turns and been fed 80,000 pulses. > With a linear speed ramp, the interval between pulses decreases steadily > but not linearly as the one-second mark is reached. The zeroth pulse > will be followed by an infinite delay; the motor actually moves on the > first pulse. For a linear frequency ramp, the area under the ramp > divided by the number of pulses is the area that must exist during one > pulse. In our case, the wight triangle has a base of one second and aright> height of 160,000 pulses per second, and an area of 80,000 pulses. > Divide the triangle into smaller similar ones with areas of 1, 2, 3, ... > 80,000, all from time zero. The abscissas of each of the ordinates > represent the appropriate times to put out a pulse. I leave it for you > to work out the decrements from one pulse to the next. It's past > midnight, nut I might tackle it tomorrow.but> > Should you elect to use a hyperbolic ramp starting at some low speed, > you will need a slower initial acceleration in order not to exceed the > maximum rate. Even with the "jump start" scheme, linear acceleration > reaches the final rate in less time. > > Jerry-- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●October 11, 20042004-10-11
You are correct, this is exactly what I have been experiencing, a hyperbolic ramping. But I fail to see why I am getting this, if I add a constant frequency internval of 160 Hz to the stepping timer on every 1ms interval of the second timer. I do realize that initially it will start very slow, but only for 16 ms. After that, the stepper timer is pulse at a rate that is faster than time 1 ms updates, which add only 160 Hz to the step frequency at that time. I have in the past started the step frequency at a pre rate. But I still get the hyperbolic problem at the top end of the acceleration. Is there a better method to get a more constant rate of acceleration. Maybe with just using the one timer only. By the way, the 65535 that I used before is because I am working with a 16 bit timer. So, the 65535 is what divides my FOsc frequency, in this case 10MHz. So 1 bit = about 153 Hz steps. I think may I am doing this part wrong. "Jerry Avins" <jya@ieee.org> wrote in message news:416A0D3A.9060507@ieee.org...> James Williams wrote: > > > I appologise, but for some reason I am missing your point. Let me tryto> > understand this from a math approach. > > > > I have a motor for which I want to accelerate from 0 to final speed at a > > rate of 50rps/s squared. > > For my stepper motor, it takes 3200 steps to make one revolution. MyPIC is> > operating at 40M. > > > > Assuming that I what to have a final speed of 50RPS > > Timer 0 is the step control timer which commands each step which willoccur.> > Timer 1 is the acceleration interveral timer used to change the Timer 0 > > frequency during acceleration. > > The time interrupt for timer 1 is set at 1ms. > > > > With a 1ms update I would need to change the frequency of Timer 0 by > > (50*3200)/1000 = 160 Hz. Or the timer valve intrement would be (65535 - > value? > > (FOsc/4)/(50*3200))/1000=65.4725 or 65. > > > > So, every time Timer 1 times out (1ms), I add > > (65535-(FOsc/4)/(50*3200))/1000 or 65. This would occur until finalspeed> > has been achieved. In this case 50 RPS, which should occurr in the 1sec.> > > > Does this make sense. Also my acceleration rate of 50 isconfiguratable, so> > this has to be calculated when it changes. Now, it this case, it wouldtake> > about 16 ms before Timer0 will begin timing out between each Timer1's1ms> > interval. Which is ok. > > The explainee incurs no need to apologize. Any communication shortcoming > weighs on the explainer. I think a concrete example is best, an I need a > few preliminary numbers. The motor takes 3,200 steps per revolution, and > its final speed is to be 50 revolutions -- 160,000 pulses -- per second. > I assume you want the acceleration to be uniform during the speed ramp. > > As I see your procedure, you output a steady frequency for a while, then > jump to a higher one. I suppose that's OK, but I prefer a steady ramp. > Second, you change the timer increment by a fixed amount. Unless it's a > very special "timer", such as a BRM, doing that yields a linear ramp of > the period, which is a hyperbola (1/x) in frequency. Or maybe I just > don't understand. Whatever the characteristics of the motor, there must > be a maximum time it requires between the first and second pulses. That > sets a frequency at which it will start reliably (the reciprocal of that > time, of course). Ramping is often starting from that frequency, so the > long tail of the hyperbola is truncated. > > During a linear ramp starting at standstill and ending one second later > at 50 rps, the motor will have made 25 turns and been fed 80,000 pulses. > With a linear speed ramp, the interval between pulses decreases steadily > but not linearly as the one-second mark is reached. The zeroth pulse > will be followed by an infinite delay; the motor actually moves on the > first pulse. For a linear frequency ramp, the area under the ramp > divided by the number of pulses is the area that must exist during one > pulse. In our case, the wight triangle has a base of one second and a > height of 160,000 pulses per second, and an area of 80,000 pulses. > Divide the triangle into smaller similar ones with areas of 1, 2, 3, ... > 80,000, all from time zero. The abscissas of each of the ordinates > represent the appropriate times to put out a pulse. I leave it for you > to work out the decrements from one pulse to the next. It's past > midnight, nut I might tackle it tomorrow. > > Should you elect to use a hyperbolic ramp starting at some low speed, > you will need a slower initial acceleration in order not to exceed the > maximum rate. Even with the "jump start" scheme, linear acceleration > reaches the final rate in less time. > > Jerry > -- > Engineering is the art of making what you want from things you can get. > �����������������������������������������������������������������������






