The Direct Answer: Which Arduino Capacitor to Use and Where
When hobbyists search for an arduino capacitor fix, they are almost always dealing with one of two symptoms: the microcontroller silently resetting when a relay clicks, or analog-to-digital converter (ADC) readings jumping erratically. Both are caused by transient voltage drops and high-frequency switching noise on the power rails.
To solve this, you need a two-tier decoupling strategy: a bulk electrolytic capacitor to supply sustained current during low-frequency load spikes (like a relay coil engaging), and a ceramic capacitor to shunt high-frequency noise (like digital switching) to ground.
| Load Scenario | Bulk Cap (Electrolytic) | Decoupling Cap (Ceramic) | Concrete Pick (Part Numbers) |
|---|---|---|---|
| Single 5V Relay or SG90 Servo | 100µF - 470µF | 0.1µF (100nF) | Panasonic EEU-FR1V101 + Kemet C315C104K5R5TA |
| ESP32/ESP8266 Wi-Fi TX Burst | 1000µF Low-ESR | 0.1µF (100nF) | Nichicon UWT1E102MNL + Kemet C315C104K5R5TA |
| ATmega328P ADC Stabilization Only | None required | 0.1µF at AREF | Kemet C315C104K5R5TA |
The Default Recommendation: For 90% of standard Arduino Uno/Nano projects driving a single mechanical relay or small servo, buy the Panasonic EEU-FR1V101 (100µF, 35V, low ESR) and the Kemet C315C104K5R5TA (0.1µF, 50V, X7R). Total cost is under $0.50, and the low Equivalent Series Resistance (ESR) of the Panasonic FR series ensures it can dump current fast enough to catch a 70mA relay coil spike without the voltage rail dipping below the ATmega328P's 2.7V brownout threshold.
Hardware Build: Parts List and Pin Mapping
To demonstrate proper capacitor placement, we will build a circuit that reads a noisy 10kΩ potentiometer while simultaneously switching a 5V mechanical relay. This is the classic "stress test" that crashes under-powered Arduinos.
Parts List
- Microcontroller: Arduino Uno R3 (ATmega328P variant)
- Load: 5V SPDT Relay Module (Songle SRD-05VDC-SL-C)
- Sensor: 10kΩ Linear Potentiometer
- Bulk Capacitor: Panasonic EEU-FR1V101 (100µF, 35V, Radial)
- Decoupling Capacitor: Kemet C315C104K5R5TA (0.1µF, 50V, Ceramic)
Pin Mapping Table
| Component | Pin / Terminal | Arduino Uno R3 Pin | Notes |
|---|---|---|---|
| Potentiometer | Wiper (Middle) | A0 | Analog input |
| Potentiometer | Leg 1 | 5V | Power rail |
| Potentiometer | Leg 3 | GND | Ground rail |
| Relay Module | VCC | 5V | Power rail |
| Relay Module | GND | GND | Ground rail |
| Relay Module | IN (Signal) | D8 | Digital output |
| 100µF Electrolytic | Positive (+) | 5V Rail | Place near relay VCC |
| 100µF Electrolytic | Negative (-) | GND Rail | Place near relay GND |
| 0.1µF Ceramic | Leg 1 | 5V Rail | Place adjacent to Uno 5V header |
| 0.1µF Ceramic | Leg 2 | GND Rail | Place adjacent to Uno GND header |
Physical Placement Rule: The 0.1µF ceramic capacitor must be within 5mm of the microcontroller's VCC pin. On a breadboard, plug it directly into the power rails immediately adjacent to the Arduino's header pins. Do not place it at the far end of the breadboard bus; parasitic inductance in the long metal strips will render it useless at high frequencies.
The Code: Brownout Monitoring and ADC Stabilization
This code targets the Arduino Uno R3 (AVR ATmega328P). It toggles the relay, reads the potentiometer, and monitors the MCUSR (Microcontroller Unit Status Register) to detect if a brownout reset occurred. If you are using an ESP32, the hardware handles this differently and will output a specific serial error (covered in the debugging section).
#include <avr/wdt.h>
// --- Pin Definitions ---
const int RELAY_PIN = 8;
const int POT_PIN = A0;
// --- State Variables ---
uint8_t mcusr_copy __attribute__ ((section (".noinit")));
int sensorValue = 0;
void setup() {
Serial.begin(115200);
// Capture and clear the reset flags immediately
mcusr_copy = MCUSR;
MCUSR = 0;
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, LOW);
// Configure ADC for lower noise (disable digital input buffer on A0)
DIDR0 |= (1 << ADC0D);
Serial.println("System Initialized.");
checkResetCause();
}
void loop() {
// Read ADC
sensorValue = analogRead(POT_PIN);
// Error handling: Check for physically impossible ADC spikes
// A 10k pot on a stable 5V rail shouldn't jump by more than 150 units in 50ms
if (sensorValue < 0 || sensorValue > 1023) {
Serial.println("ERROR: ADC Read Out of Bounds. Check wiring.");
}
// Toggle relay every 2 seconds to induce power spikes
digitalWrite(RELAY_PIN, HIGH);
delay(1000);
digitalWrite(RELAY_PIN, LOW);
delay(1000);
Serial.print("Pot Value: ");
Serial.println(sensorValue);
}
void checkResetCause() {
if (mcusr_copy & (1 << PORF)) {
Serial.println("Reset Cause: Power-on Reset (Normal)");
} else if (mcusr_copy & (1 << BORF)) {
Serial.println("WARNING: Reset Cause: Brown-out Detected! Add bulk capacitance.");
} else if (mcusr_copy & (1 << EXTRF)) {
Serial.println("Reset Cause: External Reset Pin");
} else if (mcusr_copy & (1 << WDRF)) {
Serial.println("Reset Cause: Watchdog Timer");
}
}
Debugging: First Three Things to Check When It Fails
If your project is resetting or throwing errors, follow this ranked decision path.
Symptom: The Arduino restarts when the relay clicks, or the ESP32 throws the exact serial error string: Brownout detector was triggered.
- Check Capacitor Polarity and ESR (Most Likely for AVR Resets): If using an electrolytic capacitor, verify the stripe (negative indicator) is facing the GND rail. Reversing it creates a dead short that will trip your USB port's overcurrent protection or cause the capacitor to vent. If polarity is correct, the issue is likely high ESR. Standard cheap capacitors have an ESR of ~2.0 ohms, which is too slow to supply a 70mA relay spike. Swap to a low-ESR series (like Panasonic FR or Nichicon PW).
- Check Breadboard Parasitic Inductance (Most Likely for ADC Noise): If your ADC values are jittering wildly (e.g., jumping from 512 to 800 randomly), your 0.1µF ceramic capacitor is too far from the IC. Long jumper wires act as inductors, blocking the high-frequency noise the ceramic cap is supposed to shunt. Move the ceramic capacitor directly across the 5V and GND pins on the Arduino header.
- Check the USB Power Supply Limit: A standard PC USB 2.0 port limits current at 500mA. An Arduino Uno draws ~45mA, a relay coil draws ~70mA, and an ESP32 Wi-Fi transmission spike can pull 250mA. If you are powering high-draw peripherals directly from the board's 5V pin, you are exceeding the USB port's limit, causing the host PC to drop the voltage. Use a dedicated 5V 2A buck converter (like a DROK LM2596 module) wired directly to the load, sharing only the GND with the Arduino.
For deeper architectural guidelines on power rail stability, refer to the Espressif Hardware Design Guidelines which explicitly mandate bulk capacitance near the module, and the Microchip ATmega328P product documentation for AVR-specific decoupling requirements.
Extending and Simplifying the Build
Depending on your end goal, you can either strip this circuit down to its bare essentials or scale it up for industrial-level reliability.
How to Simplify
If you want to eliminate the need for bulk capacitors on the breadboard entirely, switch to a relay module with a built-in optocoupler (such as the Elegoo 4-Channel 5V Relay Module with Optocoupler). These modules use an LED and a phototransistor to trigger the relay, providing galvanic isolation. The relay coil's power is drawn from a separate JD-VCC jumper pin, meaning the inductive kickback and current spikes never touch the Arduino's 5V logic rail. You will still need a flyback diode across the relay coil, but most modern modules include this on the PCB.
How to Extend
To turn this into a long-term power quality monitor, add an I2C OLED display (SSD1306, 128x64) and an RTC (DS3231). Modify the code to write the mcusr_copy brownout flag to the OLED and log the timestamp to an SD card. This allows you to deploy the Arduino in a noisy environment (like near a garage door motor or HVAC contactor) and return 24 hours later to read exactly how many brownout resets occurred, proving whether your chosen capacitor values are sufficient for the real-world electrical noise profile.






