When measuring alternating current without breaking a circuit, you are generally choosing between two physical principles. Current Transformers (CTs), like the widely used YHDC SCT-013 series, rely on Faraday’s law of induction. A split ferrite core clamps around a single current-carrying conductor, and the alternating magnetic field induces a proportional secondary current in the coil wound around the core. This method provides excellent galvanic isolation and is the standard for non-invasive mains monitoring.
Hall Effect sensors, such as the Allegro ACS712 or the newer ACS724, pass the actual load current through an internal copper conductor. The resulting magnetic field deflects electrons in an integrated Hall element, generating a millivolt-level analog voltage proportional to the instantaneous current. While Hall sensors can measure both AC and DC and are easier to breadboard, they lack the robust galvanic isolation of a CT and dissipate heat at high currents.
Core Electrical Sensors Compared: CT vs Hall Effect
Selecting the right electrical sensor for your embedded project depends on your isolation requirements, supply voltage, and ADC resolution. The table below breaks down the four most common modules found in maker and prototyping environments as of 2026.
| Sensor Model | Type | Supply Range | Output Signal | Sensitivity / Scale | Isolation |
|---|---|---|---|---|---|
| SCT-013-000 | Current Transformer | Passive (None) | AC Current (0-50mA) | 2000:1 turns ratio | High (Magnetic) |
| SCT-013-030 | Current Transformer | Passive (None) | AC Voltage (0-1V) | 1V per 30A RMS | High (Magnetic) |
| ACS712-30A | Hall Effect | 4.5V - 5.5V | Ratiometric DC-Biased AC | 66 mV/A | Low (2.1kV RMS) |
| ACS724-30AB | Hall Effect | 3.0V - 3.6V | Ratiometric DC-Biased AC | 40 mV/A | Medium (4.8kV RMS) |
Wiring and Pin Mapping for 3.3V Microcontrollers
The most common mistake when interfacing these electrical sensors with an ESP32 is mismanaging the output signal type. The SCT-013-000 outputs raw AC current; if you plug it directly into a GPIO, you will destroy the pin. It requires a burden resistor to convert the current to voltage, and a DC bias circuit to shift the AC waveform into the ESP32’s 0–3.3V ADC window. The ACS724, conversely, outputs a DC-biased AC voltage natively (centered at VCC/2), requiring only a direct connection to the ADC.
| Sensor Pin / Node | Target / Component | Notes & Constraints |
|---|---|---|
| SCT-013-000 (White) | 33Ω Burden Resistor | Converts 50mA to ~1.65V peak. Use 1/4W metal film. |
| SCT-013-000 (Red) | 33Ω Burden Resistor | Other end of burden. Do not leave CT open-circuited. |
| DC Bias Midpoint | ESP32 GPIO 34 (ADC1_CH6) | Two 470kΩ resistors + 10µF cap from 3.3V to GND. |
| ACS724 VCC | ESP32 3V3 Pin | Supply range: 3.0V to 3.6V. Keep traces short. |
| ACS724 GND | ESP32 GND | Must share common ground with ESP32. |
| ACS724 VIOUT | ESP32 GPIO 35 (ADC1_CH7) | Outputs 1.65V at 0A. Swings ±1.2V at 30A. |
Raw ADC Reading to Physical Amps: The Math
Microcontrollers do not read Amps; they read discrete voltage steps. To get usable physical units, you must sample the AC waveform fast enough to capture the peaks, remove the DC bias, and calculate the Root Mean Square (RMS). For a 60Hz mains signal, sampling at 2kHz to 3kHz is sufficient to capture the waveform shape without aliasing.
For the SCT-013-000 with a 33Ω burden resistor, the math flows as follows:
- Instantaneous Voltage: Read the ADC. Convert the 12-bit raw value (0-4095) to millivolts using the ESP-IDF calibration API. (Note: raw
analogRead()on the ESP32 is highly non-linear; always use adc_oneshot with adc_cali for physical voltage mapping). - Remove DC Offset: Subtract the bias voltage (nominally 1650mV) from the instantaneous reading.
- Calculate RMS: Square each biased sample, average them over one full AC cycle (or multiple cycles), and take the square root.
- Scale to Amps: Multiply the RMS voltage by the sensor's scaling factor.
The scaling factor (often called VCAL in the EmonLib ecosystem) for the SCT-013-000 with a 33Ω burden is derived from the turns ratio (2000:1). If the ADC reads 1.65V RMS, the secondary current is 50mA RMS, meaning the primary current is 100A RMS. Therefore, the multiplier is 100A / 1.65V = 60.6.
// Simplified ESP32 RMS Calculation Snippet (C++)
float readCurrentRMS(int adcPin, int samples) {
long sumSquared = 0;
int offset = 2048; // Midpoint of 12-bit ADC (calibrate in production)
for (int i = 0; i < samples; i++) {
int raw = analogRead(adcPin);
int biased = raw - offset;
sumSquared += (long)biased * biased;
delayMicroseconds(350); // ~2.8kHz sample rate for 60Hz
}
double meanSquared = (double)sumSquared / samples;
double rmsRaw = sqrt(meanSquared);
// Convert raw RMS to voltage, then to Amps
// 3300mV / 4096 steps = 0.805 mV/step
double rmsVoltage = rmsRaw * 0.000805;
double amps = rmsVoltage * 60.6; // Scaling factor for SCT-013-000 + 33ohm
return amps;
}
Interference, Calibration, and Edge Cases
Electrical sensors operating in the millivolt range are magnets for environmental noise. Understanding interference sources is the difference between a reliable energy monitor and a useless string of fluctuating numbers.
Common Interference Sources
- ESP32 WiFi/Bluetooth RF: The ESP32’s internal switching regulators and RF transmissions inject high-frequency noise into the 3.3V rail. If using a ratiometric Hall sensor (ACS724), this VCC noise directly modulates your output signal. Fix: Power the sensor from a dedicated LDO (like an AP2112K-3.3) rather than the ESP32 dev board's onboard regulator.
- Switching Loads (VFDs, SMPS): Variable Frequency Drives and cheap LED drivers inject high-frequency harmonics back into the mains. A CT will pick these up, causing RMS calculations to read higher than the true fundamental 60Hz current. Fix: Add a simple RC low-pass hardware filter (e.g., 1kΩ series resistor + 100nF capacitor to ground) before the ESP32 ADC pin.
- Ground Loops: When measuring current in a system where the ESP32 is powered by a different source than the load, differing ground potentials can cause erratic ADC readings. CTs inherently solve this via magnetic isolation; Hall sensors do not.
Calibration Strategy
Never trust the nominal values printed on the sensor. A 33Ω burden resistor has a 1% to 5% tolerance, and the CT core itself has manufacturing variance. To calibrate:
- Plug a known resistive load into the mains (e.g., a 1000W space heater). At 120V, this should draw exactly 8.33A.
- Read the uncalibrated RMS value from your ESP32 serial monitor.
- Calculate the correction factor:
True_Current / Measured_Current. - Multiply your hardcoded scaling factor by this correction factor.






