How Current Sensors Actually Work
Current sensors measure the flow of electrical charge by converting magnetic fields or voltage drops into readable signals. The two dominant physical principles in embedded systems are the Hall effect (where a magnetic field generated by current deflects electrons in a semiconductor, creating a proportional transverse voltage) and Ohmic shunting (measuring the microscopic voltage drop across a known, ultra-low resistance precision resistor).
A third method, current transformers (CTs), relies on Faraday’s law of induction, using alternating magnetic flux to induce a proportional secondary current in a wound coil. While shunts and Hall sensors handle both AC and DC, CTs are strictly for AC. Understanding which physical principle your project requires dictates everything from your wiring topology to your microcontroller's ADC resolution needs.
The Big Three: Hall Effect, Shunt, and Current Transformers
Conflating digital and analog outputs is the most common mistake when buying current sensors. A Hall effect module outputs a raw analog voltage, requiring your microcontroller's ADC to do the heavy lifting. A shunt monitor typically contains an internal ADC and digital interface (I2C), outputting a calculated register value. Current transformers output an AC current that must be converted to voltage via a burden resistor before sampling.
| Sensor Type | Common Part | Output Type | AC/DC | Galvanic Isolation | Typical Cost |
|---|---|---|---|---|---|
| Hall Effect | ACS712 / ACS724 | Analog Voltage | Both | Yes (2.1kV) | $4 - $8 |
| Shunt Monitor | INA219 / INA226 | Digital (I2C) | Both | No (Common Mode limits) | $6 - $12 |
| Current Transformer | SCT-013 | Analog AC Voltage | AC Only | Yes (Plastic Shell) | $10 - $15 |
Wiring, Pinouts, and Supply Ranges
Powering these sensors incorrectly will fry your microcontroller or yield garbage data. The ACS712 is ratiometric, meaning its zero-current baseline scales with VCC; it must be powered from a clean 5V rail. The INA219 logic level is tolerant of 3.3V, but it measures high-side voltage independently of its logic supply.
| Module | VCC Logic Range | Max Common Mode / Load Voltage | Data Pins | Interface |
|---|---|---|---|---|
| ACS712-20A | 4.5V - 5.5V | ~36V (Terminals) | OUT (Analog) | Analog Voltage |
| INA219 | 3.0V - 5.5V | 26V Absolute Max | SDA, SCL | I2C (Up to 3.4MHz) |
| INA226 | 2.7V - 5.5V | 36V Absolute Max | SDA, SCL | I2C |
| SCT-013-030 | N/A (Passive) | 600V AC (Mains) | Tip, Sleeve | Analog AC (w/ Burden) |
Raw ADC to Amps: The Output Signal Math
Getting the physical unit (Amps) from the raw sensor reading requires specific scaling math. Here is how to translate the output for the two most common architectures.
1. Hall Effect (ACS712-20A) Analog Math
The ACS712-20A has a sensitivity of 100mV/A. At 0A, it outputs exactly half of VCC (2.5V on a 5V supply). The formula to find current is:
I = (V_out - V_offset) / Sensitivity
For a standard 10-bit Arduino ADC (0-1023) referenced to 5V:
V_out = (ADC_Raw / 1023.0) * 5.0I = (V_out - 2.5) / 0.100
2. Digital Shunt (INA219 / INA226) Math
Digital shunts bypass the microcontroller's ADC entirely. The sensor's internal delta-sigma ADC measures the voltage drop across the onboard shunt resistor (typically 0.1Ω for the INA219). According to the Adafruit INA219 Hookup Guide, the math is handled by the library, but the underlying physics is:
Current = Shunt_Voltage_Register / R_shunt
If the library returns a shunt voltage of 15mV (0.015V) across a 0.1Ω resistor, the current is exactly 0.15A (150mA). Calibration in code simply involves telling the library the shunt value and expected max current so it can configure the internal programmable gain amplifier (PGA) bits.
3. Current Transformer (SCT-013) AC Math
The SCT-013-030 outputs 1V AC at 30A. Because microcontrollers cannot read negative voltages, you must bias the signal to a 1.65V DC midpoint using two equal resistors (e.g., 10kΩ) from 3.3V to GND. To calculate RMS current, you must sample the AC wave at high frequency (e.g., 2kHz), subtract the 1.65V DC bias, square the samples, average them, and take the square root (True RMS).
Interference, Noise, and Calibration Pitfalls
Current sensors are highly susceptible to environmental noise. Failing to account for these interference sources will result in jittery readings and phantom current draws.
- Hall Effect Magnetic Interference: The ACS712 measures magnetic fields. If you mount it within 2 inches of a neodymium magnet, a switching buck converter inductor, or a mains transformer, the external flux will inject massive DC offsets into your reading. Keep Hall sensors at least 5cm away from inductive components.
- Shunt Common-Mode Noise: Shunt monitors like the INA219 share a ground reference with your load. If your load is a high-PWM motor driver, the ground bounce and switching spikes will couple into the shunt's measurement traces. Use twisted pair wiring for the shunt connections and place a 100nF decoupling capacitor directly across the sensor's VCC and GND pins.
- CT Core Saturation and Burden Drift: Current transformers will permanently lose calibration if subjected to a massive DC fault current or severe over-current, which saturates the ferrite core. Furthermore, the internal burden resistor on cheap SCT-013 clones drifts with temperature. For precision AC metering, buy an SCT-013 without an internal burden (e.g., SCT-013-000) and wire your own 1% tolerance metal film burden resistor on the PCB.
The Decision Tree: Pick Your Exact Sensor Part
Stop guessing. Follow this decision path to select the exact part number for your workbench.
| Your Application Scenario | Required Specs | Concrete Part Pick |
|---|---|---|
| DC Battery/Solar Monitor (12V or 24V) Need high precision, low current draw, and I2C digital output. |
Max 36V common mode, 15-bit ADC, I2C. | INA226 Breakout (Adafruit PID 4226 or equivalent) |
| Low-Voltage DC Motor/Robotics (5V - 12V) Need bidirectional current sensing to measure regenerative braking or stall current. |
Bidirectional analog, fast response, < 26V. | ACS724 (20A Bidirectional) (Pololu #4042 or SparkFun) |
| AC Mains Power Metering (120V/240V) Need non-invasive, safe isolation from lethal grid voltage. |
AC only, split-core, 30A-100A range. | SCT-013-030 (30A/1V) or SCT-016 (120A/40mA) |
The Default Recommendations
If you are building a standard DC power monitor for a solar charge controller, LiFePO4 battery pack, or robotics chassis, buy the INA226. It costs roughly $10, eliminates the ESP32 ADC non-linearity headache entirely by using digital I2C, and safely survives 24V battery charging spikes.
If you are clamping onto an AC mains wire to build a home energy monitor (like an ESPHome CT clamp node), buy the SCT-013-030 paired with an ADS1115 external ADC. This combination provides the galvanic isolation required for mains safety and the 16-bit resolution needed to accurately resolve the AC waveform's zero-crossings and low-power standby draws.






