# Calculating motor torque required

Posted by MeltManBob
 Calculating motor torque required March 26, 2014 11:53PM Registered: 8 years ago Posts: 20
Hey guys I'm still fairly new here but I've spent quite a bit of time doing all sorts of research. One of these areas is choosing the stepper motors and even though it is not the most efficient or effective way to settle on a motor I would like to understand how to actually calculate what kind of torque I would need. For now I'm trying to get a basic understanding of what is needed without factoring every little detail and instead making some estimations to compesate for some of the smaller details.

Most places you can buy motors from give you the resistance, inductance, current rating, step angle or steps per revolution and the holding torque. Some of the math I have already done may seem somewhat involved but here is what I have so far.

I'm estimating a moving mass of around 1kg, pulses per second for Smoothieboard is up to 200khz I think, desired max speed of around 150mm/s, not sure on max acceleration I'm assuming more capability is better. On one website selling motors I saw they had the holding torque rating as 25% more than the 'rated torque.' Not sure if I should derate holding torque for motors with non-specified 'rated torque' down to match.

First I take the inductance and divide it by the resistance to find the motor's time constant. Then I can plug that into the equation 1-(1/e^(t/tao)) where tao is the time constant and 't' is how long electricity is allowed to flow into the motor (pulse time). Next I take the supply voltage and divide it by the motors resistance to find the current that would flow through the motor if left on long enough. This current is multiplied by the percentage found from the current equation to make sure it's not exceeding the current rating of the motor. The percentage from the current equation is also multiplied against the holding torque rating of the motor to find it's maximum torque produced based on the pulse time and input voltage.

Next I would need to convert that torque based on how large of a pulley I have on the motor since I probably won't have a 1cm radius pulley which tells me how much torque is being produced at the perimeter of the pulley. Then I need to figure out the distance moved on the pulley for one step. If I know the torque produced by the motor at the pulley then divide by the step distance and by the mass of the load I can solve for the acceleration.

Also the way I understand it, speed is based only on pulses per second, steps per revolution and pulley diameter. Anyway please let me know if I'm missing something.
 Re: Calculating motor torque required March 27, 2014 05:40AM Registered: 12 years ago Posts: 7,616
That's a weak field. People simply try and error. Even basic maths is too much for most RepRappers.

If you want to do it yourself:
```F = m * a
Force = mass * acceleration```

Having the required force you can look at your gearing and derive the required torque from it.

 Generation 7 Electronics Teacup Firmware RepRap DIY
 Re: Calculating motor torque required March 27, 2014 06:23AM Registered: 8 years ago Posts: 20
I'm just wanting to know if there are any errors in the way I would be calculating it such as how I arrived at my actual torque based on certain variables and then how I applied it to a load and distance to find the acceleration. I'm ignoring friction and just over compensating with a higher load value.
 Re: Calculating motor torque required March 27, 2014 08:35AM Registered: 12 years ago Posts: 1,352
Not even manufacturers make torque numbers like that, i think what they give is mostly tested empirically instead. But methodology can differ, some manufacturers will say torque graph is from constant current (like driving the motors with resistors e.g. not our case) or some manufacturers will give a voltage and freq (e.g. which closer resembles chopping which is our case). First method would ofc give a sort of inflated torque number because current never grows or falls - hard to say, but that is sort of a marketing hint perhaps. So one conclusion, those numbers are the kind which have to be interpreted only being aware of the method used to display them. Therefore sometimes should not even compare those numbers between different manufactures which used different methods to give those numbers.

Now about the methodology am not sure i understand what you mean so i will rather start over. A voltage falls across inductor and current grows in inductor, reaching the I(trip) in t(trip) time. When current reaches I(trip), the voltage shuts down then afterwards at some point cycle starts over. One conclusion, t(trip) is not known, its not always a fixed duty cycle because it mostly depends on I(trip) being reached. And I(trip) is a maximum, a "peak", where the current "trips" or gets interrupted. But to get something that relates to power we need an time average current which would be proportional to average flux. Such average is not easy to make because it depends on a ton of things. To start, just because we know the max, does not mean we know the average. Because we dont know how and in how much time it reached that peak. You can find out the t(trip) out with e^(-t/tau) formula applied to current growth, particular for variables of L and R, voltage and I(trip). And this has multiple cases, e.g. when the motor is able to reach I(trip) which is what is should be like, then frequency is to be deducted as a result. When it does not have time to reach I(trip) like in the case of 12v motor with 30ohm coil and setting I(trip) to 1A which obviously cannot be ever reached, that will probably fall back to driver freq, and have to fall back to max ohms law which is 12/30=0.4a, but this is more of a corner case. Sort of speaking the current can grow enough to be chopped, or may not grow fast enough (or may not grow at all) to reach the chopping point, so it may not even get chopped. So we have to break down cases and solve this part. Anyway, assuming the rise part is done (current growth, which corresponds to voltage on), that is only half of story, because the current cannot grow all the time, it needs time to decrease, to fall down, e.g. to "decay". And this part is bit more opaque, because of synchronous rectification or external diodes or etc. And the decay mode (fast,slow,mixed) and offtime approach depends on driver, and perhaps has settings for it or not, but even if it has a setting it would be an analogue one and hence bit harder to model. The offtime also differ, there are drivers with fixed offtime (~allegro), other with variable offtime, and finally some with adaptive and "random" offtime (see trinamic datasheets). And in cases like digital stepper drivers and some which employ dsp and stuff like that, schematics are not open, programming neither, so largely datasheets are opaque with very few clues for fall time part. So about the second part of the current behaviour we can generally say it should be lower than the rise time, and sometimes we know and set the offtime, but otherwise i would say this part is largely unknown. Just in the reverse from rise time case, in fall time even in the peculiar case where we know the exact offtime, does not mean we know the average either: again, it could have current only in its first part, or it could have current till the end even have some after ending. So we dont know how this contribute to average. Bottom line, we can model the rise time part but only for specific terms, like specific motor, voltage, driver settings of I(peak) and so on. The fall part depends on first part and also more on driver design choice for this. In other words, from the above, we do not really have a good clue about an universal way to average current, its not that easy, too many variables have to be set in place, too many different driver settings and different approaches of the fall time part. My opinion ofc.

In the time being, easy fix to cover all the unknowns above, is the pot on driver, which is specifically meant to help with all this: set the current to a setting that works for the hardware, and be efficient to this, e.g. avoid setting too big currents which would not be otherwise needed, because extra current would just grow the consumption without any additional benefit (imo). This works as decreasing the current by half produces a power reduction to 1/4. Just like an observation the pot works on the peak not the average, but that is good enough anyway and that is the better control point.

Now what i find interesting for the rise time part, if you compute that for 3-4 reprap motors and 12v supply, you would get a rise time for say 0.7A setting, and would be surprised that it assumes a frequency lower than expectation (expectation would be lets say higher than 30kHz). I think that is something interesting to see and think about.
 Re: Calculating motor torque required March 27, 2014 11:18AM Registered: 8 years ago Posts: 20
So basically what you're saying if I understand you is that drivers have certain amount of on and off time within the pulse time sent to the from the micro controller. Also that you can predict the current rise by the 1-(1/e^(t/tao)) equation but the decay is something I would have to look into on a driver spec sheet. Essentially if I can determine the on time, the off time and the decay equation(s) then I can create an equation to model the current in the motor through both the on and off times and consequently the torque. I'm assuming this makes more of a difference when the on time is used to push the current as high as can be had based on the frequency but doesn't reach the current limit. When the on time is long enough to reach the current limit then the voltage just kicks off and back on very quickly to try and produce an average current equal to the current limit or trip current as you put it. Correct me if I misunderstood or made any wrong assumptions.

One thing I would like to know is lets say I have a motor that produces 'X' holding torque at 1 amp, if the motor current rises to .5 amps can I expect X/2 torque?

OMC-online sells stepper motors and they specify a holding torque rating and a 'rated torque' rating which is 20% less than the holding torque which is why I asked if the holding torque value should be de-rated. In other words is the holding torque or 'rated torque' rating the appropriate one to use in calculating torque based on current in the motor?

To give an example to run the numbers here is a motor 4.2kg-cm Nema 17 circuitspecialists.com

Step angle : 1.8°
Current : 0.5 A
Resistance : 19 ohms
Inductance : 32 mh
Holding Torque : 4.2 kg-cm
Supply Voltage : 24 v
Pulses per sec. : 20,000

Calculated

Pulse time : 0.00005 seconds or 0.05 milliseconds or 50us
Current based on supply voltage : 24/19 = 1.263 A
Current % based on pulse time : 1-(1/e^(.05/(32/19))) = 1-(1/e^(.05/1.684))) = 1-(1/1.03) = .02925 or 2.925%
Current based on % : .02925 * 1.263 = .036949 A
% of rated current : .036949/.5 = .073898 or 7.3898%
Torque produced at motor : .073898 * 4.2 = .31037 kg-cm (best case scenario where there is no off time)
Torque produced at pulley : .31037 kg(force) * 1 cm = x force * .5 cm = .62074 kg(force) *.5 cm = .62074 kg force * 9.80665 (kg m/s2)/kg force * .5 cm = 6.08738 kg * (m/s2) * .5 cm
Distance traveled per step : (pi * 2 * .5 cm)/200 = .015708 cm or 0.15708 mm
Acceleration : Torque at pulley = Torque from load (mass * acceleration * distance traveled), 6.08738 kg * (m/s2) * .5 cm = 1 kg * acceleration * .015708 cm, divide out the masses and distances = 193.767 m/s2
Top Speed : Distance per step * pulses per second (assuming full step) = .15708mm * 20,000 steps/second = 3141.59 mm/second

Clearly the acceleration and top speed are way beyond what the machine could probably handle let alone the extruder being able to keep up. Even if you cut that in half assuming the on time is half of the pulse time and the decay mode is as fast as possible, those numbers are still high.
 Re: Calculating motor torque required March 27, 2014 11:22AM Registered: 8 years ago Posts: 20
Looking at the A4982 data sheet it looks like you can set the off time by using a resistor on the ROSC pin and the resistor value divided by 825 gives the off time in micro seconds.
 Re: Calculating motor torque required March 27, 2014 12:28PM Registered: 12 years ago Posts: 1,352
Yes and other IC can sort of do that, even if the driver manufacturer use support components to set a fixed value for that. For example Mr Nophead has a post here on the topic, in a case like that imagine that resistor would of been a pot instead, it would give the user an additional ability to tweak the driver to the motor.

The step command has nothing to do with the frequency at which the step command is issued. The uC can issue step commands at any frequency, and that relates to the speed at which the motor is supposed to move. When the driver sees a step (e.g. step function, rise edge), the driver understands to make a move. Thats all. What move that is, depends on the microstep regime, but its still only one move.

The step function in signal class means only a move from 0 to 1, only this part is a function named step. After this, how long the signal stays at 1, or how it decays, this does not matter. Only the rising part from 0 to 1 matters, that is the step function as in the theory book. There are a few basic signals from which all other signals can be constructed, step is one of those, an elementary function of time in signal theory. Some drivers will monitor the line after step, to be high for some time, e.g. step width to have a minimum time as value 1, but that is for the purpose of filtering out false rising signals like wires cross-talk and such. If the exact width of the 1-value after the step would have a meaning like velocity or acceleration, that would be a DC servo driver. If the frequency of the step itself would have some meaning as in position, then it would be sort of an RC servo. Our stepper drivers only understand the step function, verifies it a little to make sure it was valid, but thats all. And each step is only 1 move, be it full step or ustep. Besides this, the driver does not interpret the frequency or length of any other parts. So it is not a pulse (pulse is an area), its just a step, and step is just a line, vertical, where value jumps from 0 to 1 (or if it jumps down its the inverse function of step).

So the step frequency basically has nothing to do with anything that happens internally with the coils of the motors. The step frequency itself is not interpreted (not like RC servo). Only each individual steps are interpreted, and independent from each other, and each mean just one thing, make 1 move. The frequency at which the motor coil work, the chopping frequency, that is something internal to the stepper driver instead. For example if the motor stays still, there is (was) no step command issued. But the coil still work at some frequency that is, so you can see these are not linked.

So there is an on-time, rise time, characterized by the e^(-t/tau), because it is a "natural" rise. But the fall time is not characterized by that, because its is mostly not natural: chip can have synchronous rectification inside, sort of meaning that when the time comes it will put the coils ends on short circuit like a recirculation diode, so the current will keep running in circles inside the coil until it dissipates. Or can have 8 external diodes, which again have an impact this way. Anyway, the off-time is not entirely a "natural" falling edge hence not with e^(-t/tau). The "off-time" might have separate intervals, e.g. differently there might be a "blank" time which is basically a wait time when internal comparators are disabled for the purpose of not getting annoying values over Rs (hence false readings) caused by coil inductive spikes. So while not mixing the datasheet off-time with other things, lets call our "off-time" with respect to voltage being applied to the coil, so that would be perhaps better for our purpose, at least is more clear. So we take it as an on-time and off-time and thats basically everything there is. Then i think computing average resembles much with a buck regulator where D is on-time and (1-D) is off-time. Except our (1-D) is not natural, because we actively force current to decay or else we want to put it down to ground, instead of just "naturally" letting it out by itself.
 Re: Calculating motor torque required March 27, 2014 12:54PM Registered: 8 years ago Posts: 20
I appreciate the insight but it's getting away from what I originally posted about which is calculating the torque required for a load to move with a desired max acceleration and top speed. You are explaining the nuances of driver controls which do have an effect on the current/torque but the vast majority of the calculation I ran and am here trying to verify the logic behind, are not being covered. Knowing the moving mass, top speed, top acceleration and the capabilities of the micro controller to send pulses should be enough to figure out roughly how much torque is required from a motor. I don't like throwing money at things and hoping they work, I actually like to know how and why they work so I can manipulate them to suit my needs. Sorry, I'm just starting to feel that the level of detail with this one particular part is making it so I can't see the trees for the forest.
 Re: Calculating motor torque required March 27, 2014 01:48PM Registered: 12 years ago Posts: 1,352
I did that because i was under the impression that you are using the "pulse frequency" (that is the step frequency?) as an input variable. I meant to explain the frequency at which the coils have on-time and off-time, its not related to the step line. You started with 50uS value, where does that come from.

The current rises like I(t)=V/R*(1-e^(-t/tau)) and from this, we figure out how much time it needs so that I(t) = I(peak) where the I(peak)=0.5A, is the setting made by the driver potentiometer. So this equation needs to be solved first, and solved for (t) which is the variable. Then we know how much time this coil needs from the point when the voltage was applied, until the current has reached the 0.5A mark. For the example given is about Ts=8*10^-4. And if we make 1/Ts, that gives the maximum frequency which would accommodate that large rise time, if the rises would occur just one after another, and that is a little over 1Khz and very far from 30Khz. This is basically why we do not use 19ohms coils with large inductance values. Basically wrong motor type, but you need to do that match comparatively with a motor like 3mH and 2ohms, and will see in the latter case it reaches 0.5A in just 6*10^-5, which is well closer to that starting value anyway (again considering that only rise time exists, without off-time).
 Re: Calculating motor torque required March 27, 2014 02:33PM Registered: 12 years ago Posts: 1,352
Quote
MeltManBob
I[...] the capabilities of the micro controller to send pulses [...]
That 50uS assuming 20?kHz which the smoothie can output is not related to the coils, it perhaps related to the speed at which motor moves, because each step means 1 move, so ofc more moves per sec is more speed. But stepper driver does not care for that frequency, each step is processes one after another, means 1 move and nothing beyond that, the step frequency cannot be an input variable. Basically first assumption is wrong, and the approach is made from wrong direction. This part between uC and driver input, the step line, is just chip to chip communication, you can take it as a protocol, like I2C or SPI, or something like that, it serves just to send commands, but it does not directly influence what happens to the motor coils.

What happens to the motor is the job of the stepper driver IC which is the "chopping boss" - the local chip in charge with an axe and cuts down current. You need to apply the formula and see it how the driver sees the motor coils. At t=0 driver puts the voltage on the coil, and the coil current needs some unknown time to reach the set point of 0.5A. Because inductors fight against current changes, that current rise takes time. From the formula the time is the variable, so you find out exactly how much time it takes for the current to go from 0 to 0.5A. This is the key number, has several implications. From that you can deduct what actually happens, for example if the current does get chopped or not. Making 1/that would be a very gross approximation of frequency because it would assume that all periods are only on-time and the current magically instantly disappears in between, but well that is to give an idea of the frequency. When that math is actually put in practice, those rise times need to space out to make room to the fall times, so the current can also "decay" each time after it rises, and that decay is at different time interval than the rise time which was previously calculated.
 Re: Calculating motor torque required March 27, 2014 10:02PM Registered: 8 years ago Posts: 20
Ok thank you for trying to get back on track The pulse time was just a random number I chose to use but can be adjusted. If I understand correctly which is what I was assuming before, the pulse time from the micro controller doesn't actually do anything to the current, it is just a signal to the driver to turn on or off. Looking at the A4982 data sheet I can see that for one pulse, the pulse from to the driver is roughly 50% on then 50% off. I also understand that the drivers operate step by step but the pulse frequency from the micro controller is relevant to determine information about a single pulse.

It sounds like what you are saying about reaching the max current is the driver is capable of reaching voltages higher than the supply voltage in order to dictate the current limit which I've also read in the data sheet but I wasn't 100% certain about. This makes me think that the supply voltage dictates how high the driver can pump the voltage and/or how fast it can pump it because even if the driver can get a higher voltage to reach the current limit there has to be some limitation as to how high a voltage it can produce and consequently how fast it can get to the current limit. I'm assuming that the driver pays attention to how long the pulse signal on time is and then multiplies it by 2 to determine the time frame that it needs to turn on the current and then off based on the decay mode. My understanding of the decay modes while not through an equation, just from the datasheet images is that slow decay will leave you with 90% of the current, fast decay will get you roughly back to 0% and mixed will do fast then slow yielding roughly 75% of the current by the time the next step on/off sequence starts.

So how do I find out what the maximum voltage is that can be produced by the driver?

To go off on the driver tangent a bit, if the driver can charge pump to a higher voltage than the supply, lets call it Vx, then why doesn't the driver apply Vx until the current approaches the current limit and starts dropping the voltage in-sync with the current rise so that when it reaches the rated current it is at the rated voltage of the motor. Then it can hold the current steady without decay until the next step. This would seem to be ideal for an increasing current per step situation. In a decreasing current per step situation couldn't it flip the voltage polarity for a very brief period to pull the current down faster and rapidly increase up to the steady state voltage requirement for the new current level?

Back on topic, I know that assuming the driver on time being 100% is a theoretical best case scenario but it does set an upper limit showing me that the actual numbers must be below that value. I'm still wanting to figure out how to determine the minimum torque required to move a load with a specified max acceleration. If I know the moving mass and the desired acceleration then I can calculate the force, over-compensate that number some to account for friction and other things that would just require even more complicated math to specifically define. Is that correct? Then that becomes my target value to base my motor selection on but I would also need to know my distance traveled per full step so I can compute a target torque value, is this also correct? I understand there is a lot regarding the driving of the motor and motor selection that I need to account for and I appreciate that you're helping me along with those things but can you confirm or correct the remainder of my logic so I can understand which parts of the big picture I have correct and which ones I need to go more in depth on?

Again I want to emphasize I do appreciate your time and effort, you seem to be plenty capable of teaching me a lot about things I don't know which is more than I hoped for but am glad to get to know even more details so I can have a better understanding.
 Re: Calculating motor torque required March 27, 2014 11:24PM Registered: 8 years ago Posts: 20
I looked at the datasheet some more trying to figure out how the supply voltage effects the output voltage even though they are not directly linked and couldn't find much. The trip current is set by Vref/(8*Rsense) and Rsense appears to be a combination of 2 external resistors. Basically what I'm not getting is that I've read that if you increase the supply voltage then you can drive the motors faster to the trip current but I'm not seeing where the correlation lies since the supply voltage is not the voltage used to calculate the current. Otherwise there wouldn't be any benefit of using a 24v supply over a 12v but I know that it is better to use a higher voltage.

Anyway I'd like to reiterate that I would like to make sure the rest of my math logic outside of the drivers is good to go or not that way as we continue to hash out the details of the driver I can keep a big picture perspective. Ultimately I know that a faster time constant for a motor would appear to be best because the current/torque can build up faster BUT being able to actually calculate these things would let me figure out if a more powerful motor might be better even if it has a slower time constant but more than made up for it in torque. For example a smaller motor with a faster time constant that could reach it's rated current within some period of time 'X' compared to a larger motor where in that same time period 'X' it only reached 50% of it's rated current/torque but that torque being higher than the smaller motor. In that situation the more powerful motor would actually produce more torque. Thanks again!
 Re: Calculating motor torque required March 28, 2014 05:27AM Registered: 12 years ago Posts: 7,616
Quote
MeltManBob
So how do I find out what the maximum voltage is that can be produced by the driver?

Read the data sheet. Typically some 35V to 40V.

 Generation 7 Electronics Teacup Firmware RepRap DIY
 Re: Calculating motor torque required March 28, 2014 06:14AM Registered: 12 years ago Posts: 1,352
Quote
MeltManBob
It sounds like what you are saying about reaching the max current is the driver is capable of reaching voltages higher than the supply voltage in order to dictate the current limit which I've also read in the data sheet but I wasn't 100% certain about. This makes me think that the supply voltage dictates how high the driver can pump the voltage and/or how fast it can pump it because even if the driver can get a higher voltage to reach the current limit there has to be some limitation as to how high a voltage it can produce and consequently how fast it can get to the current limit.

So how do I find out what the maximum voltage is that can be produced by the driver?

No, the stepper driver does not boost the voltage, it does not produce bigger voltages than its input. Sry if i said something that could be interpreted as such. If there is something like a charge pump in the datasheet, that is to produce voltage for the gates of high side mosfets, thats all. In the case the high side mosfets are n-channel, to drive them it they require a gate current higher than the voltage they sit at, so if they are on the 12v line, they need like 17v plus gates to start conducting. Allegro use n-mosfets for high side, other chip manufacturers may use p-channel for high side and hence they do not need charge pump because p-channel will conduct with gate less than 12v. If other voltages appear on the coils, its from inductive spikes and not because the stepper driver increases the voltage on the coil. Otherwise the voltage that is supplied to the coil is the same with input voltage, which does have a maximum of 32-35-40v or something like that, yes its in datasheet.

Quote
MeltManBob
I'm assuming that the driver pays attention to how long the pulse signal on time is and then multiplies it by 2 to determine the time frame that it needs to turn on the current and then off based on the decay mode.
No, the pulse signal on time has no significance whatsoever. On the step line nothing matters, not the frequency, not the duty cycle, not the pulse duration. You will see in datasheet something like step minimum pulse width, but that is just monitoring to make sure the step signal was valid and not an occasional spike. Other than that the pulse width is not processes further, if pulse width would mean anything else it would be dc servo not stepper. I have said all this like many times.

Edited 1 time(s). Last edit at 03/28/2014 06:21AM by NoobMan.
 Re: Calculating motor torque required March 28, 2014 06:48AM Registered: 12 years ago Posts: 1,352
Quote
MeltManBob
I looked at the datasheet some more trying to figure out how the supply voltage effects the output voltage even though they are not directly linked and couldn't find much. The trip current is set by Vref/(8*Rsense) and Rsense appears to be a combination of 2 external resistors. Basically what I'm not getting is that I've read that if you increase the supply voltage then you can drive the motors faster to the trip current but I'm not seeing where the correlation lies since the supply voltage is not the voltage used to calculate the current. Otherwise there wouldn't be any benefit of using a 24v supply over a 12v but I know that it is better to use a higher voltage.
The sense resistor is put in series with the coil. There are 2 of them, one for each coil.
To see the correlation you need to do the math. Just look at one coil of the motor alone. You put a voltage over it. How much time does it take for current to grow from zero to the level set by the pot. The function is I(t)=V/R*(1-e^(-t/tau)), and we put condition that I(t)=0.5A (setpoint), and then we know all the rest just need to solve for t. And that t will say how much time it takes for current to go from zero to 0.5A. Thats all. Put the following in wxMaxima:
"--- rise time single ---";
kill(all)\$ declare([t,R,L,tau],real,[Fs],integer)\$ assume(t>=0,Fs>0,Ts>0,R>0,L>0,C>0)\$ ratprint:false\$
"****date****";
R:19\$ L:0.032\$ tau:L/R; setpoint:0.5; V:12;
"****solve ****";
Curent(timp):= (V/R) *(1- %e^(-timp/tau)) ; Fs:1/(Ts) \$
Ts:solve(Curent(timp)=setpoint,timp),numer; Fs,numer;
"*** end ***";
And change the variables, then hit the enter from the keypad (not the usual enter) to recompute. If V=12V then ts=0.0026 seconds. If the V=24v, then ts=8.4..*10^−4 seconds. It means with 24v supply, the currrent reaches 0.5A mark much faster. Coils energize faster. We are interested to make this as fast as it can be, so higher voltage is better because of that purpose.
Then, put the specs of a normal reprap motor, that is low inductance and low resistance, try something like L:0.003 and R:2 and V:24 and see that difference ts=6.3*10^−5, now that is different, and suddenly that time period is equivalent to 16kHz instead of 378Hz and 1.2Khz like it was in first case.

Quote
MeltManBob
Anyway I'd like to reiterate that I would like to make sure the rest of my math logic outside of the drivers is good to go or not that way as we continue to hash out the details of the driver I can keep a big picture perspective. Ultimately I know that a faster time constant for a motor would appear to be best because the current/torque can build up faster BUT being able to actually calculate these things would let me figure out if a more powerful motor might be better even if it has a slower time constant but more than made up for it in torque. For example a smaller motor with a faster time constant that could reach it's rated current within some period of time 'X' compared to a larger motor where in that same time period 'X' it only reached 50% of it's rated current/torque but that torque being higher than the smaller motor. In that situation the more powerful motor would actually produce more torque. Thanks again!

The mass, acceleration, force, ratio of pulleys, and that part is pretty easy and clear. But the deal with the motor is something else. It does not mean you can take the number written as the holding torque, multiply it with step angle and have your output torque. First, the motor you mentioned, driven at 12v would need a time period of 0.84 miliseconds just to reach 0.5A. That time frame is much too long. As a result, the current wont ever have enough time to reach 0.5A. As a result of that, the average current will be very low. And because the flux is proportional to the current, then the flux is low too. Then the motor has actually no power. It does not matter what datasheet says about holding torque at this point, that motor will not output anything that resembles that torque number.

Edited 1 time(s). Last edit at 03/28/2014 06:53AM by NoobMan.
 Re: Calculating motor torque required March 28, 2014 07:14AM Registered: 12 years ago Posts: 1,352
Now if i said that a certain time is equivalent of some frequency, that is 1/time, and its just to figure out an idea, if all the periods will be just like that (leaving offtime aside for now, for judgemental perspective). And suppose we drive the motor with your specs at 1.2Khz, it will reach 0.5A mark every time. We could also drive it like 20Khz instead, but in this case the time period is much shorter and then the current will never have enough time to reach 0.5A. You can also compute that with same formula using t=1/20khz, and you will see that I(t=1/20khz) = hardly 0.02A which is like 20mA and also, interestingly that is the peak, whereas the average will be even lower. So the motor would have no power really with 20mA *peak* current.

I think you take the holding torque number in the datasheet as a "given". By all means that is not a "given". Its a maximum, and maybe sometimes too optimistic. Sometimes its even inflated by manufacturers which specify constant current, as in the coils would be driven with resistors like 30 years ago, which is sort of false, because the coil current nowadays is anything but constant. And ofc when making average, the constant current is going to win over a waveform with same amplitude but which has ups and downs. The constant current will have no valleys, no empty spaces in its waveform, so its already more than double. So again, that torque number being a maximum, perhaps over optimistic even, whatever torque you are going to get it is not going to be that number. Depends on how you drive the motor. Thats why the driver and the motor need to make a good pair together, and there are quite a number of parameters to fit.
 Re: Calculating motor torque required March 28, 2014 07:55AM Registered: 12 years ago Posts: 1,352
Oh and if i have not said this already, the actual output the motor produces, is directly proportional, by definition, to the current that is in the coil. This is why we had to go into all that math. It was not like we could avoid it for this purpose. If the current is small then the output/torque will also be small, etc. The torque number in the datasheet is mostly optimistic and sometimes even cosmeticized, and doesnt mean anything by itself. The actual current in the coil means everything. Ofc, imo.
 Re: Calculating motor torque required March 28, 2014 08:54PM Registered: 8 years ago Posts: 20
Sorry for not getting back earlier but I was only able to reply quickly before because I was home sick. Reading through what you've written it sounds like the approach I was taking in my initial post is mostly correct and maybe I just didn't explain what I was doing very well. Initially I assumed that the supply voltage would be the voltage used to do the calculations which made sense that a 24v supply would allow faster speeds than a 12v at the same torque. I understand that the way the drivers work is that you set the desired current limit but I was working from the perspective of using a desired step rate and then figuring out what maximum current could be achieved within that time period and consequently the torque produced because I also assumed that current and torque were linearly related. For example with the motor we've been using I assumed that when a .5 amp current was flowing through the coil(s) it produced it's rated holding torque of 4.2kg-cm. Part of my reason for asking if I should de-rate the holding torque value by 20% was because I assumed the max torque produced when actually moving would be somewhat less than the holding torque value. De-rating also made sense because of the website I mentioned before that had a holding torque and 'rated torque' rating. For example if they had a motor with 20 n-cm 'rated torque' then it's holding torque was 25 n-cm.

After looking at the datasheet graphs more closely I see what you mean about the pulse from the micro-controller not relating to much of anything. All I can tell is that the only things that appear to correspond is the initial receiving of the pulse and the rise or fall of the current. Looking at the Smoothieboard there appears to be 2 lines between the controller and the driver; step and direction. The way I understand it is that the controller tells the driver how fast to step and which way to spin the motor. From there the driver has it's own internal tables to determine how to power the coils in order to achieve the instructions sent by the controller. What I'm still a bit confused on is if the driver only see's the on pulse from the controller as the point in time to turn the current on to whatever value it's tables says to, how does it decide when to start the decay if it doesn't know when the next step pulse will arrive and the driver doesn't derive any information from the step pulse other than to try and reach a certain current level and hold it until the next pulse signal?

Anyway I will have to look over your responses some more later, I just got home and still have some stuff to take care of. Thanks again Re: Calculating motor torque required April 03, 2014 09:01AM Registered: 8 years ago Posts: 20
So pretty much lets just ignore the frequency from the micro-controller. It sounds like I have the math right for figuring out what torque I need to produce from the load end of things and now I just need to figure out what the motor can produce at various speeds. Looking at the datasheet for full stepping it shows 70.31% current through each phase. I'm assuming that the holding torque rating of a motor is the torque produced at the rated current through both phases. The lowest current is when it drives 100% current through only one phase when half stepping or micro stepping. Is my assumption about holding torque correct in regards to it requiring the rated current through both phases? If so then it appears that at most the torque would be 70.31% of the holding torque and as little as 50%.

Knowing the supply voltage and motor resistance and inductance I can find the time it takes to reach the current limit or I could determine what current I can achieve within a shorter time period at a reduced torque. When looking at the current table in the driver datasheet and it says the percentage of the trip current to each phase I'm understanding that to mean that the driver will apply the supply voltage until the target current percentage is reached or as close to it as it can get if the on time is too short. For example under 1/16th stepping it shows 100% on phase 1 for step 1 and 2, then 98.44%, 95.31%, 92.19%. If the on time isn't long enough to reach 100% on step one then the current just looks like the exponential increasing curve. Then there would be some slow decay because the next step is increasing but on step 2 the current is already at some percentage of the trip current so it continues to try and reach it's target percentage.

I've taken the data from the current table and plotted the points which resemble sine and cosine waves but mathematically they don't match so I'm not sure how the manufacturer came up with those specific current percentage values. I also tried computing the values from a sine and cosine function and then computed their values +/- 5% which is the deviance given in the spec sheet. The values fall within those ranges from the real sine and cosine functions but with no specific pattern. I also noticed that when I did a regression fit to the datasheet values, a 6th order polynomial fit almost perfectly, much better than sine or cosine so I'm thinking that maybe they used a polynomial approximation because it is easier to calculate than sine and cosine.

I guess part of what's not making sense with this is that the net torque varies quite a bit in between full steps which I would have expected the phase currents to produce a relatively constant net torque but vary the ratio between the 2 phases. If at each full step each phase is run at 70.31% of the trip current then why do the micro steps not also average 70.31% over the 2 phases? Obviously if a phase can only go to 100% of it's trip current and each phase cycles between 0-100% then the most you could have while maintaining roughly the same net torque would be an average of 50% current.
 Re: Calculating motor torque required April 03, 2014 09:02AM Registered: 8 years ago Posts: 20
Tried posting a couple days ago but the site told me my post was spam and I forgot to retry.
Sorry, only registered users may post in this forum.