Capacitor Charging Curve
Capacitor Charging Curve is a runnable microcontroller simulation example on SensBench — open the wired circuit, inspect the code, and compile real firmware in your browser, no install needed. Last updated Aug 14, 2026.
FREE SIMULATOR EXAMPLE · INTERMEDIATE
Capacitor Charging Curve
This example charges a 100 uF capacitor through a 10 kOhm resistor and prints the voltage every 100 ms — the exponential charging curve, live. The 1-second time constant lets you watch the 63% / 86% / 95% milestones arrive on schedule.
| Board | Arduino Uno (ATmega328P) + analog SPICE circuit |
|---|---|
| Difficulty | intermediate |
| Category | circuits |
| Libraries | None — just the Arduino core |
| Runs in | Sensbench browser simulator — free, no account |

The exact circuit you get when you open this example — already wired, ready to run.
The sketch
// RC Charging — observe exponential curve
// tau = R*C = 10k * 100uF = 1 second
void setup() {
Serial.begin(9600);
pinMode(8, OUTPUT);
digitalWrite(8, HIGH); // start charging
}
void loop() {
float v = analogRead(A0) * 5.0 / 1023.0;
Serial.print("V_cap = "); Serial.println(v, 3);
delay(100);
}
How it works
Pin 8 is set HIGH in setup, so the 10 kOhm resistor starts charging the 100 uF capacitor immediately. The sketch reads the capacitor voltage on A0 every 100 ms and prints it with three decimals — the readings trace the exponential curve: quick climb at first, then a slow crawl toward 5 V.
The time constant is in the comment: tau = R×C = 1 second. Watch the printed values against the clock — at 1 second the reading is about 63% of 5 V (3.15 V), at 2 seconds about 86%, which turns an abstract formula into a measured curve.
Before you build it for real
The printed curve depends on component tolerance: a real electrolytic capacitor is often ±20%, so a “100 uF” part could have tau anywhere from 0.8 to 1.2 s — the measured curve shifts visibly. The ADC loads the circuit slightly, draining a small current from the capacitor, which is negligible at this RC scale but matters for tiny capacitors. And the curve never truly ends: the last percent of charge takes forever asymptotically, which is why discharge circuits in timing applications must define a threshold rather than wait for the asymptote.
Get the parts
Related examples
FAQ
Why is the curve exponential?
The charging current is proportional to the remaining voltage gap: I = (Vcc - V)/R. As the capacitor fills, the gap shrinks, the current shrinks, and the voltage rises ever more slowly. The solution is V(t) = Vcc × (1 - e^(-t/RC)) — fast rise at first, asymptote at the end.
What does the time constant mean in practice?
With R = 10 kOhm and C = 100 uF, tau = RC = 1 second. After 1 second the capacitor is at 63% of the supply, after 2 seconds 86%, after 5 seconds 99.3% — “fully charged” for practical purposes. The 5-tau rule of thumb works for every RC circuit.