If you need to measure DC or AC current without inserting a lossy shunt resistor or breaking galvanic isolation, a hall-effect current sensor is the standard bench and jobsite solution. These ICs sit on breakout boards that handle everything from 5A servo loads to 30A solar array feeders. But while wiring them to an ESP32 or Arduino seems trivial, getting accurate, noise-free readings requires understanding ratiometric analog outputs, ADC scaling math, and magnetic interference. This guide provides the exact pinouts, raw-to-unit math, and noise-mitigation strategies you need to deploy these sensors reliably.
How Hall-Effect Current Sensors Actually Work
The sensing principle relies on the Lorentz force. When load current flows through the internal copper conductor of the IC, it generates a proportional magnetic field. A microscopic hall element positioned perpendicular to this field experiences a deflection of charge carriers, outputting a tiny voltage proportional to the magnetic flux density. An internal amplifier and temperature-compensation circuit scale this microvolt signal into a usable analog voltage.
Critically, the load current path and the signal output path are physically separated inside the IC package by a dielectric barrier or split-core gap. This provides galvanic isolation—typically rated between 2.5kV and 4.8kV RMS depending on the specific IC. Your ESP32’s fragile 3.3V ADC pin is completely isolated from a 120V AC mains load or a 48V DC battery bank, provided you respect the module's isolation voltage limits and creepage distances on the PCB.
Module Specifications and Wiring Pinout
Not all hall-effect current sensors are created equal. The legacy ACS712 is still sold on cheap breakout boards, but it is fundamentally a 5V part. Feeding its output directly into an ESP32’s 3.3V ADC will saturate the reading and potentially damage the microcontroller over time. For 3.3V logic, you must use modern 3.3V-native ICs like the Allegro ACS724 or the TI TMCS1100.
| IC Model | Supply Voltage | Sensitivity (Example) | Bandwidth | Isolation Rating | Approx. Cost (2026) |
|---|---|---|---|---|---|
| Allegro ACS712 | 4.5V to 5.5V | 66 mV/A (30A ver) | 80 kHz | 2.5 kV RMS | $3.50 - $5.00 |
| Allegro ACS724 | 3.0V to 5.5V | 66 mV/A (30A ver) | 120 kHz | 2.5 kV RMS | $4.00 - $6.50 |
| TI TMCS1100 | 2.7V to 5.5V | 50 mV/A (A1B ver) | 80 kHz | 4.8 kV RMS | $5.50 - $8.00 |
| Allegro ACS781 | 3.3V or 5.0V | 100 mV/A (10A ver) | 120 kHz | 2.5 kV RMS | $4.50 - $7.00 |
Standard breakout boards expose the low-voltage signal pins on one side and high-current screw terminals on the other. Below is the standard signal-side pinout.
| Breakout Pin | ESP32 Pin | Function & Notes |
|---|---|---|
| VCC | 3V3 | Supply range: 3.0V to 5.5V (for ACS724/TMCS). Must be clean. |
| GND | GND | Signal ground. Keep return path short to avoid ground loops. |
| OUT | GPIO 34 (ADC1) | Analog ratiometric output. Do not use ADC2 (WiFi conflict). |
| IP+ / IP- | N/A | High-current load terminals. Polarity dictates sign of output voltage. |
If you are forced to use a legacy 5V ACS712 module with an ESP32, you must power the VCC pin from the ESP32's 5V (VIN) pin, and place a voltage divider (e.g., 2kΩ and 3.3kΩ) on the OUT pin to scale the 0-5V analog signal down to 0-3.3V. Bypassing this will feed 4.5V into a 3.3V ADC pin during peak current spikes, degrading the ESP32 silicon.
Raw ADC to Amps: The Output Signal Math
The standard output of these modules is a ratiometric analog voltage. "Ratiometric" means the output scales proportionally with the supply voltage. At zero current, the sensor outputs exactly VCC / 2. As current flows in the positive direction, the voltage rises above VCC / 2; as it flows in the negative direction (or AC cycles), it drops below VCC / 2. (Note: Some specialized industrial ICs output digital SPI or PWM, but 99% of hobbyist and maker breakout boards use the analog voltage standard).
To convert the raw ADC reading into physical Amps, you must account for the zero-current offset and the specific sensitivity of your IC variant (expressed in mV/A). The formula is:
Current (A) = (V_out - V_offset) / SensitivityWhere
V_offset = VCC / 2
Let’s run a worked numeric example. You are using an ACS724-30AB (30A range, 66 mV/A sensitivity) powered at exactly 3.3V. The offset is 1.65V. If the ESP32 reads 2.15V on the ADC pin, the math is: (2.15V - 1.65V) / 0.066 V/A = 7.57 Amps.
Because the ESP32’s native analogRead() function returns raw 12-bit integers (0-4095) and suffers from factory calibration variances, you should use the modern analogReadMilliVolts() function available in recent ESP32 Arduino cores. This function uses the chip's internal eFuse calibration data to return actual millivolts, bypassing the need to manually calculate VCC reference drift.
// ESP32 Hall-Effect Current Sensor Interfacing Code
// Target: ESP32 DevKit V1, Core v2.0.x or later
const int sensorPin = 34; // ADC1 channel, safe from WiFi interrupts
const float sensitivity = 0.066; // 66mV/A for ACS724-30AB (check your datasheet)
const float vcc = 3.3; // Nominal VCC
const float offset = vcc / 2.0; // 1.65V zero-current offset
void setup() {
Serial.begin(115200);
analogReadResolution(12); // Ensure 12-bit resolution (0-4095)
analogSetAttenuation(ADC_11db); // Full range up to ~3.1V
}
void loop() {
// analogReadMilliVolts uses internal eFuse calibration for accuracy
int mV = analogReadMilliVolts(sensorPin);
float voltage = mV / 1000.0;
// Apply the raw-to-unit math
float current = (voltage - offset) / sensitivity;
Serial.printf("Raw mV: %d | Voltage: %.3f V | Current: %.2f A\n", mV, voltage, current);
delay(50);
}
Calibration, Noise, and Interference Sources
Hall-effect sensors are notoriously susceptible to environmental noise. If your serial monitor shows the current jumping from 0.2A to -0.4A while the load is disconnected, you are dealing with interference. Here are the three primary sources and how to fix them.
1. VCC Ripple (The Ratiometric Penalty)
Because the output is ratiometric, any noise on your 3.3V supply rail is directly injected into the OUT pin. If your ESP32’s 3.3V LDO has 20mV of switching ripple, your sensor output will ride that ripple, causing phantom current readings. Fix: Place a 0.1µF ceramic decoupling capacitor and a 10µF tantalum capacitor directly across the VCC and GND pins on the sensor breakout board. Power the sensor from a dedicated, clean LDO if measuring sub-amp currents.
2. External Magnetic Fields
These ICs measure magnetic flux. If you mount the sensor PCB next to a step-down transformer, a neodymium magnet, or even a high-current relay coil, the ambient magnetic field will bias the hall element. Fix: Maintain at least 15mm of physical clearance from magnetic components. For high-precision DC measurements, perform a software zero-offset calibration at startup before the main contactor engages.
3. High dI/dt Capacitive Coupling
When switching inductive loads like BLDC motors or solenoids, the rapid change in current (high dI/dt) generates intense electromagnetic interference (EMI). This can couple capacitively across the IC's internal isolation barrier, causing massive voltage spikes on the output pin. Fix: Use twisted-pair wiring for the high-current load path to cancel the magnetic field generated by the supply and return wires. Add a small RC low-pass filter (e.g., 100Ω resistor and 0.1µF cap) on the analog OUT line before it reaches the ESP32 GPIO.
The VCC / 2 offset is theoretically perfect, but in practice, internal IC tolerances and PCB trace resistance shift it by 10mV to 30mV. To fix this, read the sensor 100 times at startup with zero load current connected, average the millivolt readings, and store that value as your
calibrated_offset variable instead of hardcoding vcc / 2.0. This single software step will eliminate 90% of your low-current measurement error.
By selecting a 3.3V-native IC like the Allegro ACS724 or the TI TMCS1100, utilizing the ESP32's calibrated ADC functions, and filtering VCC ripple, you can achieve highly accurate, isolated current measurements suitable for solar charge controllers, battery management systems, and motor control loops.






