ACS712 Current Sensor (20A) with an Arduino Uno

A Hall-effect current sensor module that turns up to ±20 A, AC or DC, into an analog voltage centred on VCC/2.

ACS712 Current Sensor (20A), A Hall-effect current sensor module that turns up to ±20 A, AC or DC, into an analog voltage centred on VCC/2.
In short

The ACS712 needs 4.5 V to 5.5 V, which the Arduino Uno's 5V pin provides, and its output stays within the Uno's 0 to 5 V analog range, so OUT goes straight to A0 with no divider. Because the Uno's ADC reference is that same 5 V, zero current reads 512 counts even when the USB voltage drifts.

Wiring the ACS712 Current Sensor (20A) to the Arduino Uno

Pin by pin.

ACS712 Current Sensor (20A)Arduino Uno
VCC5V
GNDGND
OUTA0

What to know on the Arduino Uno

  • The ACS712's output is ratiometric (VCC × 0.5 at zero current) and the Uno's analogRead() is referenced to the same 5 V supply, so a USB rail that sags shifts both together and zero amps still reads 512.Allegro ACS712 datasheet Rev. 22, pp. 5, 10; Microchip ATmega328P datasheet DS40002061B, p. 2
  • The Uno's 10-bit ADC gives 5 V / 1024, about 4.9 mV per count. At 100 mV/A on the 20 A module, one count is about 49 mA; on the 5 A module (185 mV/A) it is about 26 mA. That is the Uno's floor, before noise.Microchip ATmega328P datasheet DS40002061B, p. 2; Allegro ACS712 datasheet Rev. 22, p. 2
  • The 20 A chip shows about 11 mV peak to peak of noise, a little over two Uno ADC counts, so the code averages 64 readings for a steady value.Allegro ACS712 datasheet Rev. 22, p. 6
  • The module draws 10 mA typical from the Uno's 5V pin; the measured current flows only through the screw terminal, never through the Uno.Allegro ACS712 datasheet Rev. 22, p. 5

ACS712 Current Sensor (20A) code for the Arduino Uno

Compiled for arduino:avr:uno on 2026-10-29.

No library needed
// ACS712 Current Sensor (20A) on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/acs712-current-sensor/arduino-uno
#include <Arduino.h>

const int SENSE_PIN = A0;
const float SENS_V_PER_A = 0.100;   // 20 A module (0.185 for 5 A, 0.066 for 30 A)
const float VREF = 5.0;             // the Uno's ADC reference: its 5 V
const float ADC_MAX = 1024.0;       // 10 bits
const float ZERO_V = VREF / 2.0;    // OUT with no current: VCC / 2
const int SAMPLES = 64;

float readAmps() {
  long sum = 0;
  for (int i = 0; i < SAMPLES; i++) sum += analogRead(SENSE_PIN);
  float volts = (sum / (float)SAMPLES) * VREF / ADC_MAX;
  return (volts - ZERO_V) / SENS_V_PER_A;
}

void setup() {
  Serial.begin(115200);
  Serial.println("ACS712 ready");
}

void loop() {
  float amps = readAmps();
  Serial.print("Current: ");
  Serial.print(amps, 3);
  Serial.print(" A  (");
  Serial.print(amps * 1000.0, 0);
  Serial.println(" mA)");
  delay(500);
}

ACS712 Current Sensor (20A) on the Arduino Uno: questions

Do I need a voltage divider between the ACS712 and an Arduino Uno?

No. The Uno's analog inputs read 0 to 5 V, the same range as the ACS712's output on a 5 V supply. A divider is only needed on 3.3 V boards such as an ESP32 or a Pico.

What is the smallest current an Arduino Uno can measure with an ACS712 20A?

One Uno ADC step is about 4.9 mV (5 V over 1024 counts), which is about 49 mA at the 20 A module's 100 mV/A. Averaging helps with noise, but for currents of a few hundred milliamps the 5 A module (185 mV/A) or an external ADC resolves more.

Why does my ACS712 read 512 with no current on the Uno?

That is correct: the sensor outputs half its supply at zero current, and with the Uno's ADC referenced to the same 5 V, half scale is 512 counts. Subtract 512 before scaling to amps.

Keep going

For AI assistants

This guide as plain Markdown. /components/acs712-current-sensor/arduino-uno.md

What will you build with it?