The ACS712 current sensor measures both AC and DC current flowing through a wire and outputs a proportional analogue voltage that Arduino can read directly. Available in 5A, 20A, and 30A variants, it’s used in solar panel monitoring, home energy meters, battery management, and appliance-level power tracking. This guide covers wiring, calibration, and practical power monitoring projects — all with components available in India for under ₹200.
How the ACS712 Works
The ACS712 uses the Hall effect to measure current non-invasively. The current-carrying conductor passes through the IC, generating a magnetic field proportional to the current. A Hall sensor inside the chip converts this magnetic field to a voltage output.
At zero current, the output is VCC/2 (approximately 2.5V at 5V supply). Positive current increases the output above 2.5V, and negative current decreases it below 2.5V. The sensitivity (mV per amp) depends on the variant.
Key Specifications
| Parameter | ACS712-5A | ACS712-20A | ACS712-30A |
|---|---|---|---|
| Current Range | ±5A | ±20A | ±30A |
| Sensitivity | 185 mV/A | 100 mV/A | 66 mV/A |
| Resolution (10-bit ADC) | ~26 mA | ~49 mA | ~74 mA |
| Zero Current Output | ~2.5V | ~2.5V | ~2.5V |
| Best For | USB, small DC loads | Most applications | High-power loads |
Choosing the Right Variant
- ACS712-5A (185 mV/A) — Highest sensitivity, best for measuring small DC currents (USB devices, LED strips, Arduino projects). Can resolve about 26 mA per ADC step.
- ACS712-20A (100 mV/A) — The general-purpose choice. Covers household appliances like fans (0.5-1.5A), lights (0.1-2A), and chargers. Most commonly used variant.
- ACS712-30A (66 mV/A) — For heavier loads like geysers, air coolers, or e-bike motors. Lower resolution but higher headroom.
Rule of thumb: Choose the smallest range that covers your maximum expected current. Higher sensitivity = better measurement resolution.
Wiring to Arduino
The ACS712 module has 3 output pins (VCC, GND, OUT) and 2 screw terminals for the current-carrying wire. The load wire passes through the screw terminals — the module is wired in series with the load.
| ACS712 Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| OUT | A0 |
Safety warning: If you’re measuring AC mains current (220V in India), the current-carrying terminals are at mains potential. Use proper insulation, keep fingers away when powered, and enclose the module in a project box. Work with low voltage DC during development, then switch to mains only in a properly enclosed installation.
DC Current Measurement
const int sensorPin = A0;
const float SENSITIVITY = 0.100; // 100mV/A for 20A variant
const float ZERO_CURRENT_VOLTAGE = 2.50; // Calibrate this!
void setup() {
Serial.begin(9600);
Serial.println("ACS712 DC Current Sensor");
// Calibrate zero point (no load connected)
Serial.println("Calibrating zero point...");
float sum = 0;
for (int i = 0; i < 100; i++) {
sum += analogRead(sensorPin) * (5.0 / 1024.0);
delay(10);
}
float zeroVoltage = sum / 100.0;
Serial.print("Zero voltage: ");
Serial.println(zeroVoltage, 3);
}
void loop() {
// Average 100 readings for stable result
float sum = 0;
for (int i = 0; i < 100; i++) {
sum += analogRead(sensorPin);
delay(1);
}
float avgRaw = sum / 100.0;
float voltage = avgRaw * (5.0 / 1024.0);
float current = (voltage - ZERO_CURRENT_VOLTAGE) / SENSITIVITY;
Serial.print("Voltage: ");
Serial.print(voltage, 3);
Serial.print("V | Current: ");
Serial.print(current, 3);
Serial.println(" A");
delay(500);
}
AC Current Measurement
Measuring AC current requires a different approach. The current alternates at 50 Hz (India’s mains frequency), so the ACS712 output swings above and below the 2.5V midpoint 50 times per second. You need to sample rapidly and calculate the RMS (Root Mean Square) value to get the true AC current.
const int sensorPin = A0;
const float SENSITIVITY = 0.100; // 20A variant
const int SAMPLES = 1000;
const float MIDPOINT = 2.50; // Calibrate with no load
void setup() {
Serial.begin(9600);
}
void loop() {
float sumSquares = 0;
for (int i = 0; i < SAMPLES; i++) {
float voltage = analogRead(sensorPin) * (5.0 / 1024.0);
float current = (voltage - MIDPOINT) / SENSITIVITY;
sumSquares += current * current;
delayMicroseconds(200); // Sample at ~5kHz (100 samples per 50Hz cycle)
}
float rmsCurrent = sqrt(sumSquares / SAMPLES);
// Calculate power (assuming 230V AC and power factor 1.0)
float power = rmsCurrent * 230.0;
Serial.print("AC Current: ");
Serial.print(rmsCurrent, 3);
Serial.print(" A | Power: ");
Serial.print(power, 1);
Serial.println(" W");
delay(1000);
}
Calculating Power Consumption
Power is current multiplied by voltage:
- DC: Power (W) = Voltage (V) × Current (A)
- AC: Power (W) = Voltage (V) × Current (A) × Power Factor
For resistive loads (heaters, incandescent bulbs), power factor is ~1.0. For inductive loads (motors, fans, transformers), power factor is typically 0.6-0.9. For capacitive loads (LED drivers, SMPS), it varies. Without a separate voltage measurement, assume a power factor of 0.85 for household loads.
For energy (kWh), integrate power over time:
Energy (Wh) = Average Power (W) × Time (hours)
Log power readings every minute to an SD card or cloud service, then sum for daily energy consumption.
Energy Monitoring Projects
1. Solar Panel Output Monitor
Measure the current output of your solar panel with the ACS712-5A. Combined with a voltage divider to read panel voltage, calculate real-time power generation. Log to ThingSpeak via ESP32 for daily generation tracking. Compare against panel ratings to identify shading or dirt issues.
2. Home Energy Monitor
Install an ACS712-30A on your main power line (requires an electrician for safety) to monitor total household power consumption. Track usage patterns — peak hours, standby drain, and monthly trends. The data helps identify energy-wasteful appliances.
3. Battery Discharge Tester
Measure the discharge current and voltage of lithium cells under load. Calculate mAh capacity by integrating current over time until the cell reaches cutoff voltage. Essential for building reliable battery packs — know exactly how much capacity each cell delivers.
4. Appliance-Level Power Tracker
Monitor individual appliance power consumption with separate ACS712 sensors on each circuit. Display on a TFT screen showing real-time watts per appliance. Useful for identifying which devices contribute most to your electricity bill — information that’s particularly valuable with India’s tiered tariff structure.
5. E-Bike Battery Monitor
Use the ACS712-30A to monitor current draw from your e-bike battery during rides. Combined with voltage measurement, calculate remaining battery capacity, instantaneous power, and energy used per trip. Display on a handlebar-mounted OLED screen.
Frequently Asked Questions
Can the ACS712 measure 220V AC mains current safely?
Yes, the ACS712 provides galvanic isolation between the high-voltage current path (screw terminals) and the low-voltage output (signal pins). The chip is rated for 2.1 kV RMS isolation. However, the module PCB’s screw terminals are at mains potential — handle with care, use proper enclosures, and never touch the module while connected to mains. An electrician should handle mains wiring.
Why is my zero-current reading not exactly 2.5V?
Manufacturing tolerances, supply voltage variations, and temperature affect the offset. Always calibrate by measuring the actual output voltage with no current flowing. Use this measured value (e.g., 2.48V or 2.52V) instead of the theoretical 2.5V in your code.
The readings are very noisy. How do I get stable values?
Take the average of 100-500 readings. Add a 100nF capacitor between the output pin and ground. Keep the sensor module away from high-current wires and switching power supplies. For AC measurement, ensure you’re sampling complete cycles (at 50 Hz, one cycle is 20 ms — sample for at least 100 ms).
Can I use the ACS712 with ESP32 (3.3V)?
The ACS712 requires 5V power to work correctly. Its output swings around 2.5V, which exceeds ESP32’s 3.3V ADC range. Solutions: (1) Use a voltage divider on the output, (2) power the module from 5V and use a level shifter, or (3) use the ACS712’s analogue output through an external ADC (ADS1115) that operates at 3.3V.
Is there a better alternative for high-accuracy power monitoring?
For dedicated power monitoring, consider the INA219 (I2C, measures both current and voltage, ±1%) or the PZEM-004T (standalone AC energy meter module with UART). The PZEM-004T directly outputs voltage, current, power, energy, frequency, and power factor — no calibration needed. It costs about ₹350-500 and is popular for home energy monitoring projects in India.
Conclusion
The ACS712 current sensor is an accessible entry point for power monitoring projects with Arduino. At under ₹100 per module, it handles both DC and AC current measurement with sufficient accuracy for solar monitoring, appliance tracking, and battery management. Calibrate the zero offset carefully, average your readings, and always prioritise safety when working with mains voltage. For higher accuracy or direct AC energy metering, consider upgrading to the INA219 or PZEM-004T.
Find ACS712 current sensors and power monitoring components at Zbotic’s sensor modules store.
Add comment