An arc fault circuit interrupter (AFCI) installation physically replaces a standard thermal-magnetic breaker to meet NEC Article 210.12 mandates for living spaces. But when a newly installed AFCI breaker nuisance-trips on a harmless vacuum cleaner motor, swapping the breaker isn't the fix—diagnosing the high-frequency current signature is. Commercial AFCIs use an internal DSP to detect 10kHz–100kHz broadband noise generated by arcing. To debug these trips, we can design and install an embedded diagnostic sensor topology using an ESP32 to capture and log the exact RF envelope the breaker is seeing.

MAINS SAFETY WARNING: Physical arc fault circuit interrupter installation involves lethal 120V/240V AC mains. Before opening any panel, de-energize the main breaker, apply a lockout/tagout device, and verify the bus bars are dead using a tested CAT III multimeter. NEC-style guidance requires that panel work and breaker terminations be performed or inspected by a licensed electrician. The embedded sensor topology detailed below is a diagnostic tool clamped over insulated conductors; never breadboard live mains.

The AFCI Sensor Front-End Topology & Component Spec Sheet

To detect the micro-second current interruptions characteristic of a series arc, we cannot rely on standard 60Hz current transformers. We need a High-Frequency Current Transformer (HFCT) paired with an active analog front-end. The ESP32's internal 12-bit SAR ADC maxes out around 300ksps, which is barely enough to sample a 100kHz waveform directly and leaves no headroom for DSP. Instead, we use an Active Bandpass + Precision Envelope Detector topology. This amplifies the high-frequency arc noise, rectifies it, and smooths it into a 0–3.3V DC envelope that the ESP32 can sample reliably at 10ksps.

Node Map & Design Walkthrough

The signal flows through five distinct nodes. We start at Node A (the HFCT secondary), pass through a high-pass filter to Node B (where we inject a 1.65V DC bias so the op-amp can swing both positive and negative relative to the AC zero-crossing), amplify it at Node C, rectify it at Node D, and filter the envelope at Node E before hitting the ESP32 GPIO.

Table 1: Front-End Component Spec Sheet & Node Routing
Component RefValue / PartToleranceNode ConnectionFunction in Topology
T1 (HFCT)1:500 Turns, FerriteN/APrimary: Mains Wire
Sec: Node A
Transduces 10kHz-100kHz di/dt into mV-level AC.
R_burden10 Ω1% Metal FilmAcross Node AConverts HFCT secondary current to measurable voltage.
C_couple100 nF (X7R)10%Node A to Node BBlocks 60Hz fundamental; passes >1.5kHz arc noise.
R_bias1, R_bias210 kΩ each1%3.3V to Node B, Node B to GNDParallel voltage divider creating 1.65V DC bias at Node B.
U1 (Op-Amp)MCP6002N/AIn: Node B, Out: Node CRail-to-rail amp. Gain of 50x (Rf=49k, Rin=1k).
D1, D2BAT54 (Schottky)N/ANode C to Node DPrecision half-wave rectifier; low 0.2V forward drop.
R_env, C_env10 kΩ, 10 nF5%Node D to Node ERC low-pass (fc ~1.5kHz) extracts the arc envelope.

Behavior Matrix & Extreme Failure Modes

When debugging a sensor that fails to log a known arc (like a carbonized track on a breadboard), you must understand how component drift or failure alters the topology. The bias network and the coupling capacitor are the most common culprits for silent failures.

Table 2: Element Variation & Extreme Failure Contrast
Element ChangedParameter ShiftCircuit BehaviorExtreme Failure (Open/Short)
C_couple (100nF)Degrades to 10nFHigh-pass cutoff shifts from 1.5kHz to 15kHz; misses low-frequency series arcs.Open: Total signal loss. Node B floats to 1.65V DC. ESP32 reads flatline.
R_bias1 (10k)Drifts to 15kNode B bias shifts from 1.65V to ~1.98V. Reduces positive swing headroom.Open: Node B pulled to 0V by R_bias2. Negative AC cycles clip entirely at the op-amp rail.
R_burden (10Ω)Increases to 50ΩGain increases 5x, but HFCT high-frequency rolloff drops due to parasitic capacitance.Short: HFCT secondary shorted. Zero voltage at Node A. Sensor is blind.
C_env (10nF)Degrades to 1nFEnvelope filter cutoff rises to 15kHz. ESP32 ADC reads raw 60Hz ripple instead of smooth DC.Short: Node D shorted to GND. ESP32 ADC reads 0V regardless of arc presence.

Why This Active Topology Beats Passive Envelope Detection

A common alternative in hobbyist current sensing is the passive diode envelope detector—running the CT secondary directly into a Schottky diode and an RC filter. Why use the active MCP6002 topology instead?

The answer lies in the physics of series arc faults. A parallel arc (line-to-neutral short) draws massive current, easily generating hundreds of millivolts at the CT. But a series arc (a loose connection in a downstream outlet) only draws the load current—often under 5A. At 5A, the high-frequency noise generated at the arc gap induces only 2mV to 5mV at the HFCT secondary. A passive Schottky diode (like the BAT54) has a forward voltage drop of roughly 0.2V at low currents. That 5mV signal will never overcome the diode's junction potential; the passive detector remains completely blind to low-current series arcs. By placing the MCP6002 op-amp before the rectifier and applying a gain of 50x, we amplify that 5mV signal to 250mV, easily pushing it through the diode's forward threshold and making low-current arc logging possible.

Step-by-Step Breadboard Testing & ESP32 Integration

Never test this topology on live mains. To verify the circuit before clamping it over an installed AFCI branch circuit, use a function generator and a mock wire loop on your bench. For deeper reading on the ESP32's ADC hardware constraints, refer to the Espressif ADC Oneshot Documentation, and for physical AFCI placement rules, consult the NFPA Electrical Safety guidelines.

Bench Verification Sequence

  1. Inject the Mock Arc: Wrap 5 turns of magnet wire around the HFCT core to act as a primary. Connect your function generator to this wire. Set the generator to a 50kHz sine wave at 100mVpp (simulating a 5A series arc).
  2. Verify Node B Bias: With the circuit powered by the ESP32's 3.3V rail, probe Node B with a multimeter. You must read exactly 1.65V DC. If it reads 0V or 3.3V, check your R_bias1/R_bias2 solder joints.
  3. Check Node C Amplification: Probe Node C with an oscilloscope. You should see a 50kHz sine wave centered on 1.65V, with a peak-to-peak amplitude of roughly 2.5V (100mV input × 50 turns × gain, factoring in burden resistor scaling).
  4. Validate Node E Envelope: Probe Node E. The 50kHz carrier should be gone, replaced by a smooth DC voltage that rises when the function generator is on and decays when turned off.

ESP32 Pin Mapping & Configuration

Once the bench test passes, connect Node E to the ESP32. We use GPIO 34 because it is an input-only pin with no internal pull-up resistors that could interfere with the high-impedance envelope filter.

Table 3: ESP32 Diagnostic Logger Pinout
ESP32 PinConnectionConfiguration Note
3V3R_bias1, U1 VCCUse a dedicated LDO if the ESP32 WiFi RF spikes cause 3.3V rail noise.
GNDR_bias2, U1 GND, C_envKeep analog ground returns short and away from the ESP32 antenna.
GPIO 34Node E (Envelope Out)Set ADC_ATTEN_DB_11 to utilize the full 0-3.1V readable range.
GPIO 2Panel Status LEDDrives a 5mm LED via 330Ω resistor to indicate arc-event logging.

During a physical AFCI installation, clamp the HFCT over the 12 AWG THHN neutral or hot conductor exiting the breaker. When the AFCI trips, pull the ESP32 serial log. If Node E spiked above 1.5V just before the breaker's mechanical latch dropped, you have confirmed the breaker is seeing genuine high-frequency arc noise—meaning you have a loose termination or damaged wire downstream, not a faulty breaker.