Current sense scale error

There is a hardware error with all ODrives v3.3 and earlier that has been discovered. This error will be fixed in v3.4 and onwards. The error is not very serious, and we may be able to compensate for it in firmware.


The error shows up as a current scale error. If you ask the ODrive to put 10A through the motor, it will only put out 7.5A. Since all the calibration functions also see this error, and it’s static, almost everything works without problem despite this error. The main thing that is different is that you will get less torque than predicted by the motor guide’s formulas.

We will soon have some code in the firmware that will compensate for this error.

Finding the error

It started by people reporting that they were getting less torque out of the motors than advertised. This prompted me to verify the current in the motor using a current clamp with the current measured by ODrive, and sure enough they were different.
To track down weather it was due to software or hardware issues, I measured the voltage on the test-pads that exposed the signals going to the ADCs. This voltage is the voltage across the sense resistance times the gain of 40 of the sense amplifier.

In teal is the voltage after the amplifier, and in purple is the current measured by the current clamp. Ignore the X cursors, and we’ll explain the position of the Y cursors:

During half of the PWM cycle, the current is not passing through the sense resistor, as it sits in the lower half of the bridge. So we can compare the difference between current flowing and not flowing, to cancel any DC drift (this is also done in the ODrive firmware). We also have to take into account the fact that there is a ripple current caused by the current decaying on the motor inductance during the PWM off period. So we get the average value by sampling in the center of the decay waveform. This is also done in the ODrive firmware.

So we get a deltaY of the teal waveform between the cursor locations of 107.2mV, and we also measure an average current on the current clamp of 3.96A. Using the amplifier gain of 40 and the sense resistance of 500 uohm, we can see if there is a discrepency with this equation.
The result is that the real current is 74% of what the ODrive measures.

Vias have high resistance

The cause: 12 vias in parallel are included in the current path that is between the sense taps for the current sensing:

Lessons learned: 100-ish micro-ohm is a lot of resistance; at least for this application.

Fixing the error

It’s quite simple to fix: we make sure to tap the current path as close as possible to the pads of the current sensing resistor.

This fix will be included in ODrive v3.4 and onwards. Note that the aforementioned firmware compensation may render this error of no significance.