Skip to content

P5: The back EMF compensation factor (Eg)

Michael Mayer edited this page Feb 2, 2019 · 2 revisions

P5: The back-EMF compensation factor (Eg)

P5 is the 'generated voltage (expressed as a fraction of the maximum motor voltage) per encoder count per millisecond'. This parameter can be calculated from the datasheet or measured using a DSO.

Measuring P5

Measuring is very easy and fast, I highly recommend taking this route.

All we need is the motor speed and the generated voltage. Connect one channel of the oszilloscope to one of the encoder signals and the other channel to one motor terminal. The second motor terminal goes to GND. Now move the motor by hand and measure the frequency of the encoder signal and the amount of the generated voltage. The speed needs to be steady only on a millisecond scale, thanks to inertia that is very easy to achieve even by hand. Situations like this is what DSOs are made for!

P5'[V/kHz] = Vemf[V] / (4*fenc[kHz])

Divide this by the maximum driver output voltage of your application and convert it into a 8:8 fixed point value to find the value for P5:

P5[1/kHz = ms] = 256 * P5'[V/kHz] / Vmax[V]

Calculation of P5

Elm's description of the formula for P5 is correct, but very brief. Let me add some detail.

    P5 = KG [mV/rpm] / Encoder resolution [ppr] / Supply voltage [V] * 3840

KG [mV/rpm]: The back-EMF constant is mentioned in the motor datasheet or can easily be measured. Brushless DC motors are often characterised by their Kv-Value, which is simply the inverse proportion of KG: KG[V/rpm] = 1/(Kv[rpm/V]). But keep in mind that Elm's formula includes an additional factor of 1000 because it asks for [mV/rpm] instead of [V/rpm].

Encoder resolution [ppr]: The number of encoder pulses per revolution which is different from the number of position counts per revolution (counts=4*resolution)

Supply voltage [V]: This is the maximum supply voltage at the motor after accounting for driver losses. These losses can be quite significant. The L298 looses 3.2V at 1A, leaving only 11.8V of real supply voltage from a 15V power supply. Reducing these losses is the reason why boostrap drivers where invented.

Factor 3840: is actually 256*60/4. *60 to convert from 1/rpm (rounds per minute) to 1/rps (round per second). /4 to convert from encoder counts to physical encoder resolution. And *256 to convert a rational number to a 8:8 fixed point.

If you put it all together you end up with P5 meaning 'the generated voltage (expressed as a fraction of the maximum motor voltage) per encoder count per millisecond'.