Near Field Notes

Videos

The notes, in motion

One video per topic, newest first. Point at a card for a silent preview.The card in the middle of the screen plays a silent preview. Open one to watch it whole.

47 videos, 47 with a note to read after.

3:07 · With sound

Current sense errors

How far off can a motor driver’s current reading be with every part in spec?

Read Note 45

Transcript

This motor is stopped. By the datasheets, its driver can still read 2 A.

And every part on the board is in spec.

One step at startup takes that to a quarter amp.

Here's every error in a motor driver's current sensor, how to add them up, and what calibration can't fix.

Let's follow one phase of a real board, the moteus-c1. Motor current returns through a 2 mΩ shunt.

An amp inside the gate driver multiplies that by 20, and a 12-bit ADC turns it into a number.

Every stage adds one of two kinds of error.

An offset adds the same amps to every reading.

This amp's input can sit 4 mV off. Across 2 mΩ, that reads as 2 A.

The ADC adds 4 counts, about 80 mA.

A gain error tilts the line. It's a percent of the reading.

The shunt is a 1% part. The amp's gain can be 3% off.

And the 3.3 V rail is in the measurement. The ADC counts against it, and the firmware assumes it's exact. Another 2%.

So the 1% shunt is the smallest of the three.

Resistors matter too. The ADC's sample capacitor charges through whatever sits in front of it.

ST publishes the limit: 100 Ω at the fastest sample setting.

Now add them up. Stack the gain errors end to end and you get 6.2%.

That's the worst case: every part at its limit, all leaning the same way.

But these errors are independent. So add them at right angles, the way you'd add the sides of a triangle. 3.7%.

Which number is right? I simulated 100,000 boards.

If each limit is a 3-sigma number, 99.7% land inside the root sum square.

If parts are spread evenly across their tolerance, 92% do. 8 boards in 100 land outside.

So root sum square is where most boards land. The straight sum is the edge. Use the edge for a trip limit.

One catch: it only works for independent errors. Two that share a cause add in a straight line.

An offset hurts most at low current. Uncalibrated, a true 1 A reads anywhere from −1 to 3.

So zero it. That's startup calibration. With the motor off, moteus averages 256 samples per phase and calls that zero, every time the driver turns on.

The 2 A are gone. Now the gain error is the big one, and it grows with current. 10 A reads 9.5 to 10.5.

Next, factory calibration. Run a known current through each phase, once, and store the ratio.

That stored number absorbs the shunt, the amp and the rail. 10 A now reads within a quarter amp.

What's left is drift. As the board warms 50 °C, the amp's offset can move a quarter amp, and a zero taken at startup can't see it.

On 2 mΩ, that drift is 5 mA a degree. A zero-drift amp moves 40 times less.

Why does the motor care? An offset on one phase makes torque ripple once per electrical turn.

A quarter amp off, at 10 A, is 3% peak to peak.

A gain mismatch between phases ripples twice per turn.

And if all three read high by the same amount, there's no ripple. The torque is just low.

So, 10 A. Uncalibrated: 8 to 12. After startup calibration: 9.5 to 10.5. After factory calibration: within a quarter amp.

And every part on that board was in spec all along.