Standalone Current Sensor reading not accurate

Hi all,

I am using an AD8206 current sensor with a 0.03-ohm shunt resistor to measure the in-line current. I have a DRV 8302 board and I am using an ESP-32 microcontroller.

I am running the motor in the torque control (voltage), the motor turns fine but the current detected by the sensor is not the same as from the power supply as shown below.

Also, when I run the motor at higher torque, the power supply shows a current value of 1 amp but the current sensor shows 330 milli amp.

Kindly, if anyone can tell me what I am doing wrong.

Regards,
Moid

@MoidKhan

This is really hard to tell without any schematics and pictures of the actual setup, as well as the source code. Posting a single screenshot of the output is not going to help a lot. Please consider giving a lot more details, else it’s impossible to tell.

Cheers,
Valentine

1 Like

Thanks for your reply.

I am using the code from the inline current sensor example to measure the total current that is flowing in the motor:

PhaseCurrent_s currents = current_sense.getPhaseCurrents();
float current_magnitude = current_sense.getDCCurrent();

Serial.print(current magnitude); // milli Amps
Serial.print("\t");
Serial.println(current_magnitude*1000); // milli Amps

below in the schematics:

Hi MoidKhan,

The current through the coils is not precisely bus current. I understood this when I tested the torque of my actuators vs bus current and torque vs Q-axis current. It would be a very cool experiment to do also bus current vs. Q-axis current and see the high non-linearity.

1 Like

Many thanks for your reply. I will test the bus current with the coil current. Also, I am thinking of adding an ASC712 sensor on the bus line to measure the bus current.

Nice setup.
I guess you read the data sheet of the OPA setup and have configured the inline measurement with the correct gain. I have made some measurements with the oscilloscope and can tell that the current shapes in my case looked far from ideal and I measure very different relations to the DC currents, depending on motor and set point. I used STM32G4 and don’t know how good (fast) the ADC in the ESP is and whether it is triggered correctly. On my roadmap is to investigate that more in my setup but it seams like even if the absolute values are wrong the FOC current control (set d current to zero) works.