The output of sensor ICs like the Allegro ACS712 is a ratiometric analog voltage, not a digital data stream. At zero current, the module outputs exactly half of its supply voltage (VCC/2). For a standard 5.0V supply, this zero-point offset is 2.5V. As current flows through the internal copper conductor, the voltage shifts linearly: it increases above 2.5V for current flowing in one direction, and drops below 2.5V for reverse current. To get physical Amps, you must read the microcontroller's ADC, convert that raw integer to a voltage, subtract the VCC/2 offset, and divide by the specific sensitivity rating of your module (e.g., 66mV/A for the 30A variant).
The Hall Effect Sensing Principle
The ACS712 relies on the Hall effect to measure current without introducing significant shunt resistance into your load path. Current flows through a low-resistance internal copper conduction path, generating a proportional magnetic field. A precision Hall-effect transducer located adjacent to this path measures the magnetic flux density and converts it into a proportional analog voltage.
Because the current-carrying path is electrically isolated from the sensor's signal pins, the ACS712 provides galvanic isolation up to 2.1 kVRMS. This makes it vastly safer for measuring mains AC currents or high-side DC loads compared to low-side shunt resistors, which tie your microcontroller's ground directly to the high-current return path.
Wiring and Power Supply Requirements
Because the output is ratiometric, the stability of your power supply directly dictates the accuracy of your readings. If VCC sags, the zero-offset shifts, and your microcontroller will read phantom current. Always power the module from a clean, regulated supply.
| Pin | Function | Specifications & Notes |
|---|---|---|
| VCC | Power Supply | 4.5V to 5.5V nominal. Must be low-noise. 5.0V is standard for 5V Arduinos. |
| GND | Ground Reference | Must share a common ground with the microcontroller's ADC ground. |
| OUT | Analog Output | Ratiometric analog voltage. VCC/2 at 0A. Connect to ADC pin (e.g., A0). |
| IP+ / IP- | Load Terminals | Screw terminals for the measured current path. Polarity dictates output direction. |
Translating the Output of Sensor: Raw ADC to Amps
The raw ADC value from an Arduino Uno (10-bit, 0-1023) or ESP32 (12-bit, 0-4095) is useless on its own. You must apply a two-step mathematical conversion. Below is the exact math for the 30A variant (66mV/A sensitivity) running on a 5V Arduino Uno.
Voltage = ADC_Raw * (VCC / 1023.0)Step 2: Convert Voltage to Amps
Current = (Voltage - (VCC / 2.0)) / SensitivityWhere Sensitivity = 0.066 (for the 30A model)
Here is a production-ready C++ snippet for Arduino that implements this math, includes a moving average filter to smooth out ADC jitter, and accounts for real-world VCC variations:
// Pin and hardware definitions
const int SENSOR_PIN = A0;
const float VCC = 5.0; // Update this to your multimeter reading!
const float SENSITIVITY = 0.066; // 66mV/A for ACS712-30A
const int SAMPLE_COUNT = 50; // Moving average window
float readCurrent() {
long adcSum = 0;
for (int i = 0; i < SAMPLE_COUNT; i++) {
adcSum += analogRead(SENSOR_PIN);
delayMicroseconds(200); // Allow ADC to settle
}
float adcAvg = adcSum / (float)SAMPLE_COUNT;
// Math: Raw ADC -> Voltage -> Amps
float voltage = adcAvg * (VCC / 1023.0);
float offset = VCC / 2.0;
float current = (voltage - offset) / SENSITIVITY;
return current;
}
Calibration and Interference Mitigation
If you blindly assume VCC = 5.0, your readings will drift. USB power from a PC often sags to 4.7V under load. Calibration requires measuring the actual VCC at the module's pins with a digital multimeter (DMM) while the circuit is powered, then hardcoding that exact value (e.g., 4.82) into your firmware. Furthermore, measure the OUT pin with zero load. If your DMM reads 2.43V instead of 2.41V, use 2.43V as your hardcoded offset to eliminate zero-point error.
The Hall effect makes the ACS712 highly susceptible to external magnetic fields. Mounting the module within 2 inches of a power transformer, a large DC motor, or even a coiled AC extension cord will induce massive phantom readings. Keep the sensor away from magnetic sources. Additionally, switching power supplies introduce high-frequency ripple onto the VCC rail; place a 100nF ceramic capacitor and a 10µF electrolytic capacitor directly across the VCC and GND pins on the module to filter this noise.
Frequently Asked Questions
Why is the output of sensor fluctuating when no load is connected?
This fluctuation is almost always caused by ADC quantization noise, VCC rail ripple, or electromagnetic interference (EMI). A 10-bit ADC on a 5V scale has a resolution of roughly 4.88mV per step. Since the 30A ACS712 has a sensitivity of 66mV/A, a single step of ADC jitter equates to ~74mA of apparent current swing. To fix this, implement a software moving-average filter (as shown in the code above) or add an RC low-pass hardware filter (e.g., 1kΩ resistor and 1µF capacitor) between the OUT pin and the microcontroller's ADC pin.
Can I read the output of sensor directly with a 3.3V ESP32 GPIO?
No, not without modification. The ACS712 is designed for a 5V supply, meaning its zero-offset is 2.5V and its maximum swing can reach 5V. Feeding a 5V analog signal into a 3.3V ESP32 GPIO will damage the ESP32's ADC circuitry. You cannot simply use a voltage divider, because a divider destroys the ratiometric nature of the signal (if VCC fluctuates, the divider ratio remains fixed, introducing calculation errors). The correct approach is to power the ACS712 module directly from a clean 3.3V LDO regulator. The IC itself operates down to 4.5V natively, but many cheap breakout modules have an onboard LDO and op-amp that will function at 3.3V, shifting the zero-offset to 1.65V, making it safe for the ESP32.
What exactly is the output of sensor: digital data or analog voltage?
The output of sensor ICs in the ACS712 family is strictly a continuous analog voltage. It does not use I2C, SPI, or UART protocols, and it does not output digital pulses. The microcontroller must use its internal Analog-to-Digital Converter (ADC) to sample the voltage level. If you require a purely digital output without relying on the microcontroller's ADC, you should look into dedicated digital current monitors like the INA219 (which uses I2C) instead.






