## Vex 269 Current data based upon Excel Hbridge Model

The scope data from the Vex forum posted by Jpearman inspired me to update my old excel and labview  H bridge analytical models which do a good job of predicting the actual wave forms.  In 2009 I spent a lot of time in a First Chief Delphi forum thread with some motor experts figuring out why a Jaguar controller was linear in speed with duty cycle and a Victor was non_linear.

An example used for tuning the model for a Vex 269 motor is the duty = .5 , stall condition  as shown in this post.  The corresponding calculated waveform from my model using LABVIEW is shown below:  Click to expand figure.

I use the Labview model Hbrige.vi to generate inter PWM cycle time histories and the Excel model to look at average currents for the PWM cycle.  Both models  simply solve the L,R differential equations and provide parametric data.  The Labview model uses numerical integration and the Excel model uses closed form solutions and they provide a good cross check on each other.    The models require the motor inductance L which I estimated from the wave forms posted  on the Vex forum.   The model matching gave the motor inductance L = 730 uh.   Using this and the spec motor parameters I generated parametric tables of current vs duty cycle vs motor speed.

The objective of this study is to eventually come up with a better current formula that can be used in the cortex to estimate current.    This can be done with look_up tables, curve fit functions or mathematical models.   This post just deals with simple equations as models but I will later look at using exponential-log functions to compute currents with the closed form differential equations as I used in the Excel program.   I believe it can be accomplished without substantial computational burden on the cortex.

The equations are derived in this post.

Excel Plots

This figure show  current vs duty with speed as a parameter.

You can see that the curve is fairly linear at the high currents but when the currents are around I_free=.18 then a linear model will not work too well.   In the study I generated several current estimates using different formulas to see how well each would perform.  I will show this later on.

This figure is the same data except plotted vs speed with duty as a parameter.

This plot shows the steady state speed vs duty.   This matches what we see from test data.

The shape of this steady state speed curve is strongly dependent on the relationship between the motor time constant tau = L/R and the period T  of the controller PWM cycle.  I define

lamda = T/tau.

If  lamda <<1 then the steady state speed is linear with duty  and if lamda is >>1 then it is inversely proportional to duty.

This next figure shows the effect of lamda which changes if we were to drive a 269 motor with different controllers.  A JAGUAR has a PWM frequency of 15khz, the Victor controller 883 has a 2k hz, the vex controller is around 1250 hz based upon the scope data and the Victor controller 884 has 120 hz.

The vex is somewhere in between the two extremes of the JAGUAR and Victor 884.    The figure also shows what I call the Vamfun approximation to a controller current with lamda >>1 or many PWM cycles per tau.

Vamfun Current Approximation

This approximation gives the current as a function of battery voltage and speed (speed is proportional to back emf voltage Vbemf).

i =(V_battery – Vbemf)*duty/R.      (Vamfun approximation for lamda>>1)

This leads to the inverse relationship between Vbemf and duty.   In the steady state, i = i_free for the motor so we can solve for Vbemf

Vbemf = V_battery – i_free*R/duty .     (Vamfun approximation for lamda>>1)

You can see how well this approximates the Victor 884 which has a low freq PWM of 120 Hz.

This inverse relationship works fairly well in also predicting Vex motor steady state speed but when currents are high, it is better to use the standard linear current model that is similar to the DC motor model with the excitation voltage substituted for with V_battery*duty.

Standard DC motor model for PWM controllers:

i = (V_battery*duty – Vbemf)/R  .   This leads to a linear relationship of speed with duty.  I.e.

Vbemf = V_battery*duty –  i_free*R.      (standard motor model linear with speed)

The standard motor model can be improved when the off phase diode voltage  V_D in the H bridge is included into the equations… especially when using 7.2 v batteries.   Not too important with 12 v sources.

This leads to a better approximation that is still linear with duty:

i  = ((V_battery + V_D)*duty – (Vbemf + V_D))/ R      (Vamfun approximation lamda <<1)

Vbemf = (V_battery + V_D)*duty – i_free*R – V_D

Excel Truth Table

Here are the current summaries generated using the Excel model.   Click to expand a table to see full size.  This table is used as the truth table in which to compare all approximations.

The table could be hosted directly in a Cortex as a look up function but I would like to try to use simpler models to do this.   Below are several examples of how different formulas predict the model current.

Standard DC Current Model

click to expand table

The maximum error is around .31 amps in the mid speed-mid duty area  but has errors < .13 amps at the higher currents associated with low speeds or near stall conditions.  The equation also over predicts the currents which allows for a more conservative use in power management.

Nonlinear stall current vs duty approximation:

In the standard DC current model stall current is linear with duty.   We can improve on this slightly by using a table look up for stall current with duty.  I.e. the current  at rpm =0 is a nonlinear table lookup function of duty  which is then ratioed with a factor (1 – rpm/100).

click to enlarge figure                                                                                                                                                                                               i = I_(w=0, duty)*(1- rpm/100)

The maximum error is <.23 amps and this fits better for high currents near stall.

Modified Standard DC current model (including V_diode)

This is the Vamfun approximation for lamda <<1  which becomes a DC motor model with diode voltage included.  Click to expand table.

This improves the DC model and matches currents <.07 amps for currents > 0.5 amps.  Not too bad.