# Measure a capacitor using an oscilloscope

Posted by Fred C (W6BSD) on Mar 24 2022

In my last article, I showed how to measure an inductor using a known capacitor. This method could be used to measure a capacitor using a known inductor. This post will demonstrate a better and more accurate way to measure a capacitor using an oscilloscope.

Usually, a capacitor's value is printed on the component. But sometimes, the marking has faded away, or some capacitors may lose their capacitance over time due to ESR1. It is especially true for electrolytic capacitors.

## How it works

The time constant in seconds, designed by the Greek letter Tau (τ), is equal to the circuit resistance in ohms, multiplied by the circuit capacitance in Farads.

$$\tau = RC$$

Tau is the time required to charge a capacitor in series with a resistor to a level of 63.2% of the initial value of 0V.

For example, suppose we have a circuit with a 12 Volt battery charging a 500µF capacitor through a 3kΩ resistor. One time constant τ = 1.5 seconds. After 1.5 seconds, the capacitor is charged to 63.2% of the 12 volts supplied by the battery, which would be around 7.5 Volts.

\begin{align} \tau &= RC \\ &= 3000 \times 500 \cdot 10^{-6} \\ &= 1.5s \end{align}

In our case, to determine the value of an unknown capacitor, we could build a circuit with an unknown capacitor in series with a known resistor and a power source. Using an oscilloscope, we can measure how long it takes to charge the capacitor to 63.2% of the initial voltage. We can rearrange the previous formula to calculate the value of the unknown capacitor.

$$C = \frac{\tau}{R}$$

## The circuit

For this test, I am using a (4.7kΩ) resistor in series with the capacitor. The signal generator acts as a power source and sends the square wave. The oscilloscope on the right will measure the time it takes to charge the capacitor.

One of the PWM2 pins of a Raspberry-Pi Pico will generate the square wave signal to charge and discharge the capacitor. I could have used any microcontroller such as an Ardiuno, ESP8266, or ESP32.

I will use the PWM pin 16 from the RPi Pico for this experiment. Below, you will find the program's source code written in MicroPython. This program generates a 1 kHz square wave with a duty cycle of 50%. Please refer to my previous article for more information about this program.

from machine import Pin, PWM, Timer

led = Pin(25, Pin.OUT)
timer = Timer()
timer.init(freq=2, mode=Timer.PERIODIC, callback=lambda x: led.toggle())

pwm = PWM(Pin(16))
pwm.freq(1000)               # 1kHz
pwm.duty_u16(int(65535/2))   # duty 100% = 65535


## Measurements

Adjust the voltage and the time knobs on your oscilloscope until you see a square wave. You will probably also have to adjust the trigger. I have set the trigger on the rising edge of the square wave on the oscilloscope.

Measure the Vpp3 of the square wave. If, like me, you are using a Raspberry-Pi Pico as a square wave generator, you should measure a Vpp at around 3.4 Volts. In the example below, a 3.36 Vpp is displayed at the bottom of the screen. Depending on your oscilloscope, you might have to use cursors to take that measurement.

Now you can adjust the oscilloscope time base to zoom in on the rising edge until you see the curve corresponding to the charge of your capacitor, as shown in the picture below.

To measure the time constant τ, you need to measure the time it takes to go from the initial voltage 0V to 63.2% of the Vpp.

\begin{align} Ve &= Vpp \cdot 0.632 \\ &= 3.36 \cdot 0.632 \\ &= 2.12 \end{align}

I use the Y1 cursor at the base of the wave and the Y2 cursor at the 2.12Volt mark. See ΔΥ = 2.120V in the picture below.

Place the X1 cursor at the leading edge and the X2 cursor where the rising edge crosses the Y2 cursor. In my example below, ΔX shows a time of 524 nanoseconds.

Using the following formula, we can determine the value of the capacitor.

• The resistor marked at $$4.7kΩ$$
• τ is equal to $$524 \cdot 10^{-9}$$ seconds
\begin{align} C &= \frac{\tau}{R} \\ &= \frac{524 \cdot 10^{-9}}{4700} \\ &= 111 \cdot 10^{-12} \\ &= 111pF \end{align}

The marking on the capacitor used for this experiment is 100pF. A value of 111pF is not great but within the 20% tolerance of a ceramic capacitor.

## Using the discharge time

As you can see in the screenshot below, we can also use the discharge (falling edge) to determine the value of a capacitor.

## Conclusion

If you don't have an LCR meter handy, a function generator and an oscilloscope can be helpful to measure a capacitor value. You can expect a capacitance value of 3%-5% uncertainty. The level of uncertainty will depend on the resistor's tolerance and the overall quality of the test setup. This method will be more accurate than some cheap LCR meters found online.

1. Equivalent Series Resistance

2. Pulse Width Modulation

3. Voltage Pick to Pick