Fork me on GitHub

Project Notes

#012 Capacitorial - Graphing Capacitor Discharge

Use an Arduino to charge a capacitor and graph the discharge with Processing.

Here’s a quick video of the circuit in action:

Capacitor discharge graphs with Arduino and Processing


The circuit uses a digital output pin to charge the capacitor. When the pin is brought low, the LED will be powered by the capacitor discharge (through a current-limiting resistor). A diode prevents the discharge from being fed back into the digital output pin.

The voltage at the positive terminal of the capacitor is read with an analog input pin, with the value echoed to the Arduino serial port.

Grapher (a simple Processing sketch) reads the data from the serial port and plots the value over time, with some coloration effects thrown in for good measure. In other words, we’re using Arduino and Processing as a basic oscilloscope! And it kind of works, mainly because the frequency is so low.

The Breadboard Schematic

The Build

Varying the capacitance

Varying the capacitance will affect the storage potential and discharge rate.


At 47uF, the capacitor is given enough time to fully charge (note the plateau), and discharge is very rapid. 47uF





Credits and References

Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.