UNIVERSITY of PENNSYLVANIA
DEPARTMENT of ELECTRICAL ENGINEERING

ESE205: Electrical Circuits and Systems I Laboratory

Capacitors (Part 2) - Pulse Counter and Self Timer

Goals

To build two complex circuits that use capacitors and op-amps to perform various functions. In doing so you will:

1. familiarize yourself with the exponential waveform
2. learn about parallel and series combinations of capacitors
3. observe the filtering action of an RC circuit

Background

In the previous lab you learned that capacitors can store charges and act as short-term memory elements (that is the basis for the operation of DRAMs in your PC). You also know that when one charges a capacitor with a constant current, the voltage over the capacitor increases linearly with time, as shown in Figure 1a. This is a direct result of the expression

I = C × dV/dt
Indeed, one can solve the above equation for V to get, (1)
Thus, the voltage increases linearly with time. The larger the current, the faster the voltage over the capacitor will increase, as is illustrated in Figure 1b. Figure 1: (a) Capacitor charged by a constant current I and the hydraulic equivalent; (b) the voltage over the capacitor as a function of time.

We will now consider the case when the capacitor is charged up through a resistor and a constant voltage source, as is shown in Figure 2. This circuit is a little more difficult to understand but is quite common in electric circuits. Let's get an intuitive understanding of what happens in this case.

In the beginning when no charge is stored on the capacitor, the voltage V over the capacitor is zero. The current I with which the capacitor is charged up is then, according to Ohm's law, equal to: I=(Vcc − 0)/R. Now, when the capacitor charges up, the voltage over the capacitor increases, as seen in Figure 2b. As a result, the current that charges the capacitor will decrease: I=(Vcc − V)/R. The capacitor will thus charge up at an increasingly slower rate. The larger the voltage V becomes, the slower the capacitor charges, as illustrated in Figure 2b. Figure 2: (a) A capacitor charged up by a constant voltage source through a resistor R; (b) voltage over the capacitor.

In class you derived the exact expression for the voltage over the capacitor (by solving the first-order differential equation). The expression can be written in a general form as: (2)

Here, Vi is the initial voltage (at t=0+), Vf is the final value (at time t=infinity) over the capacitor, and τ is the time constant RC. For the example of Figure 2a, the expression for the case of charging the capacitor is equal to, (3)

For the case of discharging the capacitor, the exponential waveform is equal to, (4)

The above expressions represent an exponential waveform which, together with sinusoids, are two of the most important waveforms in electronic circuits. It is important that you understand the exponential waveform well. Here are some of the more important features:

1. The slope of the waveform at the origin (t=0) is equal to Vcc/t, as shown in Figure 3. Thus, the time constant can be found by extrapolating the initial slope with a straight line until it intersects the final voltage level over the capacitor. Figure 3: Exponential waveform and time constant: (a) charging of C, and (b) discharging of C.
2. When t= τ, e-1 = 0.37 and 1- e-1 = 0.63. Thus, after one time constant, the capacitor will be charged up to 63% of the final value, as illustrated in Figure 3a above. The table below shows how the voltage varies after multiple time constants. It is interesting to note that (only) after 5 time constants the voltage over the capacitor had reached 99% of the final value. The increase (or decrease) of the voltage gets slower and slower as the voltage reaches its final value, as expected, because the current gets smaller.
TABLE I

 Time t e-t/t 1-e-t/t 1t 0.37 0.63 2t 0.14 0.86 3t 0.05 0.95 4t 0.02 0.98 5t 0.01 0.99 6t 0.003 0.997

You don't need to memorize these numbers, particularly as they are easy to calculate using the exponential. However, the value for t=iτ and t=5τ are very handy to know.

Pre-Lab Reading and Questions

***Please do your entire pre-lab, individually, in your lab notebook, starting on a new page. It will be checked for completion at the beginning of your lab section.***

1. It is often easier to measure the rise and fall time of a waveform. The rise and fall times are defined as the time it takes for the waveform to rise from the 10% to the 90% level or fall from the 90% to the 10% level, respectively, as shown in Figure 4. Prove that the relationship between the rise or fall time and the time constant is as follows, (5) Figure 4: Definition of rise/fall time

2. Consider the simple RC circuit of Figure 5a. Find the initial voltage V(0+) over the capacitor, the final voltage and the time constant. Give the expression v(t). Sketch v(t) carefully and label the axis. Also indicate the value of the time constant τ. Figure 5: RC circuits with (a) single capacitor and (b) two capacitors in series.

3. The circuit in Figure 5b is similar to the one in Figure 5a except for the two capacitors in series. Find the new value of the time constant of the circuit. What is the expression of v(t)? Sketch v(t) on the same graph as the response of Figure 5a above.

4. Next you will design a timer circuit that can be used in cameras with a self-timer. We will be making use of the time it takes to charge up a capacitor through a resistor. The circuit is shown in Figure 7. A buzzer will go on during the delay time for which the circuit has been programmed. Figure 7: Self-timer circuit

We will be making use of a relay to switch on the buzzer. Relays are useful devices which are used in many applications from telephone switches to power stations to pinball machines. A relay is an electrically controlled switch. It consists of a coil that pulls down an armature when a current flows through the coil as is schematically shown in Figure 7. When the relay closes, the buzzer is powered and will start to buzz.

When you press the switch S1 over the capacitor, the voltage V will be zero (see Figure 7). The capacitor will charge up slowly. As long as this voltage V(t) is below the voltage on the non-inverting input of the comparator, the output voltage of the comparator will be high. This will energize the relay and close the  switch S2 which causes the buzzer to go on. The diode is put in series with the relay so that only current in one direction can flow (and thus the relay will not be energized when the comparator output is negative).

We want the buzzer to go on for 3 seconds after you discharge the capacitor (i.e. push the switch S1).

Find:

a. the value of the resistor R that will give you the required delay of 3 seconds, using the values of the elements shown in Figure 7.

b. Assume that you want to make the delay variable. You could use a variable resistor R (potentiometer) or change the voltage at the non-inverting input. Let's choose the latter option. What voltage would you need to apply on the non-inverting input of the comparator in order to make a delay of 10 seconds using the value of R calculated above? In practice, we can use a potentiometer to adjust the voltage at the non-inverting input.

In-lab assignment

A. Equipment:

1. HP function/waveform generator
2. triple-output power supply (HP E3631A)
3. digital oscilloscope
4. RLC meter (Philips PM6303)
5. Two probes
6. Protoboard
7. Assorted resistors and capacitors
8. DIP relay
9. Op-amp LM741
10. Buzzer
11. Diode 1N4004
12. Red/blue box with cables and connectors
13. PC
B. Procedure
1. You will be using scope probes (two per station) to measure and display the waveforms on the scope. First check to see if the propes are properly compensated using the reference square wave on the scope's front terminal underneath the display. Remember that a probe is adjusted when the square wave has a flat top and bottom.

2. Pulse Counter Circuit (based on your Lab 7 prelab)

1. Build the circuit of Figure 8 including your circuit (the ? block) to switch on the LED. Have your circuit checked by the TA before building it. A switch shown in Figure 8 is a pair of wires whose ends can be touched momentarily. Use the switch to reset the integrator by discharging the capacitor. Notice that the value of the capacitor is different from the one used in the Lab 7 prelab. Figure 8: Pulse counter circuit
2. After building the circuit, apply a voltage Vs that simulates the output of the sensor, as shown in Figure 8. Use a 1Hz square wave with a 20% duty cycle and a voltage that varies between 0 and 5V (you will need to apply an offset voltage and set the function generator to "high-Z"). Verify this input waveform on the oscilloscope.

3. Reset the switch (touch the end of the wires) and observe the input Vs and the output voltage Vo of the integrator on the oscilloscope.
4. In order to see these slowly varying signals use the "Roll" mode. Press "Horiz" on the top of the panel, then change the "Time Mode" to "roll" on the bottom-left of the screen.

When you display the output of the integrator after resetting the capacitor, there is a good chance that the output of the integrator is not constant between 2 pulses, in contrast to what we expect as shown in Figure 9a. The slope of the output can be upwards or downwards depending on the OpAmp. This is due to the offset voltage of the Op-Amp. You can compensate for this by subtracting an offset voltage from the input signal Vs. Instead of having Vs go between 0 to 10V, adjust the lower level (using the offset control on the function generator) flat as in Figure 9b (this level can be positive or negative depending on the slope of graph in Figure 9a). The output voltage of the integrator should be flat between two pulses as with the solid (blue) line in Figure 9a Figure 9: (a) output of an ideal integrator (solid line) and an integrator with offset voltage (dotted line); (b) adjust lower level of Vs until curve in (a) is flat between two pulses.

5. Verify that for each pulse at the input, the output decreases by 1V (use the cursors). You can stop the waveform by pressing the STOP/RUN key on the top right of the panel. To continue, push the STOP/RUN key again. Also verify that after 10 pulses the LED goes on. Adjust the time scale so that you can see the 10 sensor pulses on the display as well as the output of the integrator.
6. Another handy way to verify the operation of the circuit is to display both the output of the integrator (e.g. on channel 1) and the output of the circuit that drives the LED (e.g. on channel 2). Verify that indeed the circuit switches on after the 10th sensor pulse has been integrated.

7. Have the TA check your circuit (give a demo) and sign your lab notebook. Save the oscilloscope reading of the output of the integratori and the output of your LED control circuit (the ? block) showing that the LED turns on after 10 pulses (after resetting the capacitor). The counter designed above is a good illustration of how a capacitor can remember previous states, in this case up to 10 pulses, that arrived at an earlier time. By resetting (shorting) the capacitor one erases its memory and can start off fresh.
3. Timer circuit.

1. Build the timer circuit of Figure 7 (repeated below) on your protoboard using a value for R as close as possible to the one calculated in the prelab. Measure the actual resistance and record the value in your notebook. You will be using an 22 uF electrolytic capacitor. Remember that these are polarized and must be connected with the right polarity. If not, there is a chance that the capacitor will explode! Be careful! Measure the exact value of C with the RLC meter and record the value in your lab notebook. Figure 7 (repeated): self-timer circuit

Use a 10 kOhm potentiometer to adjust the voltage at the non-inverting input of the comparator to 2.5V. Measure this voltage with the multimeter.

The relay comes in a DIP (dual in-line pin) pakage as shown in Figure 10a. The pin numbers are indicated in figure 10.   Figure 10: (a) DIP relay with pin numbers; (b) buzzer, 5V DC Solid State Buzzer
2. First, display the voltage over the capacitor and check at what time it reaches 2.5V. The signals are very slow. The best way to display them on the scope is to use the Roll mode, as you did with the pulse counter. To measure the time accurately, set the voltage cursor at 2.5V and see when V(t) crosses this level. Push the STOP button to hold the display. You can now use the time cursor to measure the time.

Based on the measured values of R and C, at what time should the capacitor reach 2.5V? Compare the calculation with the above measurement.

Does the buzzer switch on at that time? If not, debug your circuit.

3. Now display both the voltage over the capacitor and the output of the comparator on the scope. Check that the comparator switches at around 3 sec. Record this time in your lab notebook. Take a screenshot of the oscilloscope.

4. Change the potentiometer so that the buzzer is on for 10 seconds after pushing the switch. Measure the voltage at the non-inverting amplifier and compare this with your hand calculations from the pre-lab.

4. Extra Credit (10 points)

Let's now illustrate that a simple RC circuit, as shown in Figure 9, is also a filter. Figure 9: (a) low pass filter and (b) high-pass filter

a. Build the circuit of Figure 9a. Use a sinusoidal input voltage Vs with an amplitude of 0.5V (or 1Vpp). Display the input voltage on channel 1 and the voltage over the capacitor on channel 2 of the scope. Vary the frequency as shown in Table II and record the amplitude of the corresponding output Vo (use the voltage measurement function of the scope). What do you notice for low frequencies as compared to high frequencies? Plot Vo(f) as a function of frequency (you can use Excel or another plotting tool). This circuit is a low pass filter (low frequencies pass at will but high frequencies are attenuated or filtered out).

TABLE II

 Freq. f (Hz) Vc (Fig. 8a) Vc (Fig 8b) 10 20 40 80 100 200 400 800 1000 2000 4000

b. Select a frequency of 2kHz and a square wave. Observe the output waveform on the scope (adjust the voltage scale to see the waveform clearly). How does this circuit behave? What can you conclude from experiments a and b? (i.e. A low-pass filter is also a ...?). Take a screenshot of Vs and Vo.

c. Do the same for Figure 9b as in section a above. What does the circuit of Figure 9b do (as a function of frequency). What type of filter is this circuit?

d. Now, select a square wave of frequency 100 Hz and display the voltage Vo on the scope. Notice that this circuit differentiates the input signal. What can you conclude from experiments c and d?

References:

1. J.D. Irwin, "Basic Engineering Analysis," 5th ed., Prentice Hall, Upper Saddle River, NJ, 1996.

2. T. Hayes and P. Horowitz, "The Art of Electronics - Student Manual", Cambridge University Press, Cambridge, MA, 1989.

Back to ESE205 Homepage

Created by Jan Van der Spiegel: April 10, 1997;
Updated by Jan Van der Spiegel: April 13, 1998
Updated by Sriram Radhakrishnan: November 7, 2011