ACS712 current sensor (5 A / 20 A / 30 A)
ACS712 (5 A/20 A/30 A) pinout, mV-per-amp sensitivity, reading it on 3.3 V boards, and why a CT clamp is the safer way to measure mains current.
Community draft — report a mistake
3.3 V or 5 V? OUT sits at VCC/2 (2.5 V) at zero current and swings towards 0 or 5 V. On ESP32/Pico, scale OUT with a divider (e.g. 10 kΩ / 20 kΩ) and account for it in code.
The Allegro ACS712 measures current with a Hall-effect sensor: the current flows through a copper path inside the chip, and the output voltage moves away from VCC/2 in proportion. Modules come in 5 A, 20 A and 30 A versions — read the part number on the chip (ACS712ELCTR-05B/20A/30A).
For DC (solar panels, batteries, motors), it’s straightforward. For AC, you must sample fast and compute RMS in code.
⚠ Mains safety (230 V) — can kill. Measuring mains current means the module’s screw terminals are in series with the 230 V live wire. The chip is isolated internally, but cheap modules have tiny gaps between the mains and low-voltage tracks and exposed terminals.
- Use the module only inside a closed, non-metallic enclosure, with the mains side separated from the low-voltage side. No bare 230 V terminals anywhere you could touch.
- Have a licensed electrician wire the mains side, with an MCB (and RCCB/ELCB) on the circuit. Test everything with the circuit switched off at the MCB.
- Never touch the board, the screw terminals or your Arduino/ESP32 while mains is connected — and never connect a USB cable to your PC while the mains side is live unless the module’s isolation is the only path between them and you trust it.
- Prefer a non-invasive CT clamp (e.g. SCT-013) for mains current — it clips around one wire and never touches the conductor. Use the ACS712 for low-voltage DC projects.
Prices are indicative (Oct 2026) and vary by seller.
Pinout
| Pin | What it does |
|---|---|
VCC | 5 V supply |
OUT | Analog output: 2.5 V at 0 A, ±185 mV/A (5 A), ±100 mV/A (20 A), ±66 mV/A (30 A) |
GND | Ground |
IP+ | Current path in (screw terminal) — the measured current flows through here |
IP- | Current path out (screw terminal) |
Use it with
Common errors
Reads a few hundred mA with nothing connected
Zero-current offset drifts with temperature and supply. Measure the zero point at start-up with no load and subtract it.
Reading is noisy
It measures instantaneous current. For AC, sample over many cycles and compute RMS; average DC readings.
ESP32 numbers look wrong at high current
OUT exceeded 3.3 V or the ESP32 ADC is non-linear near its ends. Divide OUT down and calibrate against a multimeter.