Measuring capacitance

 with an Arduino Uno

Capacitance is typically defined as the ability of a body to store an electrical charge. More specifically, any object that can be electrically charged exhibits capacitance.

 A multimeter or multitester, also know as a VOM (Volt-Ohm Meter) can be used to measure the capacitance of a capacitor, but what if you don’t have one handy?

As it turns out, capacitance can be measured with an Atmel-based Arduino Uno (ATmega328) – sans external components and only ~20 lines of code. 

A blog post, written by Jonathan Nethercott that was recently featured on HackADay, explains how.

“[He] does an excellent job explaining a capacitance test circuit which uses a reference capacitor to calculate the unknown capacitance,” writes HackADay’s James Hobson. 

”He further explains that, with the Arduino Uno, you can remove the reference capacitor from the circuit, and simply use the stray capacitance present in the board and microcontroller, which can be calculated.”

Meaning, creating a test circuit is as simple as plugging in a capacitor to pins A0 and A2. On the software side, Nethercott’s code sense a 5V pulse to the capacitor – measuring the voltage on the other side, looping every half second and outputting the data onto a chart.

Nevertheless, as HackADay’s Hobson notes, the above-mentioned technique does require some calibration, with Jonathan measuring a known capacitor for a baseline and using the confirmed data to calculate the stray capacitance in the Arduino. 

Once accurately calibrated, users can typically achieve a resolution of approximately 1% for capacitors between 3.5pF and 225pF and around 5% for capacitors between 0.5pF and 1300pF.

Interested in learning more about how you can macgyver your Arduino Uno to measure capacitance? You can check out Jonathan Nethercott’s detailed blog post here.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s