EN

Current sensing with a shunt

Shunt resistor, amplifier, resolution and comparison with a Hall effect sensor

Calculator

Measurement
A
Connection
V
Amplifier
Microcontroller ADC
V

The shunt is chosen from common values (0.5 mΩ to 1 Ω) so that the output uses up to 90 % of the range. Offsets and IC data are indicative; check the datasheet of the exact model.

How a shunt works

A shunt is a small, precise resistor through which the current to be measured flows. By Ohm's law, the voltage across it is proportional to the current. That voltage is only a few millivolts, so it is amplified before being fed to the microcontroller's ADC:

\[ V_S = I \cdot R_S \qquad P = I^2 R_S \]
\[ V_{out} = G \cdot I \cdot R_S \qquad I_{LSB} = \frac{V_{ref}}{2^n\,G\,R_S} \]

Choosing RS is a compromise. A large value gives more signal and more resolution, but dissipates more power and takes more voltage from the load. A small value barely interferes, but the amplifier's offset errors weigh more, especially at low currents. A drop of 50 to 100 mV at full scale is typical.

Low side or high side

Low sideHigh side
Where it goesBetween the load and groundBetween the supply and the load
AmplifierSimple: a non-inverting op amp is enoughNeeds a current sense amplifier that withstands the supply voltage at its inputs
Load groundShifted by the shunt dropUnchanged
Detects a short to groundNo: that current does not flow through the shuntYes
Also measures voltageNoYes, with ICs such as the INA219 or INA226

In PWM-controlled motors, the voltage on the shunt jumps at every switching event. For those cases there are amplifiers with good transient rejection, such as the INA240, or the measurement is taken at the right moment of the cycle.

Assembly details

Common ICs

ICTypeNotes
INA180 / INA181Current sense amplifierGains of 20, 50, 100 and 200 (versions A1 to A4). The INA181 supports bidirectional current
INA240Current sense amplifierCommon mode from −4 to 80 V and strong rejection of PWM switching
INA219I²C digital monitorMeasures current and voltage up to 26 V; ranges from 40 to 320 mV
INA226 / INA228I²C digital monitor16 or 20 bits; measures current, voltage and power up to 36 or 85 V
ACS712 / ACS724Hall effect sensorIsolated, no external shunt; output at half the supply with 0 A

Hall effect sensor

A Hall effect sensor measures the magnetic field created by the current flowing through an internal conductor. Its great advantage is isolation: the measuring circuit does not touch the power circuit, which makes it suitable for high-voltage batteries or the mains. In exchange it has more noise and more temperature drift than a good shunt and is sensitive to nearby magnetic fields. For large AC currents, current transformers are also used, without contact with the conductor.

Related: ADC and DAC conversion, Ohm's law, PWM calculator and 24 V inputs to a microcontroller.