0
\$\begingroup\$

I use INA219 module to read DC motor current for control propose. I connect INA219 in series with motor as shown in schematic.

schematic

simulate this circuit – Schematic created using CircuitLab

The control signal is 31.25kHz PWM. when motor turn CW (A = 0,B = 1) it work normally but in reverse (A = 1, B = 0) the current reading look very spiky and INA219 not respoding after I stop motor shaft by hand. After some investigation. I found negative voltage on osciloscope. Setup A = 1, B = 0 probe on pin A reference to Gnd. enter image description here Then zoom into falling edge. enter image description here My assumption is the negative voltage that below maximum rating of INA219 did something cause its to reset. My questions are

  1. What happen here why negative voltage is too high?
  2. How to solve this problem?
  3. (Optional) Any tips to measure DC Motor current?.

Additional Data This is my setup. enter image description here

\$\endgroup\$
11
  • 1
    \$\begingroup\$ What is the shunt value is used for current measurement. With this block diagram it's hard to understand the setup. The scope plot shows which signal voltage across ??? \$\endgroup\$
    – user19579
    Aug 8, 2020 at 7:39
  • 1
    \$\begingroup\$ In module use 0.1 Ohm motor draw about 100 mA when I try to stop it. \$\endgroup\$
    – M lab
    Aug 8, 2020 at 7:41
  • 1
    \$\begingroup\$ How are you powering the INA219? Please show the complete schematic, and if possible a photo of the setup including all wiring. \$\endgroup\$ Aug 8, 2020 at 7:47
  • 1
    \$\begingroup\$ @BruceAbbott I use lab bench power supply. all circuit build on arduino UNO shield. I will upload photo soon. \$\endgroup\$
    – M lab
    Aug 8, 2020 at 8:07
  • 1
    \$\begingroup\$ @tlfong01 Most of motor driver on market don't have these feature included mine. sobad. \$\endgroup\$
    – M lab
    Aug 8, 2020 at 8:34

1 Answer 1

1
\$\begingroup\$

I had the same problem, it helps to change the sample amount configuration. At 1 sample (which is the Adafruit default) the current value keeps jumping around. When the configuration is changed to 128 samples I get a very stable reading (that varies as expected, when the motor load is increased, the current increases). The following needs to be changed:

INA219_CONFIG_SADCRES_12BIT_1S_532US to INA219_CONFIG_SADCRES_12BIT_128S_69MS

You can also change the following (for the bus voltage), but this seems stable also with the original setting:

INA219_CONFIG_BADCRES_12BIT to INA219_CONFIG_BADCRES_12BIT_128S_69MS

(changes to be made in Adafruit_INA219.cpp)

\$\endgroup\$
1
  • \$\begingroup\$ Welcome to EE.SE. You can format the code in your answer using the {} code formatting button on the editor toolbar or by separating the code with a blank line and adding four spaces at the start of each line. For inline code use back-ticks on each side. \$\endgroup\$
    – Transistor
    Dec 28, 2020 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.