When building circuits, we often need to determine how the circuit will respond given certain inputs. This is especially true when we use energy storage elements like capacitors and inductors. If you've ever looked at a circuit board, new or old, you'll often see scores of capacitors and inductors, as well as every other type of electronic component you can think of. So how do these parts interact with and change the input signal to give us the output signal? By using the network analyzer on your Analog Discovery 2 and the Waveforms 2015 software*, you can get a better idea of how your circuit responds to various types of inputs.

For this Instructable you will need:

-Analog Discovery 2

-Waveforms 2015 software

- a computer with USB port to run the software

*You may also use the original Analog Discovery or the Electronics Explorer Board with Waveforms 2015. There are some slight differences in functionality between the AD1, AD2, and EEBoard, but nothing that will prevent you from following along if you have one of the other tools.

Step 1: First, Some Background...

Inductors and capacitors are critical components in electronics, with a myriad of applications. But they will all do one of two things, either pass or block signals through them. When we look at a simple 1st order passive low-pass RC filter, we have might have something like this:

V1 represents an arbitrary frequency generator to simulate the various frequencies our circuit might encounter.

There are many other filter options out there, but I will stick with this example to stay within the scope of this Instructable.

We know that this is a low-pass filter, which means that low frequency signals generated across V1 will pass through this circuit and can be read across C1. This also means that reading the output at the same location, high frequency signals will be attenuated, or dampened, by the capacitor. But why?

The capacitor will charge and discharge as the voltage passing through the resistor rises and falls, but it can only do it at a limited rate or speed. At low frequency, the capacitor can charge/discharge at the same rate as the output voltage coming from the resistor, so we see no change between input and output, like this:

It should be clear in this image that at a low frequency (10 Hz) the input (yellow) and output (blue) are nearly identical in both amplitude and phase.

As the frequency of V1 goes very large, the capacitor charges a little bit, but the voltage from V1 is already falling before it can fully charge, so the voltage starts to drop. It begins to discharge, but the voltage from V1 is once again on the rise before it can fully discharge. This cycle continues and the capacitor is continuously trying to play catch-up with the input. Since we are measuring the output as the voltage across the capacitor, what we see is a greatly attenuated image of the input, as well as a noticeable phase shift between the two signals. Like this:

At a much higher frequency (1 kHz) we see that the input (yellow) is nice and strong, but the output (blue) is much weaker and has shifted quite a bit to the right. To determine the phase shift, we multiply the frequency of the signal (10 kHz) by the difference between the two peaks of channel 1 and channel 2, then multiply by 360°. By inspection we see that the peaks of the two signals aren't quite 250μs apart. I'm going to call it 210μs. So we get 1000 Hz * 210μs * 360° = 75.6°. Remember this value.

Oscilloscopes offer fantastic insight into how circuits behave in reference to time. A BJT oscillation circuit or a 555 timer IC circuit would be great circuits to observe over time. But as we have seen, some circuits behave differently depending on the frequency of the input signal, not how much time has passed. This is where network analyzers come in. You can see how circuits behave as you vary the frequency, regardless of time. Let's use it to determine at which frequency we start to lose signal with our low-pass filter. This is known as the cutoff or corner frequency and is extremely important.

Step 2: The Network Analyzer

If you want some help with AD2 calibration and Waveforms installation/setup, check out this quick start I'ble collection.

Once you have everything set up, get it all connected and open Waveforms. Click on the "Network" box near the bottom left.

This will open the Network Analyzer window.

Before we get started, let's look at what we see in the window. You'll see two graphs, the top shows the magnitude of our signal and has a dB scale from 10 to -90 dB on the left. The lower graph shows phase and has a degrees scale from 180° to -180°. (The vertical axis labels are on the far right of the plot windows.) The x-axis along the very bottom of the window lists frequencies on a logarithmic scale, with major divisions at each decade of frequency. (By default 1 kHz, 10 kHz, 100 kHz, and 1 MHz. Logarithmic scales can be a bit tricky to understand at first, but it converts the logarithmic behavior of the circuit to a linear representation, which can be easier to understand visually. You can change between linear and log scales by clicking on the "Scale" box at the top.) At the far right you will see adjustments for the waveform generator, y-axis adjustments for each plot, and the channel adjustments. We will look more at those in a bit.

Build the circuit from the previous step, using a 1μF capacitor and 1 kΩ resistor as shown. Once you have the circuit built, connect the wires as shown below. "1+" connects to "W1". "2+" connects where the resistor and capacitor meet. "1-", "2-", and the cathode (negative lead) of the capacitor all connect to one of the black GND wires.

With everything connected, click on "Run" at the top of the window. The default settings aren't ideal for our circuit, so let's make some adjustments. At the top of the window, you'll see a "Start" and a "Stop" box. Enter 10 Hz for the start and 100 kHz for the stop. The data will take a few seconds to register in the window at low frequencies because the analyzer requires a few readings at each frequency before it prints the data to the window, so be patient and let it run.

We can see everything we need right now with the y-axes set to defaults, but let's make some adjustments anyway. At the right side of the screen, start at the top box labeled "WaveGen". The Network Analyzer takes control of the AD2's waveform generator to do it's thing, and here we have some limited control over it. The default settings here are fine, but you can play with it as you want later. For now, leave it and move down to the "Magnitude" box. Since our circuit is passive, we can't have any gain greater than 1 (0 dB), so the top value of 10 dB is fine, but we can adjust the range a bit. Enter 50 in the range box. Now go to the "Phase" box. The offset box tells you where your center point is on the graph. Enter in -45° here. Now enter 90° in the range box. With this circuit, we won't see a phase shift of more than 90° or less than 0° so those values are now our min/max. You should see the following in your window:

So what is this data telling us? In the magnitude window, you will see that the yellow and blue lines are the same at low frequencies, but as you increase frequency along the x-axis, the magnitude of the blue line starts to drop around 30 Hz and continues dropping from there. We also see that the signals start to go out of phase from each other almost immediately. This data corresponds to the output (blue) data we saw in the oscilloscope window at low and high frequencies.

But what else do we see here? By convention, filters are designed to start filtering signals at a specific frequency, defined in radians per second. It is a filter after all, so it has to start filtering somewhere. For the resistor/capacitor filter, this is found by finding the inverse of multiplying the capacitor and resistor values together, or 1/(R*C). To find the frequency in Hz, we then divide this value by 2π. This gives us a cutoff frequency for our circuit of ~160 Hz (1/(0.000001 F * 1000 Ω * 2π) = 159.15 Hz) . This cutoff frequency is where the magnitude of our output is 70.7% of it's maximum value. Another way to find this value is to divide your max value by √2, or 0.707107. (1/√2 has many important applications in engineering in general, but that is beyond the scope of this I'ble.) Go back to the oscilloscope and put a 160 Hz signal at 4V peak voltage into your circuit. You should expect the blue output trace to have a value no higher than 4/√2, or ~2.83V. Let's look at that.

We see that the real numbers are 3.997V for channel 1 (yellow input) and 2.809V for channel 2 (blue output). 2.809V/3.997V = 0.703, which is close enough to 1/√2 for me. I've done some rounding and assumed nominal values on the components were the actual values, all of which can account for the slight variance from ideal.

The cutoff frequency is generally accepted as the point at which your input frequency will be attenuated to a point that it is considered unusable. It's usually an arbitrary value since you want to set it well beyond the max frequency you expect your circuit to ever see.

If you click on the small X at the very bottom left corner of the network analyzer window, a small cursor will appear at the bottom of the window along with a vertical red line on the graph. Click on the small X at the bottom of the vertical red line to drag the cursor to 160 Hz. Little labels will appear on the plots showing the magnitude and phase values at that frequency. Notice on the magnitude graph of the network analyzer, at 160 Hz the magnitude of the output has dropped to a point known as the -3 dB point, which is just 3 dB below maximum. Since our max value for any passive circuit is 0 dB, we end up at -3 dB with this circuit. This point on the dB scale corresponds exactly to dividing the magnitude by √2 on the linear scale from the scope. It is also where we achieve an ideal phase shift of -45°. We can see in the plot that for the parts I used, I have a phase shift of -43.3°, which is good enough. As I mentioned before, this point is very important in engineering and has many applications that are beyond the scope of this I'ble.

At frequencies greater than our cutoff frequency, we can see that the magnitude plot begins to have a nearly linear downward slope. (It appears linear because we are using a logarithmic scale.) The slope of this line, with a first-order circuit, will be -20 dB/decade of frequency. That means that as we increase the frequency by an order of magnitude (1 kHz to 10 kHz, 10 kHz to 100 kHz, etc.) we should expect to see a drop in output signal strength of -20 dB each time we do that. By inspection I see that at 1kHz, the output magnitude has dropped to just below -15 dB. At 10 kHz, it is at just above -35 dB. It's not exactly -20 dB, but for the purpose of illustration, it looks like -20 dB to me.

By inspection. we can also see from the image above that we were also right on with our phase shift calculation of 75.6°. At 1 kHz, we see that our phase angle is right between -72° and -81°, which for this example is close enough for me.

Step 3: Another Simple Example Before We End.

Before I finish, let's take a brief look at another simple filter example. We'll take the previous passive low-pass circuit and make it into an active low-pass filter circuit with an op-amp, like this:

From the AD2, connect "1+" to the 1kΩ resistor, "1-" to a black GND wire, "2+" to GND, "2-" to pin 6 on the op-amp, "V+" to pin 7, and "V-" to pin 4. (We connect "2+" and "2-" backwards because we are using the inverting input op-amp, which imposes a 180° phase shift by default. By swapping the channel 2 leads, we negate that and get the reading we want.) It should look like this:

Once you have the circuit built, go to the Waveforms main screen and click on the "Supplies" button. The power supply box will open. One of the new features of the AD2 is adjustable power supplies. Set V+ to 5V and V- to -5V. Click on the "Master Enable is..." button to turn on the power supply so the op-amp will actually work. This is what makes this circuit active, and with the right components, we can amplify the signal, not just filter it.

Next go to the Network Analyzer window. Set the start frequency to 1 Hz and the stop frequency to 10 kHz and then click "Run". It will take several seconds to take all of the readings at the lower frequencies, so just be patient and let it run. You should get something like this:

It looks very similar, which is good. However, there is one thing you should notice first off here. See where the magnitude of our output trace is at low frequency? By adding the 2.2kΩ resistor, we've created a filter that can also give us a gain of more than 1. For this type of filter, the equation is R2/R1, so we get a gain of 2.2kΩ/1kΩ = 2.2. How does that translate to our magnitude plot when we are using a decibel scale? Take your calculated gain G (2.2) and run it through this equation: 20log10(G) = dB. This gives us a nominal gain of 20log10(2.2) = 6.85 dB.

Go to the top of the analyzer window and click on "View". You'll see a several different types of plot options for the data, but click on the one that says "cursors". (The other plot options are very useful, but I leave the learning of how and when to use them to you.) A narrow window will open up at the bottom of the screen. Click on "Normal" to place a cursor on the plots. You can click on the small "1" at the bottom of the cursor to drag it where you want. You can also enter a value into the small box at the bottom labeled "Position". Enter "1 Hz" and press Enter. The cursor will go to 1 Hz on the plot, but the values associated with each trace on each plot will populate in the "Cursor" window at the bottom. In the column labeled "C2", you'll see the gain channel 2 at 1 Hz. Mine says 6.881 dB with a phase shift of -0.811°, right what we should be expecting.

Click on "Normal" again to add another cursor. This time, drag the cursor while watching the small "Position" box to ~160°. That was our cutoff frequency previously where we were -3dB our max gain, but here we are almost a full -6 dB below our max gain. Why? Remember I mentioned that since we added a 2.2kΩ resistor our cutoff frequency had changed? Drag the cursor until you see the gain drop -3 dB below our max gain, so about 3.8 dB. It should read about 72 Hz. If we use the same equation from before, we can calculate our new cutoff frequency to be 1/(2π * 2200Ω * 0.000001F = 72.343 Hz, right where we expect it. By going back to the Analyzer window and playing with the value in the "Position" box, I found my exact -3 dB point to be 71.5 Hz.

In the "Cursors" window, we can also track our phase shift. At the -3 dB point, I have a phase shift of -43.56°, which is what I expected.

That's enough for now. There are dozens of circuit examples I could use, but as you can see the Network Analyzer is a very useful tool when you need to see how a circuit will respond to and change different input frequencies, regardless of time.

As always, thanks for reading. If you have questions, please ask them in the comments below, though PM's are always welcome as well. You just never know when someone else has the same question and that way we can all learn and help each other get better. Have fun building!

Also, please check out the Digilent blog where I contribute from time to time.

About This Instructable




Bio: I've always loved to figure out how things work, so hacking and making just fits for me. I'm an intern at Digilent Inc ... More »
More by brmarcum:Programming Digilent FPGAs Using NI Multisim Monitoring Digital Circuits With the Digital Discovery Using the Voltmeter With the Analog Discovery 2 
Add instructable to: