# Prelab 10

You are not logged in.

Note that this link will take you to an external site (https://shimmer.csail.mit.edu) to authenticate, and then you will be redirected back to this page.

Goals: In Lab 10 we're going to design, build, and test the Sallen-and-Key filter that we need in the ultrasound velocity circuit.

## 1) Recap

First, let's recall again what we're trying to do with the Doppler ultrasound system, and what we've done so far. Our overall system block diagram looks like:
• We create ultrasound using the transmit stage. In this stage, we first use the Teensy to create a square wave, and then we use an amplifier to amplify the voltage.

• That ultrasound bounces off an object. If the object is moving, it changes the ultrasound wave frequency by a little bit. We are trying to discern that frequency change.

• To do that, we first amplify the received signal approximately 10\times using our receive amp.

• Then we want to turn the signal into a square wave to make it easier to manipulate. The comparator does this. Remember, we can do this because the information we care about is the frequency of the signal, which remains unchanged when we turn it into a square wave.

• Then we want to measure the frequency of that digitized signal. Rather than measuring the frequency of the digitized signal directly, we first multiply the received signal with the original transmit square wave using an XOR gate.

• You'll recall from lab7 that this created a signal with two main frequency components, one at \delta f, the doppler shift frequency, and one at ~ 80 kHz. We want to remove the component at 80 kHz. We'll do that in this lab with a low-pass filter.

## 2) Design the S-K filter

The filter that we'll make in this system uses the Sallen-Key topology. This filter was invented in 1955 by two engineers at MIT Lincoln Lab (oh yeah!). There are different configurations depending on whether you want to create a low-pass, high-pass, etc. We want a low-pass filter, which looks like:

There's a detailed set of design guidelines here. However, we can simplify things.

One is to realize that at DC the two capacitors are open-circuits and thus drop out, and because no current goes into the op-amp's positive input terminal, that the voltage across R_1 and R_2 is zero. In that case, R_A and R_B form a non-inverting amplifier with gain:

A = 1 + \frac{R_A}{R_B}

In our case, we want a DC gain of 1, so we will use a simple buffer, thus choosing R_A=0 and R_B=\infty.

Then, if you make the assumption that R_1=R_2=R and C_1=C_2=C, you can determine that the cutoff frequency of the filter will be:

f_c = \frac{1}{2\pi R C}

Pretty simple, right?

Here are the specs:

• DC gain of 1 (~0 dB)
• Have the cutoff frequency be at 1kHz
• A -40dB/decade rolloff above the cutoff frequency
• Use no more than one op amp
• No need to include source resistance
• No need to incorporate virtual ground of 2.5 V. In other words, tie C2 to ground in your simulation
• Resistors \ge 5\, k\Omega to minimize currents
It is much better to design this amp using the equations, and then verify with simulation. Do not design by trial and error. That is not what good engineers do.

For the circuit simulation and testing below:

• Use a 5V supply to power the op amp (set the op amp's power supply pins to 5V and ground).
• Place a DC Voltage Source named input as your input (case sensitive) and give it a value of 1V.
• You can reference your input and C2 to ground, i.e., you don't need include a 2.5 V virtual ground (like we do in the actual system we're building).
• Name your input node In and your output node Out using the Node Label icon.
• Set the op-amp's internal gain to 1e6.
• Add a probe at the output of the op amp (I don't know why this is required).

Two small snapshots of parts of a working schematic are shown below for reference (with values removed):

Until you have the sources properly named, the op amp powered, a ground in your circuit, and the input and output nodes properly labeled, submitting will throw a semi-cryptic Python error. Treat this as feedback that one of those things must be missing. You can also try to run an AC simulation from 10 Hz to 100kHz as a quicker, local way to test your circuit.

Feel free to post on piazza if you're having trouble with the circuit simulator below. Also click on the "Right Angle" option below to remove the right-angle routing if you'd like.

We're going to make the simulator below optional since it is having issues in people's browsers. Try to use it to help you generate your design for a bit, but don't stress if it is failing.