If you are a current student, please Log In for full access to the web site.
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.
Before starting this lab, make sure you have:
2) Lab 7 overviewIn this lab we'll prototype and test the comparator and mixer stages on the receiver side. First, let's remind ourselves of what we're trying to accomplish with our overall system:
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 ~ 10x using our receive amp.
Then we want to digitize the signal to make it easier to manipulate. The comparator does this.
Then we want to measure the frequency of that digitized signal. Rather than measuring the frequency of the digitized signal directly, we will multiply--also known as mixing--the received signal with the original square wave using an XNOR gate. This will make it easier to extract out the frequency.
3) ComparatorIn order to do the mixing described above, we want to first turn the sinusoid amplified by the receiver into a digital signal. We can do this because the information in the signal is present in its frequency, and that information is preserved if we encode it as a sinusoid or as a square wave. And the square wave, since it is digital, will be easier to process.
Obtain a MAX941 comparator from the central table, and populate your board with it and the two resistors that you designed in the comparator design in ex06. Take a look at the [full system schematic](COURSE/ultrasound/Ultrasonic Velocity Sensor Schematic V1_4_NV.pdf) to see where these parts fit in.
No more giving you the stage diagrams. Time to start getting familiar with the overall system circuit!
To test your comparator:
Power your board with 5 V and 30 V (and gnd, of course) as before.
Apply a sine wave of 200 mVpp at 40 kHz to TP3. Connect the ground of your signal generator probe lead to the negative terminal of the receiver transducer. You'll have to hold it there, unfortunately. This setup is meant to simulate the output from the ultrasound transducer.
Scope the signal at TP4 and make sure the signal there is centered at 2.5 V and is amplified by the gain you designed for your receiver to have in the last lab.
Add a second scope probe to measure the signal at TP5 and make sure it is a square wave where the transitions from 0 to 5 V occur at the voltages specified in the comparator design.
Show your working circuit to the staff. Be prepared to explain how the signals at TP3, TP4, and TP5 relate to each other.
Now that we have a digital received signal, we want to measure its frequency. We're going to do that by multiplying the digital received signal with the original square wave that we sent to the transmitter. This step can be a bit confusing at first. Let's explore why we're doing it.
A moving object will change that frequency. We can get a rough sense of the frequency change with some back-of-the-envelope calculations. The Doppler effect results in a frequency shift of:
where \omega = 2\pi f. The speed of sound is c = 343 m/s.
Rather than make a frequency measurement device that is accurate to that level, we can greatly relax the measurement challenge if we take advantage of the fact that we have the original signal (the transmitted signal) available to us.
Although we are working with square waves, the math is a bit cleaner with sinusoids. Imagine we have an original transmitted signal:
When it bounces off an object, the frequency changes a little bit, such that the received signal is:
If we multiply these two signals, we can take advantage of a trigonometric identity:
Use this relation to determine the two frequencies present in v_o = v_i \cdot v_r:
Thus, multiplying the two signals creates two other signals, one directly at the frequency of interest. Multiplying two signals to alter their frequencies is a very common operation, so common that it is given its own name: mixing. It is used all over the place in communications.
To isolate the lower frequency signal from the higher frequency signal, we'll need to remove (aka filter out) the higher-frequency signal, which we'll do in the following stage (in a few weeks).
4.1) Digital multiplication
We could multiply analog signals, as shown mathematically above, but the circuitry to do that is more complicated and expensive than multiplying digital signals. And since the original signal (from the Teensy) is a (digital) square wave, it makes sense to do the multiplication in the digital domain. The prelab has an excellent explanation of how to do digital multiplication, and why an XNOR gate is a good way to do it.
To multiply two digital signals v_i and v_r, we use a XNOR gate. A XNOR gate has the following logic table, where in our case 0 (logic LO) refers to 0 V and 1 (logic HI) refers to 5 V:
Let's implement it.
Obtain a CD4077 IC from the staff table and add it to your board in the appropriate location.
Connect the XNOR gate to the output of the comparator by using a jumper at the 2-pin header J3.
Connect the output of the XNOR to TP6 using another jumper at header J4.
Make sure the signal at TP1 is being input into the XNOR as well. By default, this path is open via the 3-pin header J2. Connect pins 1 and 2 on J2 (these are the top two pins out of the three pins at J2 when the board is oriented such that the transducers and the ICs are facing you). Connect these two pins using a jumper.
Power your board with 5 V and 30 V (and gnd, of course) as before.
Set up a reflector about a foot in front of your ultrasound transducers.
Apply a square wave of 3.3 Vpp with 1.65 V offset at 40 kHz to TP1. Scope this test point using Ch 1 of your scope. Make sure the trigger is set to look at Ch 1.
Add a second scope probe at TP5, which is the output of the comparator.
Add a third scope probe to TP6, the output of the XNOR gate. Look at all three signals on the scope. It is helpful to set the Volts/DIV to 5 V and to vertically offset the three signals. Keep the two input signals at the top, and the output of the XNOR gate below.
You should be able to see the three signals and verify that the XNOR gate is XNOR-ing the two signals. You should also see that the phase shift bewteen the two inputs changes as the reflector moves. Indeed, if you could measure the phase shift precisely you could discern the distance to the object, and certainly distance changes.
Right now, it is difficult to see any frequency shift, so in the next step we'll want to filter the signals to make the frequency shift more apparent.
Show your working circuit to the staff. Be prepared to explain how the signals at TP1, TP3, TP4, TP5, and TP6 relate to each other.
Before you leave, it's time to clean up again! Steps for cleanup:
- Carefully pick up your system and place into its plastic case.
- Throw away loose wires on your desk.
- Throw away paper, food, etc. on your desk.
Show your cleaned-up lab space to a staff member.