Link pages

Download pre-lab  here.

ECE 2100

Lab. VI- AC Signal and Second-Order Filters

Outcomes:

  • You will build passive and active RC circuits for sinusoidal (harmonic) signals and study how they "process" the signals: causing change to signal amplitude and phase as a function of frequency.

  • Specifically, each circuit selects a certain range of frequency to allow the signal pass through: a concept known as filter. Specifically, there is a high-pass filter and low-pass filter; and together, they form a band-pass filter.

  • You will compare passive and active RC filters, and explore their differences with the concept of order-of-circuit-response (that you have learned or will learn in circuit analysis): second-order (as opposed to first-order in the previous Lab).



Circuit 1 - High-pass filter
(30 pts)
Circuit 2 - Low-pass filter
(30 pts)
Circuit 3 - Combined for band-pass filter
(40 pts)
Passive circuit


Active circuit




In practice, each type of passive and active circuit are essentially the same, the only difference is the addition of an op-amp for the active circuit. You will see the difference with the op amp.

Objectives:


You will learn the concept of analog signal processing via direct empirical experience - regardless whether you have learned the theory of circuit analysis or not. Specifically, you will learn about frequency-domain filtering for harmonic signals. In addition, you will directly experience the concept and feature of second-order response: damped and oscillatory behavior.

If you have learned circuit analysis theory, this lab will reinforce and provide an empirical context into your understanding. If you have not, this lab will serve as a useful
phenomenological introduction that will help you learn the theory later. In fact, it is highly desirable that you will learn via intuition the essence of the phenomena and obtain a basic grasp of the background theory even without extensive mathematics.


Introduction and background:


First, this Lab is about empirical learning: If you have learned the stuffs, great, please review your lecture as necessary. If you have not, great, you get a chance to really learn it via experimenting, without any preconceived notion.
Hence, don't fret and just enjoy. This is all about doing the lab and observe
. Remember that the essence of scientific/engineering is all about empirical learning. That's where our knowledge come from.

Image result for and god said
                              maxwell's equations and there was light

Remember, Maxwell's equations are the theoretical culmination of numerous empirical studies of the EM phenomena. Those came first. Theory came later.

A theory is only created to help us organize and structure our empirical knowledge. Hence, while other Labs we did were to support what you learn in ECE2202, this Lab, for a change, is to put the horse before the carriage: it will give you the concepts so that you can learn ECE2202. Thus, just do it, fiddling the knobs of your instruments, monkeying around, open  your eyes, your mind, observe, think and construct your own perception and intuitive understanding. Then, refer to circuit analysis theory to see if that would help you more insight and deeper understanding.

  1. Background: capacitors. Capacitors are amazing things that capture electricity in a proverbial "bottle" (or more precisely, a package). Here is a side lecture on capacitors that you can browse through. 
  1. Basic RC circuits that you already see in lectures: resistor and capacitor in parallel or in series as shown below. These are passive circuits.

R and C in parallel
R and C in series


The output voltage is across the capacitor (and resistor), which is zero at the beginning of a pulse. It takes time for the capacitor to be charged up, resulting in a slow rise-time of the leading edge. Likewise, when the input pulse falls to zero at the falling edge, the capacitor still has charge, and the slow discharging process results in a slow decay-time at the falling edge. The wave form has a "rounding off" appearance. This is the integrating effect, and only low frequency can easily pass through.
Here, the input voltage vin= vC + vR. At the rising edge, the voltage is "instantaneously" built up across the resistor as vR, because vC is zero initially and the capacitor needs time to be charged up to have its own voltage vC. During the constant-amplitude part of the pulse, the capacitor is charged up with a characteristic RC time constant, gaining its voltage vC at the expense of the resistor output voltage vR, which decreases. At the falling edge, the input voltage drops to zero, while the capacitor still has positive voltage, hence the resistor picks up an equal and negative voltage vR=-vC to cancel out the capacitor. The waveform has a sharp appearance, giving the differentiating effect. Only at high frequency, where the capacitor charging/discharging cannot follow, can the input voltage easily pass through to the resistor.

  1. Method to solve RC circuits: Laplace transform. You are not required nor expected to solve the circuits for this lab. There are apps for you to use. There are two very similar approaches to solve these circuits: phasor or Fourier transform and Laplace transform (LT). The former is most suitable when dealing with harmonic signals (sinusoidal). It can be considered as a special case of Laplace transform method, which is particularly suitable when dealing with RC circuits with initial conditions and for general waveforms. It is straight forward to solve these circuits with LT, although it can be quite a bit tedious algebraically. For those who are interested in details, there is a write-up on this page (Lab V-B: Passive RC Circuits) of LT treatment applied to the passive circuits above.

         If you just want a quick in-a-nut-shell explanation, the figure below can help:

In a LT circuit, the capacitance is replaced with an impedance, (1/Cs) as show. If the impedance term appears directly as 1/s in a numerator, it is an integration. If it appears in the denominator, 1/s becomes s, which is differentiation.

Hence, the exact configuration of an RC itself doesn't automatically determine whether it is an integrator or differentiator: it depends on where the output is taken. One must compute the transfer function to know.

We will see that for this lab, with the use of op amp, the circuits work oppositely to the passive circuits above: the parallel RC will give differentiation while the serial RC will give integration.



Active circuits with op amp:


Instead of using voltage across a circuit element as the output, we can use the current as the signal by inputting the current into the inverting-terminal of a negative-feedback op amp.


  1. Circuit 1: High-pass filter


Basic illustration

The left hand side shows a triangle function input. The right hand side shows its derivative, which is a square wave function. This circuit is not intended for pure differentiation, but as you can see in the Laplace transfer function below, it includes a "proportional" term, which is the input itself. It is a very common part of a PID circuit. The objective of this circuit is to study the role of RC time constant on the derivative term: the larger the RC constant is, the larger is the derivative term output.


Note the magnitude comparison of the proportional term, 1 vs. the derivative term, s tau1. The larger tau 1 is, the larger is the derivative term. In PID controller, this is known as "tuning" Kd parameter, although you need not understand the inner working of PID controller at this stage.


What happens if we input a sinusoidal signal?

Clearly, for a linear circuit, the output of a sinusoidal is a sinusoidal. However, due to some small non-linearities of some circuit elements including the op amp, you may find some waveform distortion. What important to look at is the phase. Notice that excluding the Pi-phase change due to the sign inversion nature of the feedback op amp, the phase is ~ Pi/2: this is derivative: derivative of cosine is -sine. You should compare this with the integration below.

What happens if we increase the frequency? you will see that the amplitude increases with increasing frequency, this is the high-pass filtering effect.

Note a convention here in the animation above: we choose the phasor phase angle to be positive in the clockwise direction rather than the conventional counterclockwise. The purpose is to make the wave moving from left to right. Otherwise, we'll see the wave moving from right to left.


  1. Circuit 2: Integration/Low-pass filter


What do we get if we integrate a square wave? The integration of a constant signal with amplitude voltage "v" is a ramp "v t" and "-v" is "-v t". Hence, we get a triangle wave.

To see this, consider the Laplace transfer function:


Again, we can compare the magnitude of the proportional term, 1 vs. the derivative term, 1/(s tau2). The smaller tau 2 is, the larger is the integral term. In PID controller, this is known as "tuning" Ki parameter.


Consider a sinusoidal signal.

Observe the phase. Notice that after subtracting the phase for Pi (due to the sign inversion property of the feedback op amp), the phase is ~ - Pi/2: this is integration: integral of cosine is +sine. You should compare this with the differentiation above.

What happens if we increase the frequency? you will see that the amplitude decreases with increasing frequency, this is the low-pass filtering effect.

Note a convention here in the animation above: we choose the phasor phase angle to be positive in the clockwise direction rather than the conventional counterclockwise. The purpose is to make the wave moving from left to right. Otherwise, we'll see the wave moving from right to left.

 


  1. Circuit 3: Charging/Discharging oscillation


Finally, the thing that we are most familiar with capacitor is charging and discharging (discharging is just negative charging rate). We can build a simple circuit just for that. Below is an op amp oscillator:

     
This circuit is a poor-man oscillator many decades ago. It utilizes the op-amp property of extremely high open-loop gain to make it unstable (or bistable) and oscillate. There are no inputs, only outputs from nodes A, B, and C as shown. Consider at the start of a cycle when vA (node A) is low compare to vout (node C). The current flows from node C (vout) to node A (vA), charging up the capacitor with the opposite polarity of what is already there. When vA is large enough to slightly exceed vB, owing to its extremely high gain, the op amp rapidly flips to the opposite saturation voltage (e. g. -15 V), causing current to flow from node A (vA) to node C (vout). The capacitor is charging to reverse its polarity again, and the cycle repeats itself.



One measurement you want to do is the RC time constant. You can measure it by connecting node A to the oscilloscope and fit the curve with Exp[-t/RC] function (see the derivation below). Or you can just measure the period or frequency and use the relationship between f and RC.



As you can see, the RC time constant assumes a critical role in the timing of the capacitor charging and polarity flipping, and in effects, regulates the oscillation frequency. In fact, the relationship is:



Hence, one can measure the period or frequency and infer the RC time constant. Use the R1 potentiometer (10 kOhm), and R2=R3=1 kOhm, you can tune parameter heta above and observe the change in frequency f. With several measurements, you can fit the curve for a more accurate measurement of RC.


Oscillation frequency is tuned by varying potentiometer R1. Obviously, you can also change the frequency by varying the RC time constant itself.  Use a potentiometer for R instead of R1, we can have a wide range of RC time constant.


Special demo (30 pts extra)

Can you "see" (literally) the charging/discharging?

In principle, yes (you can do this for extra credit). We can put a bidirectional LED (some of you should still have it from Lab II) and see the color flipping between green and amber. However, to really "see" this, it has to switch at the human-vision frequency range, which is very low (few 10ths of Hz to ~2, 3 Hz), otherwise, all you see is a continuous shade of yellowish/greenish hue, and we can't see the process of LED brightening up and dimming down.

Of course you can use your Lab IV photosensor (if you still have it) to look at it on an oscilloscope, but then, it is no different from putting a probe at node A and see the voltage. Hence, it is better to see with our own eyes.




To make the circuit switching so slowly and to have enough current flow to light the LED, we will need huge bipolar electrolytic capacitors in the range of from 1000 to few thousands of microF, (the largest you have in your kit is 100 uF, which might not even be bipolar). For those who are interested, you are welcome to get 1,000 uF bipolar electrolytic capacitor from the TA (if we have them). Use the value of R with the default value shown in the App, then you can see the capacitor charging-and-polarity-reversal cycle with alternate LED color between green and amber. It doesn't matter which way is green and which way is amber.

The study you want to do is to compare the oscillation period (or frequency) with and without the LED. The LED takes up extra voltage and introduces an effective impedance. (Real circuit devices such as LEDs are not ideal diodes in simple circuit theory). We can see this in the below discussion.

Note: in the follow, we formally define gamma as the resistance ratio of the voltage divider (R2, R1, R3) at node C to ground. It is equal to rho define above because vB = gamma vC or vmax=gamma vsat(uration), which means gamma=rho. It is just a matter of principle that we define rho from voltage quantity while gamma from resistance network. They are equal because of Ohm's law.







The net effect is that the period is longer and frequency is lower for a circuit with LED. You will experiment by measuring and comparing the two cases. Once you have the demo showing the LED indicator of current flow direction, and write up your measurements about the change of the blinking period or frequency, you can get the TA to certify and get the extra credit.




Additional thoughts:
What happens if you take the output vout at node C and input into your Circuit 2 above?
What happens if you input vout into your Circuit 2 above? (here, trigger pulse is usually useful only with unipolarity, hence, the output from Circuit 1 has to be biased with a diode to make it positive or negative pulse only).

  1. Circuit 4 (optional): A Simple Analog PID (Proportional, Integral, and Derivative) Controller


You might have heard often of PID. Nowadays, most PID in robotics are digital, especially those commercial Arduino units that are popular thanks to low cost and being well-engineered, including widely available codes, so that anyone without much time-and-effort investment in learning can get start. It is done by computing the control signal from the sensor input and outputting the signal using a digital-analog converter like the one you built for your Project. Nevertheless, there are occasions when an analog PID works just fine.


You already built all the elements of an analog PID with Circuit 1 and 2 above:

 

 


This is the same type of problem, but it uses digital PID that can be seen underneath the plate.


 

Imagine how many controls required to do something like this




Before you get too in-awed with technology, don't forget that we humans and animals still reign supreme with analog, biological neural-network controllers

 





Back to our analog PID: notice that the left part of the circuit is simply a combination of what you did in Circuit 1, differentiation (which gives you P and D) and in Circuit 2, integration (which also gives you P and I). The right-side op amp circuit is what you did in Lab IV, which is just a simple inverting gain so that the signal sign is set to be the same as the input and which also gives gain or attenuation as needed to the PID controlling signal.

It is actually quite easy to test something like this on a mechanical contraption such as an analog servomotor or linear actuator, if we have it. But without hardware, at least we can test it electronically.


Continue to page 2