54. Measure bidirectional current

A 12 V battery system must measure both charging and discharging current.

Using the provided R_SHUNT = 0.1 Ω, design a high-side current measurement circuit so that:

  • Battery discharge produces a positive V_DIFF.
  • Battery charging produces a negative V_DIFF.
  • The system ground remains directly connected to battery ground, without a shunt in the ground path.

I_DRIVE controls the test current. Negative I_DRIVE represents battery discharge.

Example test cases:

I_DRIVEExpected V_DIFFCondition
−1 A≈+100 mVDischarging
0 A≈0 mVNo current
+1 A≈−100 mVCharging