Shunt resistor, amplifier, resolution and comparison with a Hall effect sensor
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.
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:
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 | High side | |
|---|---|---|
| Where it goes | Between the load and ground | Between the supply and the load |
| Amplifier | Simple: a non-inverting op amp is enough | Needs a current sense amplifier that withstands the supply voltage at its inputs |
| Load ground | Shifted by the shunt drop | Unchanged |
| Detects a short to ground | No: that current does not flow through the shunt | Yes |
| Also measures voltage | No | Yes, 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.
| IC | Type | Notes |
|---|---|---|
| INA180 / INA181 | Current sense amplifier | Gains of 20, 50, 100 and 200 (versions A1 to A4). The INA181 supports bidirectional current |
| INA240 | Current sense amplifier | Common mode from −4 to 80 V and strong rejection of PWM switching |
| INA219 | I²C digital monitor | Measures current and voltage up to 26 V; ranges from 40 to 320 mV |
| INA226 / INA228 | I²C digital monitor | 16 or 20 bits; measures current, voltage and power up to 36 or 85 V |
| ACS712 / ACS724 | Hall effect sensor | Isolated, no external shunt; output at half the supply with 0 A |
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.