The Current Sensor is an ACS712 Hall-effect module that turns the current through your load into an analog voltage, in 5A, 20A and 30A ranges.
It reads current in both directions and works with an Arduino analog input. With a simple resistor divider it also works with ESP32 and Raspberry Pi Pico boards.
Why choose it
- Three ranges, one wiring — the 5A, 20A and 30A options (ACS712ELC-05B, -20A, -30A) all use the same three pins, so you can swap ranges without rewiring.
- Measures both directions — the output sits at VCC/2 at 0 A and moves up or down with current direction.
- Isolated sensing path — the ACS712 datasheet lists 2.1 kV RMS isolation between the current terminals and the low-voltage side, and a 1.2 mΩ typical conductor resistance.
Specifications
| Core | |
|---|---|
| Sensor IC | ACS712ELC-05B (5A), ACS712ELC-20A (20A), ACS712ELC-30A (30A) |
| Sensing principle | Hall effect |
| Output | Analog voltage on OUT |
| Zero-current output | VCC × 0.5 (2.5 V at 5 V supply) |
| Bandwidth (−3 dB) | 80 kHz typical |
| Total output error | ±1.5 % typical (at 25 °C, full range) |
| Range and sensitivity | |
| 5A option | ±5 A, 185 mV/A typical |
| 20A option | ±20 A, 100 mV/A typical |
| 30A option | ±30 A, 66 mV/A typical |
| Power | |
| Supply voltage | 5 V (4.5–5.5 V) |
| Supply current (IC) | 10 mA typical, 13 mA maximum |
| Safety and environment | |
| Isolation (ACS712 IC) | 2.1 kV RMS minimum |
| Internal conductor resistance | 1.2 mΩ typical |
| Operating temperature (IC) | −40 °C to 85 °C |
| Physical | |
| PCB size (5A module) | 31 × 13 mm |
Compatibility
| Platform | Works | Notes |
|---|---|---|
| Arduino UNO / Nano (5 V) | ✓ Yes | Connect OUT straight to an analog pin such as A0 |
| ESP32 (3.3 V) | ◐ With divider | Use a 10 kΩ / 20 kΩ divider on OUT. Read on an ADC1 pin such as GPIO34 |
| Raspberry Pi Pico (3.3 V) | ◐ With divider | Use a 10 kΩ / 20 kΩ divider on OUT. Read on GP26–GP28 |
| Raspberry Pi (40-pin) | ◐ With ADC | No analog inputs. Add an external ADC and keep its input at or below 3.3 V |
| Software | ✓ Yes | Arduino IDE (analogRead) or MicroPython (machine.ADC). No library needed |
In the box
- 1 × Current Sensor module (5A, 20A or 30A, as selected)
Options
| Option | What is different | Choose it when |
|---|---|---|
| 5A | ACS712ELC-05B, ±5 A, 185 mV/A. Output swings about 1.6–3.4 V at 5 V supply | Your load draws up to 5 A and you want the finest resolution |
| 20A | ACS712ELC-20A, ±20 A, 100 mV/A. Output swings about 0.5–4.5 V | Your load draws more than 5 A, up to 20 A |
| 30A | ACS712ELC-30A, ±30 A, 66 mV/A. Output swings about 0.5–4.5 V | Your load draws more than 20 A, up to 30 A |
Applications
- Measuring the current of a DC motor or fan
- Battery and solar charge monitoring on DC circuits
- Over-current detection for small power supplies
Tutorial
What you'll build: Read the current flowing through a DC load and print it in amps every second. About 20 minutes.
Choose your board
| Board | Logic voltage | Pins used | Language | Best for |
|---|---|---|---|---|
| Arduino UNO | 5 V | A0 | C++ (Arduino IDE) | First-timers: no extra parts |
| ESP32 | 3.3 V | GPIO34 | C++ (Arduino IDE) | Wi-Fi projects: needs a 2-resistor divider |
New to this? Start with the Arduino UNO.
How it works
The module passes your load current through a thin copper path inside the ACS712 chip. The chip senses the magnetic field that current makes (the Hall effect) and turns it into a voltage on the OUT pin. With no current, OUT sits at half the supply voltage, about 2.5 V. Current in one direction raises it, current in the other direction lowers it.
- GND — the return path. Every GND must be joined.
- Sensitivity — volts of change per amp: 0.185 V/A (5A), 0.100 V/A (20A), 0.066 V/A (30A).
- Voltage divider — two resistors that scale a voltage down. 10 kΩ and 20 kΩ give two-thirds, so 4.5 V becomes 3.0 V, which 3.3 V boards can read.
You need: Arduino UNO R3, USB data cable, 3 jumper wires, a 5–12 V DC load with its own power supply.
■ Power (5 V) ■ GND ■ Analog signal ⌒ = wires cross, not connected
| # | Board pin | Module pin | Wire | Notes |
|---|---|---|---|---|
| 1 | 5V | VCC | Red | Power for the sensor chip |
| 2 | A0 | OUT | Yellow | Analog output, about 2.5 V with no current |
| 3 | GND | GND | Black | Return path |
Check the pin labels printed on your module and plug in by name, not by position.
Watch out: Unplug the USB cable before you move any wire. Never connect mains (230 V AC) to this module in this tutorial.
Download and install the Arduino IDE. No extra library is needed.
Connect the three wires from the table. Then wire the load through the module’s current terminals. Put the load in series: one wire from your DC supply (+) goes into one current terminal, the other terminal goes to the load, and the load returns to the supply (−). Use a 5–12 V DC load such as a small motor or LED strip, and stay inside the range of your option.
Plug in the UNO. In the IDE choose Tools → Board → Arduino AVR Boards → Arduino Uno, then Tools → Port and pick the UNO. If no port appears, use a data USB cable and install the USB driver for your board.
Paste the sketch below, set
SENSITIVITY for your option (5A = 0.185, 20A = 0.100, 30A = 0.066), then press Upload.▸ Example 1 — Read the current and print it
// Wiring: VCC->5V, OUT->A0, GND->GND (see the pin table)
const int SENSOR_PIN = A0;
const float SENSITIVITY = 0.185; // V per amp: 5A = 0.185, 20A = 0.100, 30A = 0.066 // you can change this
const float VREF = 5.0; // UNO analog reference (5 V when powered by USB)
float offsetV = 2.5; // zero-current voltage, measured at start-up
float readVolts() {
long sum = 0;
for (int i = 0; i < 200; i++) sum += analogRead(SENSOR_PIN); // average 200 readings
return (sum / 200.0) * VREF / 1023.0;
}
void setup() {
Serial.begin(115200);
Serial.println("OK - epartners.co.nz test");
Serial.println("Keep the load OFF. Measuring the zero-current voltage...");
delay(1000);
offsetV = readVolts();
Serial.print("Zero-current voltage: ");
Serial.print(offsetV, 3);
Serial.println(" V (about 2.5 V is normal)");
if (offsetV < 2.2 || offsetV > 2.8) {
Serial.println("Current sensor not found - check wiring");
while (true) {} // stop here
}
Serial.println("Now switch the load on.");
}
void loop() {
float v = readVolts();
float amps = (v - offsetV) / SENSITIVITY;
Serial.print("Output: ");
Serial.print(v, 3);
Serial.print(" V Current: ");
Serial.print(amps, 2);
Serial.println(" A");
delay(1000); // one reading per second // you can change this
}
Tools → Serial Monitor, then set 115200 baud. Keep the load switched off until you see the zero-current voltage, then switch the load on.
✓ Check: The Serial Monitor prints OK - epartners.co.nz test once, then a zero-current voltage of about 2.5 V, then a new reading every second. With the load on, the current changes from 0 A.
You need: ESP32 DevKitC (ESP32-WROOM-32), USB data cable, 1 × 10 kΩ and 1 × 20 kΩ resistor, jumper wires, a 5–12 V DC load with its own power supply.
■ Power (5 V) ■ GND ■ Analog signal ⌒ = wires cross, not connected
| # | Board pin | Module pin | Wire | Notes |
|---|---|---|---|---|
| 1 | 5V (VIN) | VCC | Red | The module needs 5 V. The pin gives 5 V when the board is powered by USB |
| 2 | GPIO34 | OUT, through the divider | Yellow | OUT → R1 10 kΩ → GPIO34. R2 20 kΩ from GPIO34 to GND. GPIO34 is an ADC1 input-only pin |
| 3 | GND | GND and R2 bottom | Black | Join all GND points |
Check the pin labels printed on your module.
Watch out: ESP32 pins are 3.3 V only. The module output can reach about 4.5 V on the 20A and 30A options, so never connect OUT straight to a GPIO. Use the divider. Unplug USB before changing wires, and never connect mains to this module.
Download and install the Arduino IDE.
Open File → Preferences and paste
https://espressif.github.io/arduino-esp32/package_esp32_index.json into “Additional boards manager URLs”. Then Tools → Board → Boards Manager, search “esp32” and install esp32 by Espressif Systems (install guide).Build the divider first (R1 10 kΩ from OUT to GPIO34, R2 20 kΩ from GPIO34 to GND), then connect the other wires. Put the load in series: one wire from your DC supply (+) goes into one current terminal, the other terminal goes to the load, and the load returns to the supply (−). Use a 5–12 V DC load such as a small motor or LED strip, and stay inside the range of your option.
Tools → Board → esp32 → ESP32 Dev Module, then Tools → Port. If no port appears, use a data USB cable and install the USB driver for your board.
Paste the sketch, set
SENSITIVITY for your option, and press Upload. If the upload fails, set Tools → Upload Speed → 115200 and upload again.▸ Example 1 — Read the current and print it
// Wiring: VCC->5V (VIN), OUT->10k->GPIO34 (20k to GND), GND->GND (see the pin table)
const int SENSOR_PIN = 34; // ADC1 input-only pin
const float SENSITIVITY = 0.185; // V per amp: 5A = 0.185, 20A = 0.100, 30A = 0.066 // you can change this
const float DIVIDER = 1.5; // (10k + 20k) / 20k, turns the GPIO voltage back into the module voltage
float offsetV = 2.5; // zero-current voltage, measured at start-up
float readVolts() {
long sumMv = 0;
for (int i = 0; i < 200; i++) sumMv += analogReadMilliVolts(SENSOR_PIN); // average 200 readings
return (sumMv / 200.0 / 1000.0) * DIVIDER;
}
void setup() {
Serial.begin(115200);
Serial.println("OK - epartners.co.nz test");
Serial.println("Keep the load OFF. Measuring the zero-current voltage...");
delay(1000);
offsetV = readVolts();
Serial.print("Zero-current voltage: ");
Serial.print(offsetV, 3);
Serial.println(" V (about 2.5 V is normal)");
if (offsetV < 2.2 || offsetV > 2.8) {
Serial.println("Current sensor not found - check wiring");
while (true) { delay(1000); } // stop here
}
Serial.println("Now switch the load on.");
}
void loop() {
float v = readVolts();
float amps = (v - offsetV) / SENSITIVITY;
Serial.print("Output: ");
Serial.print(v, 3);
Serial.print(" V Current: ");
Serial.print(amps, 2);
Serial.println(" A");
delay(1000); // one reading per second // you can change this
}
Tools → Serial Monitor at 115200 baud. Keep the load off until the zero-current voltage appears, then switch it on.
✓ Check: The Serial Monitor prints OK - epartners.co.nz test once, a zero-current voltage of about 2.5 V, then a reading every second.
Troubleshooting
| Board | Problem | Likely cause | Fix |
|---|---|---|---|
| All | Zero-current voltage is not about 2.5 V | VCC is not 5 V, or the load is already on | Power the module from 5 V, and switch the load off during start-up. |
| All | Reading is always 0.00 A | The load is not in series with the current terminals | Wire the load so all the current passes through the module. |
| All | Readings jump around by a few tenths of an amp | Noise on the analog output | Keep the signal wire short and away from motor wires. Averaging more samples helps. |
| All | Current shows the wrong size | Wrong SENSITIVITY for your option | Use 0.185 (5A), 0.100 (20A) or 0.066 (30A). |
| All | Current is negative | Current flows the other way | Swap the two load wires at the terminals. |
| ESP32 | Stuck on “Connecting…” | Board not in upload mode | Hold the BOOT button until uploading starts. |
| ESP32 | Upload fails or stops part-way | Upload speed too high for the USB cable | Tools → Upload Speed → 115200, then upload again. |
| ESP32 | No serial port | Charge-only cable or missing USB driver | Use a data USB cable and install the USB driver for your board. |
Try next: Switch on a buzzer or LED when the current goes above a limit you choose, or log the current for a day to see when your load runs.
Spotted a problem in this tutorial? Email support@epartners.co.nz and we'll check it and update the tutorial.
- Mains voltage (230 V AC) can kill. Switch off and unplug before wiring, keep the board inside an insulated enclosure, and have any fixed wiring done by a licensed electrician. The tutorial above uses low-voltage DC loads only.
- Choose the option that matches your load. Going over the rated current can damage the module.
- The output is analog, so a 3.3 V board such as an ESP32 or Raspberry Pi Pico needs a voltage divider on OUT.
- Each reading has a small offset. Measure the zero-current voltage at start-up, as the tutorial sketches do.
Video guide
Datasheet
Key figures from the manufacturer's datasheet for the ACS712, the current sensor chip on this module.
| ACS712 Hall-effect current sensor IC | |
|---|---|
| Sensor IC | ACS712ELC-05B / -20A / -30A (8-lead SOIC) |
| Supply voltage | 4.5–5.5 V (5.0 V typical), absolute maximum 8 V |
| Supply current | 10 mA typical, 13 mA maximum |
| Sensitivity | 185 mV/A (5A), 100 mV/A (20A), 66 mV/A (30A), typical |
| Zero-current output | VCC × 0.5 (2.5 V at 5 V) |
| Bandwidth (−3 dB) | 80 kHz typical |
| Output rise time | 3.5 µs typical (no filter capacitor) |
| Internal conductor resistance | 1.2 mΩ typical |
| Total output error | ±1.5 % typical at 25 °C |
| Isolation | 2.1 kV RMS minimum |
| Operating temperature | −40 °C to 85 °C |
| Output load | 4.7 kΩ minimum, 10 nF maximum |
Download the ACS712 datasheet (PDF)
▸ Preview the datasheet
If the preview does not load on your device, use the download link above.
Source: Allegro MicroSystems, ACS712 datasheet, document ACS712-DS, Rev. 21.
Resources
FAQ
▸ Can I measure AC current with this module?
Yes, the ACS712 senses both directions, so AC current produces a swinging output. You must sample fast and calculate RMS in code. Do not connect mains (230 V AC) unless a licensed electrician does the wiring.
▸ Which option should I buy: 5A, 20A or 30A?
Choose the option whose range is above your load’s maximum current. The 5A option gives the highest sensitivity (185 mV/A), so it resolves small currents best.
▸ Can I use it with an ESP32 or Raspberry Pi Pico?
Yes, but add a voltage divider on OUT. The module runs at 5 V and its output can reach about 4.5 V, while these boards accept 3.3 V on their pins.
▸ Why does it read about 2.5 V with no current?
The ACS712 output is centred at half the supply voltage so it can show current in both directions. Subtract that zero-current voltage, then divide by the sensitivity to get amps.
Technical question about this part? Email support@epartners.co.nz with your board and wiring, and we'll help you get it working.
Shipping: $5.99 urban, $9.99 rural. Free shipping on orders of $100 or more.
Order by 10:30am (NZT), Monday to Friday, and we dispatch the same day. Orders placed after 10:30am, on weekends or on public holidays are dispatched the next business day.
Delivery usually takes 1–2 business days after dispatch (2–3 for rural addresses). See our Shipping Policy for full details.