Back to Basic Projects

⏱️ RC Capacitor Charge/Discharge

Watch a capacitor charge and discharge in real time on your Serial Plotter — see the exponential curve that defines electronic timing.

📋 Overview

The RC (Resistor-Capacitor) circuit is one of the most fundamental building blocks in electronics. It defines timing, filtering, and waveform shaping. Understanding it is essential for designing oscillators, power supplies, and audio filters.

Technical Insight: When a capacitor charges through a resistor, the voltage follows: V(t) = V_s × (1 − e^(−t/τ)), where τ = R × C (the time constant). After 1τ, the capacitor is 63.2% charged. After 5τ, it is 99.3% charged. During discharge: V(t) = V_0 × e^(−t/τ). Arduino samples this curve on its ADC, plotting the exact exponential you learned in textbooks.

In simple terms: When you fill a bottle (capacitor) through a straw (resistor), it fills fast at first but slows down as it gets full. The Arduino watches and records this 'filling' behavior at 50 samples per second.

What you'll learn: RC time constant calculation (τ = RC), exponential charge/discharge curves, Arduino Serial Plotter usage, capacitor behavior, and analog voltage measurement.

Estimated time: 25-35 minutes. Difficulty: ⭐ Beginner-friendly — perfect for physics and EE coursework.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R35V1
Capacitor100µF, 16V electrolytic1Observe polarity!
Resistor10kΩ1Sets time constant: τ = 10kΩ × 100µF = 1s
LED + Resistor220Ω1Visual charge indicator
Jumper WiresM-M8
BreadboardHalf-size1

🗺️ Component Pin Mapping

RC Capacitor Charge/Discharge Component Pin Mapping Infographic

📖 Step-by-Step Tutorial

1

Build the RC Circuit

Connect: Arduino pin 8 → 10kΩ resistor → Capacitor (+) → GND. Also connect Capacitor (+) node to Arduino A0. The capacitor + (longer leg) must face the resistor.
2

Add LED Indicator

Connect LED (with 220Ω) from capacitor (+) node to GND. It will gradually brighten as the capacitor charges.
3

Upload and Open Serial Plotter

Upload the code. Go to Tools → Serial Plotter. You'll see a live exponential curve rising then falling.
4

Calculate τ

With R=10kΩ and C=100µF: τ = R×C = 10,000 × 0.0001 = 1 second. The plotted curve reaches 63% of max at the 1-second mark — verify it yourself!
5

Experiment

Try different R or C values. A 1µF capacitor charges in milliseconds. A 1000µF takes 10+ seconds.
💡
Electrolytic capacitors are POLARIZED — the longer leg is (+). Connecting it backwards will damage it and may cause it to rupture. Always double-check polarity before powering the circuit.

💻 Arduino Code

rc_circuit_demo.ino
INO
// RC Circuit Charge/Discharge Demo — Volt X
// Charge: pin 8 HIGH. Discharge: pin 8 LOW
// View in Tools > Serial Plotter for the exponential curve!

const int CHARGE_PIN = 8;
const int SENSE_PIN  = A0;
const int CHARGE_TIME = 5000; // ms — ~5 time constants
const int DISCHARGE_TIME = 5000;

void setup() {
  pinMode(CHARGE_PIN, OUTPUT);
  Serial.begin(9600);
}

void samplePhase(bool charging, unsigned long duration) {
  digitalWrite(CHARGE_PIN, charging ? HIGH : LOW);
  unsigned long start = millis();
  while (millis() - start < duration) {
    float voltage = analogRead(SENSE_PIN) * (5.0 / 1023.0);
    Serial.println(voltage); // For Serial Plotter
    delay(20); // 50 samples/second
  }
}

void loop() {

Reviews & Ratings

0 reviews
5★
0
4★
0
3★
0
2★
0
1★
0
...

Loading reviews...