Decoding the 1 nF Capacitor Code (102 vs 1n0)

The standard 3-digit EIA (Electronic Industries Alliance) code for a 1 nanofarad capacitor is 102. If the component uses the newer letter-number notation, it will be marked as 1n0.

Here is the exact math behind the 3-digit system: the first two digits represent the significant figures, and the third digit is the multiplier (number of zeros) in picofarads (pF). For 102, you take 10 and add two zeros, yielding 1000 pF. Since 1000 pF equals 1 nF, the code 102 is the universal identifier for this value on small multilayer ceramic capacitors (MLCCs) and film capacitors.

However, reading the code is only half the battle. In embedded hardware, a cheap "102" capacitor can wreck a high-speed I2C bus or cause brownouts on an ESP32 reset line if you ignore the dielectric material. Z5U and Y5V dielectrics can lose up to 50% of their nominal capacitance under standard DC bias voltages. For a deep dive into standard markings, the All About Circuits capacitor code reference provides a comprehensive lookup chart.

Dielectric Decision Path: Which 102 Cap to Buy?

Application ScenarioRequired StabilityConcrete Pick (Dielectric)
High-frequency timing, oscillators, analog filtersUltra-high (±5% or better, no DC bias drop)C0G / NP0 (e.g., Kemet C0805C102J5GACTU)
General decoupling, I2C pull-up filtering, digital bypassModerate (±15%, predictable DC bias curve)X7R (e.g., Murata GRM21BR71H102KA01L)
Low-cost bulk filtering on non-critical power railsLow (tolerances can swing -20% to +80%)Z5U (Avoid for 1nF high-speed applications)

Default Recommendation: If you are stocking your lab bins for general embedded prototyping, buy X7R 102 (1nF) capacitors in 0805 or 0603 packages. They offer the best balance of price, availability, and stable performance under 3.3V and 5V DC bias.

Project: ESP32 RC-Decay Tester for 102 Capacitors

To verify if your "102" capacitors are actually 1nF (and not degraded or mislabeled), we will build an RC-decay capacitance meter. By charging the capacitor through a known resistor and measuring the time it takes the voltage to drop to 36.8% of VCC during discharge, we can calculate the exact capacitance using the formula C = τ / R.

Difficulty: Intermediate (2/5) | Time: 45 minutes | Target Board: ESP32 DevKit V1 (ESP32-WROOM-32 module)

Parts List

  • Microcontroller: ESP32 DevKit V1 (specifically the 30-pin ESP32-WROOM-32 variant)
  • Resistor: 1MΩ 1% metal film resistor (used as the known R to stretch the 1nF decay time into a readable ~1ms window)
  • Diode: 1N4148 signal diode (for rapid, isolated discharge paths)
  • Test Subject: Assorted 102 (1nF) MLCC capacitors
  • Hardware: Half-size breadboard, male-to-female DuPont jumper wires

Pin Mapping Table

ESP32 GPIOFunctionConnection Target
GPIO 25Charge Control1MΩ Resistor (other end to Cap +)
GPIO 26Discharge Control1N4148 Anode (Cathode to Cap +)
GPIO 34ADC Sense (Input Only)Direct to Cap + (Measure node)
GNDCommon GroundCap - and Diode/Breadboard GND rail

Wiring and Firmware Setup

Measuring a 1nF capacitor requires speed. A 1nF cap with a 10kΩ resistor yields a 10µs time constant, which is too fast for the ESP32's standard ADC sampling. By stepping up to a 1MΩ resistor, the time constant becomes 1ms, giving the ESP32's 12-bit ADC plenty of time to capture the decay curve accurately.

Numbered Wiring Steps

  1. De-energize: Ensure the ESP32 is unplugged from USB before wiring.
  2. Place the Resistor: Insert the 1MΩ resistor into the breadboard. Connect one leg to GPIO 25 and the other to a central test node (Row 10).
  3. Place the Diode: Insert the 1N4148. Connect the cathode (striped end) to the central test node (Row 10) and the anode to GPIO 26.
  4. Wire the ADC: Run a jumper from the central test node (Row 10) directly to GPIO 34. Keep this wire under 2 inches to minimize parasitic capacitance.
  5. Connect the Capacitor: Insert your 102 test capacitor. One leg goes to the central test node (Row 10), the other to the GND rail.
  6. Verify: Use a multimeter in continuity mode to ensure GPIO 34 is not shorted to GND before applying power.

Complete Compilable Firmware

Flash this code using the Arduino IDE with the ESP32 Core v2.0.14 or newer installed. The code utilizes the Espressif ADC oneshot API logic adapted for the Arduino wrapper to ensure fast, calibrated millivolt reads.


// ESP32 1nF (102 Code) Capacitor RC Decay Tester
// Target: ESP32 DevKit V1 (ESP32-WROOM-32)
// Core: ESP32 Arduino Core v2.0.14+

#define PIN_CHARGE    25
#define PIN_DISCHARGE 26
#define PIN_SENSE     34

#define R_OHMS        1000000.0  // 1M Ohm known resistor
#define VCC_MV        3300.0     // Nominal 3.3V in millivolts
#define TARGET_MV     1214.0     // 36.8% of 3300mV (1 time constant decay)
#define TIMEOUT_US    5000000UL  // 5 second hard timeout

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("ESP32 102 Capacitor Tester Initialized.");
  
  // Discharge pin setup (Active HIGH to discharge through diode to GND via internal/external path)
  // For this circuit, we pull DISCHARGE HIGH to forward bias the diode to a GND-referenced sink,
  // but simpler: we just use GPIO 26 as an OUTPUT LOW to sink current directly if diode is omitted.
  // Assuming diode to GND: GPIO 26 HIGH forward biases diode to GND.
  pinMode(PIN_CHARGE, OUTPUT);
  pinMode(PIN_DISCHARGE, OUTPUT);
  pinMode(PIN_SENSE, INPUT);
  
  digitalWrite(PIN_CHARGE, LOW);
  digitalWrite(PIN_DISCHARGE, LOW); // Ensure discharge path is open (reverse biased or floating)
}

void dischargeCap() {
  digitalWrite(PIN_CHARGE, LOW);
  digitalWrite(PIN_DISCHARGE, HIGH); // Forward bias diode to ground
  delay(50); // 50ms is more than enough to drain 1nF
  digitalWrite(PIN_DISCHARGE, LOW);
}

void loop() {
  dischargeCap();
  
  // Begin Charge & Measure Decay
  unsigned long startTime = micros();
  digitalWrite(PIN_CHARGE, HIGH);
  
  // Wait for cap to charge near VCC (approx 5 * tau for 1nF/1M = 5ms)
  delay(10); 
  digitalWrite(PIN_CHARGE, LOW); // Stop charging, begin natural decay through ADC impedance/leakage
  
  // Note: To force a clean decay through a known path, a parallel discharge resistor 
  // is usually needed. Here we rely on the 1M resistor pulling to GND if CHARGE is LOW.
  // Wait, if CHARGE is LOW, the 1M resistor IS the discharge path to GND!
  
  unsigned long decayStart = micros();
  bool timeoutFlag = false;
  
  while (analogReadMilliVolts(PIN_SENSE) > TARGET_MV) {
    if (micros() - decayStart > TIMEOUT_US) {
      timeoutFlag = true;
      break;
    }
  }
  
  unsigned long decayTime = micros() - decayStart;
  
  if (timeoutFlag) {
    Serial.println("ERR_CAP_TIMEOUT: Decay exceeded 5000us. Check 102 cap or wiring.");
  } else {
    // tau = R * C  =>  C = tau / R
    // decayTime is in microseconds. Convert to seconds for Farads, then to nanoFarads.
    double tau_seconds = (double)decayTime / 1000000.0;
    double capacitance_farads = tau_seconds / R_OHMS;
    double capacitance_nF = capacitance_farads * 1000000000.0;
    
    Serial.printf("Decay Time: %lu us | Calculated: %.2f nF\n", decayTime, capacitance_nF);
    
    if (capacitance_nF < 0.5 || capacitance_nF > 2.0) {
      Serial.println("WARNING: Value outside standard 102 (1nF) tolerance bounds!");
    }
  }
  
  delay(2000); // Pause before next test
}

Debugging: When the 102 Code Lies (and ESP32 Errors)

When testing small values like 1nF, parasitic capacitance from your breadboard (often 2pF to 5pF per contact) and the ESP32's internal ADC multiplexer capacitance (~10pF) can skew readings. If your serial monitor throws the exact error string below, follow the ranked diagnostic path.

Exact Error String: ERR_CAP_TIMEOUT: Decay exceeded 5000us. Check 102 cap or wiring.

The First Three Things to Check

  1. Verify the Resistor Value: Pull the 1MΩ resistor and measure it with a multimeter. If you accidentally grabbed a 10MΩ or an open-circuit (broken) resistor, the RC time constant will stretch past the 5-second software timeout.
  2. Check for Floating ADC Nodes: If the capacitor is not fully seated in the breadboard, GPIO 34 is floating. A floating ADC pin on an ESP32 will hold its previous charge due to internal sample-and-hold capacitance, never crossing the 1214mV threshold.
  3. Inspect the Discharge Diode Orientation: If the 1N4148 is backward (cathode to GPIO 26, anode to the cap), the discharge phase fails. The capacitor stays charged from the previous cycle, and the decay loop starts at an invalid voltage state.

Ranked Causes for Skewed Readings (No Timeout, but Wrong nF Value)

RankSymptomRoot CauseFix
1Reads 1.8nF instead of 1.0nFCheap Z5U dielectric "102" cap has massive +80% tolerance at room temp.Replace with an X7R or C0G 102 capacitor.
2Reads 0.6nF instead of 1.0nFDC Bias effect: Cap is rated for 50V but tested at 3.3V, or it's a microphonic crack.Verify voltage rating; inspect cap for physical hairline cracks.
3Readings jump ±0.3nF randomlyBreadboard parasitic capacitance shifting as wires are bumped.Solder the 1MΩ resistor and test leads directly to the ESP32 pins (dead-bug style).

Extending and Simplifying the Build

Once you have validated your bin of 102 capacitors, you can adapt this test rig to suit different workshop needs.

How to Extend the Build

To turn this into a multi-component tester, add an I2C 128x64 OLED (SSD1306) to GPIO 21 (SDA) and GPIO 22 (SCL). Modify the firmware to include a lookup table for common EIA codes (101, 102, 103, 104). By swapping the 1MΩ resistor for a 10kΩ resistor via a multiplexer (like the CD4051), you can automatically switch ranges to measure everything from 100pF (101 code) up to 10µF electrolytic capacitors without timing out the ADC.

How to Simplify the Build

If you don't need serial logging and just want a pass/fail hardware check for 1nF capacitors on the assembly line, strip out the ESP32. Use a NE555 timer in astable mode. With a 1MΩ timing resistor and your 102 test capacitor, the output frequency will be exactly f = 1.44 / (R * C), which equals roughly 1.44 Hz. Connect the 555 output to an LED with a 330Ω current-limiting resistor. If the LED blinks roughly once every 1.5 seconds, the 102 capacitor is within tolerance. If it blinks rapidly or stays solid, the capacitor is shorted, open, or wildly out of spec.