RC circuit understandings

I am trying to understand the principles of a RC charging / discharging circuit however I'm at loss regarding certain aspects of its operation.

I have a square wave generator giving 0v to 5V levels at certain frequency, say 1Khz at 50% duty cycle. My R = 3.3K and C = 100nf.

My thinking is that if the capacitor charges during the high state of the generator and discharges equally during the low state of the generator. Then it shouldn't have any charge left and should remain at that level(uncharged). However when I try it practically I find that eventually the capacitor charges to some mid level, that is 2V which my mind can't really comprehend.

Does the capacitor charge and discharge and different rates in an RC circuit what exactly is going on over then I can't really explain, can you?

The key is the RC time constant. This is the product of the resistance and capacitance in series. For your example, that would be 3,300 ohms * 0.0000001 farads, which results in 0.00033 seconds. In order for the capacitor to fully charge or discharge, you need to wait for 5 time constants. In your example, the capacitor will reach only about 75% of full charge / discharge during the half period of the 1 kHz square wave. Consider decreasing your frequency, or using a smaller capacitor or resistor.

Other possible issues can include:

• Incorrectly connecting the circuit. The capacitor, resistor, and function generator should all be in series.
• Using the wrong tool for measuring the voltage. For the results you are expecting, you need an oscilloscope. A multimeter won't give you the same results unless your time constant is near a second in magnitude.
• The pattern generator has a high output impedance. This is unlikely, but if the impedance is close to your resistor value, that will throw off your calculations.
1. When you are charging the voltage difference on the resistor is 5V (cap = 0V, output = 5V). When you switch the output to 0V the cap had some voltage X which was lower than 5V.

During the discharge the voltage across the resistor is smaller than 5V, the current is also smaller and so less charge gets removed from the capacitor.

So charge and discharge rates are not the same.

2. When will they be the same? When the voltages across the resistor are the same. This happens when the average voltage across the capacitor is Vcc/2 which is what you have measured.

3. The general rule is that the voltage on the capacitor equals to the averaged input voltage. If you use a bigger capacitor and/or resistor, the longer it will take for the average to settle (the circuit will have more "inertia" or "memory").

• In reference to rule three, this can be true but as you tweek resistor and cap values you tweek your cutoff frequency. If you go to a lower cutoff frequency, it takes longer to charge, higher frequency charges faster but has greater ripple. – Kortuk Apr 11 '10 at 22:16

If your square wave frequency is low enough the RC filtered signal will follow the square wave closely, although with less steep edges.
But this needs 5T (RC time constants) to more or less reach you 5V or 0V; after 5T about 99% of the final value is reached.

In our case

$1T = RC = 3300\Omega \times 100nF = 330\mu s$

and one period is $1000\mu s$, so a half period is only 1.5T. That means that the signal doesn't have the time to reach 5V when going up, or 0V when going down: whereas for a shorter time constant the signal would more look like this: Note that in the second case (this is for a time constant $T = 33\mu s$) the signal reaches both 5V and 0V, while it doesn't for our case; the time is simply too short.

Now about the 2V you're measuring. If you measure this with a DMM it's easy to explain: the DMM averages the measured value. If you actually see it on a scope it probably looks a bit like this: This shows the same effect we saw earlier: the time constant is way too long, and the capacitor has hardly the time to start charging and discharging. Here $T = 3.3ms$.
If this is what you see there might to be something wrong with your components; check if they're really $3300\Omega$ and $100nF$. If the values are right you may have an extra impedance in series with the resistor.

• where do you get those graphs? i'm not questioning the validity of their content, i'm asking, what tool generates them? – JustJeff Sep 13 '11 at 11:33
• @JustJeff - Excel. I would use Mathematica, but I'm still learning how to use that. Yes I know, normal people would use some version of SPICE! ;-) – stevenvh Sep 13 '11 at 12:00
• +1, Excellent explanation with astounding graphics! Amazed to see that we could do this with Excel. – Kevin Boyd Nov 10 '11 at 21:03

How are you measuring this 2V? From context it sounds like you may be using a multimeter rather than an oscilloscope. To really see what's going on in a circuit like this, the oscilloscope is the instrument of choice. You would be able to see from the symmetry of the charge and discharge curves that the the rates are indeed the same.

But it sounds like you are using a meter, and with a device that just gives you a number, understanding what's going on requires some interpretation.

It seems reasonable to interpret the input signal you described as a 5V peak-to-peak square wave riding on a 2.5V DC offset. So if you use a DC measuring device, you might expect to measure this 2.5V DC level across the capacitor.

If your measuring device happens to be a DVM, you can reasonably ignore the effects of the meter on the circuit. Even cheap digital meters have megohms of impedance and will not load down the k-ohm scale circuit under test. However, these kinds of meters vary widely in their ability to make sense of time-varying inputs. Some are good just for checking batteries. Some will give you a fair DC reading in the presence of sinusoidal AC, but not with more complex AC. Some will give you true RMS no matter what the shape of the waveform.

And if you are measuring using an old mechanical-movement type meter, you have to bear in mind that, as volt-meters, these meters are equivalent to a few k-ohms, maybe 10's of k-ohms at best. Hooking this kind of a meter into the circuit you describe will very certainly load the circuit and change its behavior significantly. You will get readings to be sure, but you have to interpret these knowing how the circuit is affected. In the case of the R-C setup you describe, this kind of meter would read lower than a DVM, on the basis that its resistance would help discharge the cap while contributing nothing to charging it.

I assume your circuit has the resistor in series with the cap and the cap is tied to ground, that is you've built a single pole low pass filter.

With R = 3.3k and C = 100nF the -3db point will be ~482Hz. At 1kHz the response will be ~ -6dB.

With that time constant i would expect the voltage across the cap to be a rough sinusoid with a low peak to peak level (0.5-1.0v maybe?) and a DC offset of 2-2.5V, depending on the quality and type of capacitor.

As to why this happens....

When the input is high, the cap is charging but never reaches 5V because of the time constant you've chosen. When the input goes low the cap begins to discharge but again it never fully discharges.

Move the -3db point up to maybe 9kHz and you'll likely see more of what your expecting, which is a squareish wave looking thing with charge and discharge tails instead of sharp edges.

You can think of this in the frequency domain if you want to make it easier to think of. A square wave is made of its fundamental frequency + only odd harmonics. To retain the shape of the signal you'll want its fundamental (1kHz in your case) and at least its first few harmonics (3k,5k,7k,9k,etc) intact. The higher order harmonics give the signal its sharp square edges so if you filter those out you'll get the charge/discharge tails you were expecting.