Read all the "RC Circuits Transient Analysis with Raspberry Pi and Scoppy" series:

In this short series of articles we will explore how to use cheap equipment like the Raspberry Pi Pico and Scoppy App to do a full-blown transient response analysis of RC circuits under a square-wave voltage input.

Raspberry Pi Pico

Raspberry Pi Pico is a diy-friendly microcontroller card, very popular among makers and professionals alike because it is cheap, super flexible, full of interesting features, and very easy to use and program. There are countless of online shops that sell affordable electronics starter kits that include a Raspberry Pi (like Freenove Basic Starter Kit for Raspberry Pi Pico W (aff. link)), with additional components: a breadboard, capacitors and inductances, jumper cables, etc.

Scoppy

Scoppy is an all-in-one solution that transforms your Raspberry Pi Pico into a full-fledged, two channel oscilloscope. It does that by using two main components:

  • a custom firmware for the Pico
  • an Android app that connects to the Pico via USB or Wi-Fi (only for Pico W or Pico 2 W)

RC Circuits

RC Circuits are passive circuits composed of:

  • a voltage source
  • a resistor (R)
  • a capacitor (C)

RC circuits can behave both like passive low-pass filters, when measuring the voltage across the capacitor C, or high pass filters (voltage across the resistor). Since the circuit is very simple and cheap, it is universally used in audio equipment in equalizers and tone control. If you open up your electric guitar, 99% of the time you will find a RC circuit under the "Tone" control!

We will analyze the voltage across the capacitor, but you can swap the resistor and capacitor to check different behaviors.

Theoretical Model

We won't delve into all the mathematics and physics behind RC circuits, so if you're interested in those you can find them in any good physics book. My favourites are:

The main idea is that a square wave voltage is fed into the RC circuit, then the output voltage is analyzed using an oscilloscope. Knowing the nominal values of the components we can predict how the signal should look like, and comparing that to measurements to see if they match.

Here is the schematics of the circuit:

RC Circuit

We have:

  • a square-wave power source, marked as \(V_g\): it will be connected to the Pin 22 of the Pico and will provide a signal that jumps between 0.0 - 3.3 V
  • a resistor with resistance \(R\)
  • a wire that goes to the ADC Pin 26 of the Pico: it will measure the voltage difference across the capacitor
  • a capacitor with capacity \(C\)
  • ground connection (GND)

Charge Accumulation Phase

When the signal is high (3.3 V for the Pico) the condenser will accumulate charges on its plates. At the beginning the accumulation rate will be very fast, but eventually it will slow down due to saturation. This is modeled using the following equation of voltage vs time:

$$ V_C(t) = V_g(1 - e^{-t/RC}) $$

where \(t\) is the elapsed time, and \(V_C(t)\) is the evolution of the voltage over time. You can clearly see that this is a function that starts rising very quickly and asymptotically saturates to \(V_g\) after a certain amount of time.

Since \(R\) and \(C\) variables always appear together, we create a separate variable \(\tau = RC\) (Greek letter tau) and call it Time Constant. This variable is a characteristic of the circuit and is an indicator of how "quickly" a RC circuit responds to voltage variations:

  • higher \(\tau\) (= longer reaction time): the curve will evolve more slowly
  • lower \(\tau\) (= shorter reaction time): the curve will evolve more quickly

The above equation is now a bit simpler:

$$ V_C(t) = V_g(1 - e^{-t/\tau}) $$

Discharge Phase

In this phase the voltage source drops to zero, letting the capacitor discharge. As in the charge phase, the capacitor will react very quickly initially, and then progressively slow down over time (we are talking about milliseconds here!).

The equation for the discharge is the following:

$$ V_C(t) = V_g\cdot e^{-t/RC} = V_g\cdot e^{-t/\tau} $$

Here is a picture of what to expect to see in the oscilloscope in the Charge (left) vs Discharge (right) phases:

RC Circuit

Next Steps

In the next article (2 - Building the Circuit) we will assemble the circuit and do some preliminary tests.