 # Choosing R and C for Our RC Circuit

## Introduction

In order to control the rate at which voltage changes in the circuit, we must consider the values of the capacitor and resistor. In a circuit, the capacitor controls the voltage across its terminals depending upon how charged it is. The resistor limits the amount of current passing through the capacitor, which in turn affects the rate at which the capacitor charges. The equation describing this relationship is Vc = Vs( 1 – e-t/RC), where:

• Vc is the voltage of the capacitor
• Vs is the voltage of the source
• t is the time in seconds
• R is the resistance in Ohms (Ω)
• C is the capacitance in Farads (F)

Trying to limit the how fast the voltage Vc can change by manipulating the previous equation can be difficult. Instead we can use the circuits’ time constant to accurately approximate the capacitor’s voltage.

## RC Time Constant

The time constant is a time period determined by the circuits R and C values. It is measured in seconds and denoted with the variable (τ) tau. Tau is very easy to find since τ = R×C. An RC circuit’s time constant is useful because it directly relates the values of R and C to the capacitor voltage. It has been shown that charging a capacitor for one time constant will result in a 63% charge. If the capacitor charges for two time constants it will be 86% charged, which is displayed in Fig. 1. Charging for three time constants yields a 95% charge. Similarly the time constant also governs how fast a capacitor can discharge. After one time constant a fully charged capacitor will be at 37% of its original voltage. After a 2nd time constant it will be at 13.5% see Fig. 2.

## Choosing values for R and C

Even though the charging relationship with tau is not linear it guarantees that a capacitor will be 99% charged or discharged within 5 time constants. Knowing this we can scale R and C to make the capacitor charge quickly or slowly. For this project we want our capacitor to charge slowly relative to the voltage spikes created by the button bounce and fast compared to a button press. If the capacitor charges too quickly compared to the voltage spikes, it will not debounce the button very well. If the capacitor charges too slowly it will make the button press look longer than it actually was. For our application we don’t really care if the button press seems a little longer. We want to focus on removing the noise of the button bounce. It’s safe to assume voltage spikes will be no longer than 100 μS. With this in mind we can pick our R and C values.

• Let's say R = 10 KΩ and C = 10 µF.
• Our time constant is given by τ = R × C.
• So τ = 10×10-6 F × 10000 Ω = 0.1 Seconds.

Now let’s see if this time constant fits within the time constraint.

• Slowest possible voltage spike = 100 µS
• τ = 0.1 S = 100000 µS
• 100000 µS is much larger than the slowest possible voltage spike, so the capacitor will smooth out the any bounce noise we see.

Now let’s see what our RC filter does to a button signal. Figure 3 shows what a button press looks like without the RC filter while Fig. 4 shows what the button press look with the filter.

It is easy to see that the RC filter limits how fast the voltage can rise or fall. This is all that really matters for implementing our circuit but if you look closely there are two odd things about Fig. 2. The first is that the time constant is different when charging and discharging. The second is that neither the charge nor discharge time constant exactly matches our calculated value. Although it is concerning that our circuit isn't working exactly as expected, these oddities have little impact on getting our project functioning. If you like, you may skip over the remaining material. Otherwise it is a good idea to understand why our circuit is misbehaving.

## Origins of the Circuit’s Oddities

To determine the cause of our circuit's odd behavior, let’s examine the facts. Looking at Fig. 2., the full charge time for the capacitor is about 200 ms while the full discharge time is about 400 ms. This means τ = 40 ms while charging and τ = 80 ms while discharging. The inconsistent time constants occur because we have overlooked how our RC filter will react once it is added to an existing circuit. You can see that a button separates our RC filter from a current limiting resistor. When the button is pressed the current limiting resistor is connected to the RC filter changing the charge time. When the button is released our RC filter is isolated so the discharge time almost matches our calculated value. The reason it almost matches is due to the error in the actual values of our components. After measuring the 10 KΩ resistor used in the RC circuit the actual value turns out to be 9850 Ω. This should be expected since 9850 Ω is within the acceptable 5% variance (denoted by the gold stripe) of the resistor. Now that we know R actual and τ actual we can calculate the real value of our capacitor.

So, 80 ms / 9850 Ω yields a real world value of 8.12 µF, which is close to the rated 10 µF.

The slight variance in component values accounts for the difference between our calculated and actual discharge time constant. Again for our project these discrepancies don’t really matter. The lessons to take away from this are:

1. Incorporating a separately designed circuit into an existing project can have unforeseen consequences.
2. Component values are never exact. If a project requires a lot of precision be sure to account for the actual component values.