The ACS724 current sensor circuit relies on the Hall effect to measure AC or DC current without introducing insertion loss or heat dissipation. When load current flows through the internal copper conduction path, it generates a localized magnetic field proportional to the charge movement. An integrated Hall transducer measures this field and translates it into a proportional analog voltage.
Unlike shunt-based sensor circuits that share a common ground with your load, this Hall effect topology provides galvanic isolation up to 2.4kV RMS. This means your microcontroller's fragile 3.3V logic is completely electrically separated from the high-current, potentially noisy load path, making it an excellent choice for motor control, battery monitoring, and solar charge tracking.
Wiring the Sensor Circuit and Pinout
The ACS724LLCTR-30AB-T is the modern, 3.3V-friendly replacement for the older 5V ACS712. It handles up to 30A bidirectional current. Below is the pinout and wiring map for interfacing it with an ESP32 or 3.3V Arduino.
| Sensor Pin | Function | Supply / Range | ESP32 Connection |
|---|---|---|---|
| VCC | Logic Power Supply | 3.0V to 3.6V | 3V3 Pin |
| GND | Logic Ground | 0V | GND |
| OUT | Analog Voltage Output | 0.1V to VCC-0.1V | GPIO 34 (ADC1_CH6) |
| IP+ | Load Current Input | -30A to +30A | Load Power Source (+) |
| IP- | Load Current Output | -30A to +30A | Load Device (+) |
Output Signal Math: Raw ADC to Amps
The output of this sensor circuit is an analog voltage that is ratiometric to VCC. At exactly 0A, the sensor outputs VCC / 2 (approximately 1.65V). As current flows from IP+ to IP-, the voltage increases; as current flows in reverse, the voltage decreases.
For the 30A variant of the ACS724, the sensitivity is 66 mV/A. To convert the physical voltage back into Amps, we use the following transfer function:
Current (A) = (V_out - V_offset) / SensitivityWhere V_offset is the zero-current baseline (VCC / 2) and Sensitivity is 0.066 V/A.
When using an ESP32, reading raw ADC values with analogRead() is notoriously non-linear, especially near the 0V and 3.3V rails. To bypass manual ADC curve fitting, use the analogReadMilliVolts() function, which leverages the ESP32's internal eFuse calibration data to return a highly accurate millivolt reading. You can read more about this in the Espressif ADC Oneshot documentation.
Here is the complete, copy-pasteable C++ code to sample the sensor and calculate the current:
// ACS724 Current Sensor Circuit Code for ESP32
const int SENSOR_PIN = 34; // GPIO 34 (ADC1)
const float VCC_MV = 3300.0; // Measure your actual 3V3 rail with a multimeter
const float OFFSET_MV = VCC_MV / 2.0;
const float SENSITIVITY_MV = 66.0; // 66mV/A for ACS724-30AB
void setup() {
Serial.begin(115200);
analogSetAttenuation(ADC_11db); // Required for full 0-3.3V range
}
void loop() {
// Read calibrated millivolts directly from ESP32 API
int v_out_mv = analogReadMilliVolts(SENSOR_PIN);
// Apply transfer function
float current_a = (v_out_mv - OFFSET_MV) / SENSITIVITY_MV;
Serial.print("Voltage: ");
Serial.print(v_out_mv);
Serial.print(" mV | Current: ");
Serial.print(current_a, 2);
Serial.println(" A");
delay(250);
}
Calibration and Common Interference Sources
While the math is straightforward, real-world sensor circuits rarely output a perfect 1.65V at zero current right out of the box. You must calibrate the V_offset. Power up the circuit with no load connected to the IP+ and IP- terminals. Read the raw millivolt output over Serial for 5 seconds, average the readings, and hardcode that value into your OFFSET_MV variable. This accounts for minor internal Hall IC offsets and exact VCC rail variations.
Beyond baseline offset, you must design your circuit to mitigate three common interference sources:
- VCC Ripple (Ratiometric Error): Because the output is ratiometric, any noise on your 3.3V supply directly modulates the output. If your ESP32's USB 3.3V LDO sags by 50mV when the WiFi radio transmits, your sensor's zero-point shifts by 25mV, which the math interprets as ~0.38A of phantom current. Fix: Power the sensor's VCC pin from a dedicated, low-noise LDO, or add a 10µF ceramic capacitor and a small ferrite bead between the ESP32 3V3 pin and the sensor VCC.
- Stray Magnetic Fields: Hall effect sensors are inherently magnetic. Mounting this sensor circuit within an inch of a mains transformer, a large inductor, or a brushless motor will induce a static offset or AC hum. Fix: Maintain at least a 2-inch physical clearance from magnetic components, or use a mu-metal shield.
- High-Frequency EMI on the Output Trace: The analog output trace acts as an antenna for switching noise from nearby DC-DC buck converters. Fix: Place a simple RC low-pass filter (e.g., 100Ω resistor in series with the OUT pin, and a 100nF capacitor to GND at the ESP32 GPIO) to roll off high-frequency switching noise.
Frequently Asked Questions
Why is my current sensor circuit output fluctuating with no load?
If your serial monitor shows the current jumping between +0.1A and -0.1A with no load attached, you are seeing ADC quantization noise combined with VCC ripple. The ESP32's ADC has a native noise floor of about ±10mV to ±20mV. Since the sensor sensitivity is 66mV/A, a 15mV ADC jitter translates to ~0.22A of apparent noise. To fix this, implement a software moving average filter (averaging 16 to 32 consecutive samples) and ensure you have placed a 100nF bypass capacitor directly across the VCC and GND pins of the sensor breakout.
How do I build a bidirectional sensor circuit for battery monitoring?
The ACS724 is natively bidirectional. The VCC/2 offset (1.65V) acts as your zero-crossing point. When a battery is discharging, current flows one way, pushing the voltage above 1.65V (e.g., 2.31V at +10A). When your solar charge controller pushes current back into the battery, the flow reverses, dropping the voltage below 1.65V (e.g., 0.99V at -10A). The math provided in the code block above automatically handles this; a negative result simply indicates reverse current flow. Just ensure your microcontroller's ADC reference is stable, as any drift in the 3.3V rail will skew your zero-crossing baseline.
Will a 5V sensor circuit damage my 3.3V ESP32 analog pin?
Yes, it is highly likely. If you use an older 5V sensor (like the ACS712-30A) powered at 5V, its zero-current output is 2.5V. While 2.5V is technically within the ESP32's 3.3V GPIO tolerance at rest, a negative current spike could drive the output toward 5V, instantly frying the ESP32's internal ADC clamping diodes. Furthermore, the ESP32 ADC cannot read voltages above ~3.1V accurately, meaning you will clip your measurement range. Always use a 3.3V-native sensor like the ACS724, or use a precision op-amp voltage divider to scale a 5V sensor's output down to 3.3V.






