As an Amazon Associate we earn from qualifying purchases.
The ACS712 is a small Hall-effect sensor that measures electric current and outputs a voltage you can read with a microcontroller. It works for both AC and DC, and it keeps the measured circuit electrically separate from your logic circuit. That makes it a common choice for power monitors, motor protection, battery projects and load detection.
This guide covers how the ACS712 works, which version to buy, how to wire it, how to turn readings into amps, and what to watch out for.
How the ACS712 works
Current flows through a copper conductor inside the chip. That current creates a magnetic field, and a Hall sensor next to the conductor turns the field into a proportional voltage. Because the sensor reads the field rather than tapping into the circuit, the load side and the signal side stay isolated.
With the chip powered from 5 V, the output sits at about half the supply voltage (roughly 2.5 V) when no current flows. Current in one direction pushes the output above that level, and current in the other direction pulls it below. This is how one sensor can read AC, where the current swings both ways.
Choosing the right version
The ACS712 comes in three ranges. The range sets how much the output voltage changes per amp, which is the sensitivity.
- ACS712-05B: ±5 A, about 185 mV per amp.
- ACS712-20A: ±20 A, about 100 mV per amp.
- ACS712-30A: ±30 A, about 66 mV per amp.
Pick the smallest range that safely covers your maximum current. A 5 A version gives finer resolution for small loads such as LED strips or small pumps, but it can be damaged by currents well above its rating. For a first project, a ready-made 5A AC/DC current sensing module is the easiest way to start, because the chip is already on a board with screw terminals.
Module pins and connections
Most breakout boards have two sets of connections.
Signal side
- VCC: 5 V supply.
- GND: ground, shared with your microcontroller.
- OUT: analog output to an analog input pin.
Load side
Two screw terminals carry the current you want to measure. Connect them in series with the load, just as you would place an ammeter. Never connect the terminals across a power source, because that creates a short circuit through the sensor.
Wiring the ACS712 to an Arduino
- Connect the module VCC to the Arduino 5 V pin and GND to GND.
- Connect OUT to an analog input such as A0.
- Break one wire of the load circuit and route it through the two screw terminals.
- Power the Arduino over USB and the load from its own supply.
If you have used other simple analog or digital modules, such as the HC-SR04 ultrasonic sensor, the signal wiring will feel familiar. The main difference is that the load side may carry real power, so take more care.
A note on 3.3 V boards: the ACS712 needs a 5 V supply, and its output can reach close to 5 V. Boards such as the ESP32 have 3.3 V analog inputs, so you need a voltage divider on the output to avoid damaging the pin.
Turning readings into amps
An Arduino Uno has a 10-bit analog-to-digital converter, so it returns values from 0 to 1023 for 0 to 5 V. Each step is about 4.88 mV. The conversion has three steps:
- Convert the reading to voltage: voltage = reading × 5.0 / 1023.
- Subtract the zero-current offset, which is about 2.5 V.
- Divide by the sensitivity for your version: current = (voltage − 2.5) / 0.185 for the 5 A model.
For the 20 A and 30 A models, use 0.100 and 0.066 in the last step.
The offset is not exactly 2.5 V on every module, and it moves a little with the supply voltage. Calibrate it by reading the pin several times with no load connected, averaging the result and using that value as your zero point.
Measuring DC current
For DC, take a number of readings, average them to reduce noise, then apply the formula above. A positive or negative result tells you the direction of current flow. Averaging 50 to 100 samples usually gives a much steadier display than a single reading.
Measuring AC current
AC current swings above and below the zero point, so a single sample is meaningless. Instead, measure the RMS value:
- Sample the sensor quickly over at least one full cycle. For 50 or 60 Hz mains, a window of 100 ms or more covers several cycles.
- For each sample, subtract the calibrated offset and square the result.
- Average the squares, then take the square root.
- Divide by the sensitivity to get RMS amps.
The sensor itself responds to frequencies far above mains frequency, so the limit is usually how fast your microcontroller can sample. To estimate power for a resistive load, multiply RMS current by the mains voltage. For loads such as motors or power supplies, the real power is lower than that because of the power factor, so treat the result as apparent power.
Accuracy and common problems
- Noisy readings: add a small capacitor on the output (many modules already have one), average multiple samples, and keep wires away from switching power supplies.
- Offset drift: the zero point follows the supply voltage. A noisy or sagging 5 V rail will show up as a false current, so use a stable supply.
- Poor resolution at low current: the 20 A and 30 A versions change very little per amp. A 30 A sensor is a poor choice for measuring a few hundred milliamps.
- Magnetic interference: strong magnets or nearby high-current wires can shift the reading. Keep them clear of the sensor.
- Temperature: accuracy changes somewhat with temperature. If that matters, log it with a temperature sensor for Arduino and compare against a reference meter.
The ACS712 suits hobby monitoring and rough protection limits. For billing-grade or safety-critical measurements, use a certified energy meter instead.
Safety when measuring mains current
Measuring mains AC means working with lethal voltages. Use an enclosure that covers all exposed terminals, make secure connections, and never touch a circuit while it is energized. Fuse the circuit and unplug it before changing the wiring. If you are not confident working with mains, practice on low-voltage DC loads first, or use a clamp-style sensor that does not require cutting a wire.
Some small projects also use a capacitive power supply to run low-power electronics from mains. These are not isolated from the line, so keep that in mind if you combine them with a sensor and a microcontroller.
Typical uses
- Monitoring how much current a motor draws, to detect stalls or overloads.
- Detecting whether an appliance is on or off.
- Tracking battery charge and discharge current.
- Building a simple home energy monitor.
- Overcurrent protection that triggers a relay.
FAQ
Can the ACS712 measure both AC and DC?
Yes. It outputs a voltage that follows the current in either direction. For DC you read the voltage directly, and for AC you calculate the RMS value from many fast samples.
Why does my ACS712 show a current with nothing connected?
The zero-current output is about half the supply voltage, and it varies from module to module. Measure it with no load and use that value as your offset instead of assuming exactly 2.5 V.
Which ACS712 version should I buy?
Choose the lowest range that safely covers your highest expected current. The 5 A version gives the best resolution for small loads, while the 20 A and 30 A versions suit heavier loads.
Can I use the ACS712 with a 3.3 V microcontroller?
Power the sensor from 5 V and use a voltage divider to bring the output within the 3.3 V input limit of the board. Without that, the output could damage the analog pin.