Shop OBEX P1 Docs P2 Docs Learn Events
Fixed off time current control, sense resistors, and theory — Parallax Forums

Fixed off time current control, sense resistors, and theory

pedwardpedward Posts: 1,642
edited 2012-02-08 03:45 in Propeller 1
So I've been researching how various stepping drivers limit the current through motors. The common method seems to use a sense resistor and fixed off time current limiting. This method measures voltage accross a sense resistor and turns off motor current for a fixed time when it exceeds a threshold. This is a very simple bang-bang current control that relies on the current decay in the motor to work properly.

Now, if you know the inductance and resistance of the motor, you can calculate the current rise and decay time for the windings, inferring the amount of current in the motor.

For reference:
http://sweethaven.com/sweethaven/ModElec/acee/lessonMain.asp?iNum=0402
http://www.daycounter.com/Calculators/Inductor-Current-Power-Calculator.phtml

As an example, I have a 269oz/in import motor with a 1.13 ohm winding resistance, 3.6mH inductance, and 2.8A current rating.

A coil with a 1.13 ohm resistance @ 24v will have a maximum saturation of 21.23A. The time it would take to saturate is 3.6mH / 1.13 = 3.18ms.

You can calculate the on time for the rated current using inductance:

Ton = Isat*L/V

Example: 2.8A * 3.6mH / 24 = 0.42ms

The time constant is:

T = Ton * I / Isat

The current rise would be:



T
Ratio
Current


1T
.632
13.42A


2T
.865
18.37A


3T
.950
20.17A


4T
.981
20.83A


5T
.992
21.06A





The current decay:



T
Ratio
Current


1T
.368
7.81A


2T
.135
2.86A


3T
.05
1.06A


4T
.019
0.40A


5T
.008
0.16A






With this information you can calculate your timing without depending on current sensing solely to adjust your current input.

My question is: If you can quantify a motor's operating parameters, why rely solely on fixed current control and bang-bang chopper drive?

It seems silly to use reactive feedback instead of predictive modeling, if you've got the smarts to do microstepping in the first place; even Gecko doesn't use motor parameters for modeling.

My testing has shown that running a motor at saturation isn't always desired because there is a lot of power dissipation in the windings, only when you want maximum torque would this be desirable.

This also gives some numbers to quantifying the timin values for microstepping. Since microstepping involves modulating the motor current in a circle, you will have variable torque as well, since the coil saturation varies as the coils are modulated through the 4 step circle.

This also brings up how you would choose steppers for a project if you are using microstepping. A 269oz/in motor only has a fraction of that torque when used in microstepping modes -- full or half stepping looks a lot more desirable when you need torque.

This would also help to explain why Gecko hybrids to full steps at high speed, as the torque drops off at higher speeds and the power input tries to stay the same. When you are at high speeds the available torque is decimated, so they make up for that by switching to full step mode.

This is probably implemented by blending their 40 microstep table into only 4 steps. You would have a table of 10 RPM entries, as you hit each RPM entry, you rail the current value. The table would be arranged to have increasing RPM values and decreasing step values.

I noticed that Allegro has published their step mapping for their microstep driver chips, their current values are non-linear as I suspected, I'm thinking they may have based them off of the non-linear current rise depicted in the above tables.

Comments

  • jmgjmg Posts: 15,183
    edited 2012-02-07 00:25
    pedward wrote: »
    My question is: If you can quantify a motor's operating parameters, why rely solely on fixed current control and bang-bang chopper drive?

    There are a number of reasons :
    ** Current sense protects from SW run-away
    ** Current sense removes temperature and supply voltage as variables, as current is what delivers Motor torque.
    ** Current sense allows different Motors to be supported with no complex SW changes

    Re Microstepping: Note also that not all Steppers, have linear Pole-hand-over, so a linear change in angle may NOT always involve the same dI.
    I recall high precision systems that shipped with an EPROM for each motor.
  • Christof Eb.Christof Eb. Posts: 1,237
    edited 2012-02-07 03:26
    Hi pedward,

    you may consider the following additional effect: When the motor is spinning, it works as a generator. The voltage to drive the resistor and the inductance is then V= V_Supply - V_Generator. This leads to the decreasing torque over speed.
    I think, that hardware current feedback is used often, because you can then drive the motor with a very high supply- voltage which gives you constant torque over speed whithout risc of melting the motor windings.

    Christof
  • idbruceidbruce Posts: 6,197
    edited 2012-02-07 05:51
    Pedward
    The common method seems to use a sense resistor and fixed off time current limiting. This method measures voltage accross a sense resistor and turns off motor current for a fixed time when it exceeds a threshold.

    To my knowledge it has nothing to do with time, it is all dependant upon voltage across the sense resistor, which is fed into a comparator. When it reaches a certain voltage, the comparator deenergizes the h-bridge that controls the coil.

    Bruce

    Edit: After further reading and further thought, yes it would have to be timed, because you eventually have to reenergize
  • pedwardpedward Posts: 1,642
    edited 2012-02-07 13:11
    idbruce wrote: »
    Pedward



    To my knowledge it has nothing to do with time, it is all dependant upon voltage across the sense resistor, which is fed into a comparator. When it reaches a certain voltage, the comparator deenergizes the h-bridge that controls the coil.

    Bruce

    Edit: After further reading and further thought, yes it would have to be timed, because you eventually have to reenergize

    The fixed off time relies on the decay rate of the windings. Since the energy in the windings decays at a rate slower than the rise time, you could run into a situation where you don't shed enough current from the windings and they run above rated current. This would happen for a high inductance, low resistance winding. It just seems oh-so-sloppy. I think the best way would be to use parameters for control and tune that with feedback from the sense resistor, but don't rely on the sense resistor as the sole means of control.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-07 14:48
    Let's say the current goes to 1A at 10ms, and doubles every ms after that. Let's say it releases to 60% each ms. I know that's slow and exponential, but let's just say that's what it is (to approximate saturation). If you have your chopper set at 5A, and the off time at 1ms. You turn the circuit on for 12.3ms and the current goes to 5A and gets cut off. Over 1ms, let's say it drops to 3A. When you apply current again, it'll take 737uS to reach 5A, where it'll be cut off for 1ms again. This is a self-managed 42.4% duty cycle. How would the current run-away from you?
  • pedwardpedward Posts: 1,642
    edited 2012-02-07 17:14
    Ok, I follow your point.

    References:

    http://www.pololu.com/file/download/a4988_DMOS_microstepping_driver_with_translator.pdf?file_id=0J450

    I was reading the Allegro A4988 datasheet and it hit me, a couple things. First, they have what they refer to as "slow decay" and "mixed decay". The slow decay would appear to be a very reduced current input, not totally off. The also show a "fast decay", which would appear to be the decay time of the inductor. They have a mode called "mixed decay" that shuts off the inductor, allows it to decay, then kicks the FETs on with very little current. I wonder if the heating problems with this chip is the "slow decay" is the drive FETs running in linear mode.

    This brings up the point of theory of how to map steps to current input.

    At lower angle values (sine phase), the current will rise much faster in the motor winding, as you approach the 90 point, the current rises much slower. Allegro appears to have arranged their step spacing such that the spacing compensates for the slower current rise at higher current levels. Thus the distance between steps becomes shorter a the inductor reaches current saturation; the scale seems to indicate that a motor moves more at higher saturations for a given change in current.

    It is possible to make a stepper driver be self tuning. I would apply a current to the motor winding and measure how long it took to get to full saturation, and what the full saturation amount is. Based on full saturation and setpoint, you can determine the time constant of the motor, then use that time constant for your 'micro pulse' multiplier.

    I was thinking a loop running at 2Mhz would give 500ns micro pulses, then you simply have a reference value that contains the number of micropulses for full current saturation to the setpoint, then have a table with scaler values at each step angle. Thus Current output = (micro pulses to reach saturation) x (table scaler value for step angle desired). You then have a trim value which is derived from current sense feedback, which is applied to the calculated value. This way you don't neet fixed off time to keep the motor current at stable values.

    I was thinking about both sides of the motor winding are "off", the motor winding is shorted through the FET internal resistance and the current sense resistance, but since these are present in the charge cycle, the rate is the same and only the internal resistance and inductance really come into play. This DOES point out out that it's important to only read the motor current during charging and not during discharge.

    Another curious point, back EMF causes the amount of current to charge the inductor to be higher than the actual saturation current in the inductor, so sensed current may actually be higher than the saturation of the inductor? Am I getting that right, or does it basically wash in practice as there is EMF in the inductor which equals that "missing" component? Or does the charge time formula account for that?

    This begs the question, if an inductor is 50% charged, does it take 50% of the Ton to reach 100%, or because of reduced back EMF, does it take less than 50% of the Ton to reach 100% from 50%?
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-07 20:38
    Look at some of the saturation curves on page 2 of this datasheet for example.
  • pedwardpedward Posts: 1,642
    edited 2012-02-07 21:21
    I think I'm just overthinking the problem :nerd:
  • Christof Eb.Christof Eb. Posts: 1,237
    edited 2012-02-08 03:45
    Hi pedward,
    I'll try a second time: The voltage generated by the turning motor is a strong influence. This voltage is generated in the same windings that form the inductor. Luckily it is possible to see this as different parts of a model. The winding becomes an inductor and a voltage source. So you can handle this much simpler. Subtract the back-emv voltage from the supply voltage and drive the "non-spinning-motor" with the reduced voltage.
    As far as I found out some months ago with some experiments on stepper motors the reduction of current (and therefore torque) due to generated back-emv is stronger than the influence of the inductivity together with the switching frequency.

    So if there is a possibility of stalling for your drive you will need a speed sensor!

    Have fun.
    Christof
Sign In or Register to comment.