Lab 5: Underwater Acoustics and Fourier Analysis
Team size: 4
Prelab Help Sheet: None for this lab, but you’ve got this! Review previous ones for ideas of how to prepare.
Writing Assignment: html
1 Introduction
In this lab you will work as a team of four to use acoustic measurements to find the position of your robot in the test tank. The acoustic measurements will depend on listening to beacons at fixed locations in the tank, and guessing your position relative to them. Because there will be many beacon signals in the tank at once, you will need to use Fourier analysis to understand the behavior of the signals. The purpose of this lab is to demonstrate the power of underwater acoustic measurements and to force you to wrangle early and often with Fourier analysis.
After successful completion of this lab, you will be able to:
This is a rotation lab, so not all teams will be working on this lab in the same week. Odd numbered teams (11, 23, 35, etc.) will do this lab in week 6, while Even numbered teams (12, 24, 36, etc.) work on Lab 6. Even numbered teams will do this lab in week 7, while Odd numbered teams work on lab 6. Be sure to watch the correct videos, do the correct quiz, and put in prelab effort for the correct lab!
2 Introduction to the FFT
The oscilloscope ( Agilent/Keysight 2024A, spec sheet ) has a feature that allows it to display a live FFT of a signal on one of the channels. In this section we’re going to use that feature to study the basic behavior of the FFT and to examine the effect of windowing on real world data. The whole team should participate in this section, at minimum by watching. Much of this section can be predicted and analyzed very accurately in prelab with sample data generated in MATLAB.
The following signals are used in this section:
- 11 kHz sine wave, amplitude 1.5 V, offset 0 V.
- 12 kHz sine wave, amplitude 1.5 V, offset 0 V.
- 11 kHz square wave, amplitude 1.5 V, offset 0 V.
Do the following:
- Connect a function generator to an input channel of the oscilloscope.
- Double check that your oscilloscope channel is DC coupled and using an appropriate 1x/10x setting.
- Drive signal 1 into the oscilloscope
- Set the time scale of the oscilloscope so that 50 cycles of the signal fit on the screen.
- Use the math function of the oscilloscope to display the FFT of the signal. Set the span of the FFT to 100 kHz, the center to 50 kHz, and the window to rectangular.
- Capture an oscilloscope trace for the current signal, and for each of the signals below.
- Signal 2
- Signal 3
- Signal 3 with the the “window” setting changed from rectangular to Hanning.
- Signal 3 with the time scale changed to shrink the horizontal time axis.
- Capture some oscilloscope data and take an FFT of it using Matlab, then compare that FFT to the scope FFTs. Do so by following these steps.
- Turn off the FFT function on the scope
- Drive signal 3 into the oscilloscope and make sure that you are using the original x-axis scaling, not the shrink described in instruction 6.4.
- Ensure the “max length” setting is selected on the “save” menu and save the waveform
- Take the FFT of that data in Matlab with a rectangular window
- Take the FFT of that data in Matlab with a Hanning window
- Contrast the Matlab FFT against the scope FFT from instructions 6.2 and 6.3.
3 Circuit Interfaces to Microphones
You will need to use microphones to pick up sounds in the tank. We will be using a waterproof electret microphone called the CME-1538-100LB.
- Build the reference circuit from the datasheet for your electret microphone.
- Verify that you can receive signals with your electret microphone by clapping near it. You will need to set your scope to “Single” mode to capture your clap.
- Use the FFT functions to identify the frequencies in your hand clap signal.
The electret microphone output is small (generally 10s of mV depending on the sound) and zero centered, so you will need to amplify the tank signals to see them your oscilloscope. Designing an amplifier is trickier than you’d expect because of an op-amp parameter called the Gain-Bandwidth product.
- Build an amplifier with a gain of 100 by cascading two stages that each have a gain of 10. Use dual-rail op-amps (like the TL081 or OP07).
- Calculate the bandwidth you expect out of each op-amp stage using the gain-bandwidth product of your op-amps.
- Test your amplifier using appropriate signals from the function generator.
- Record your test results and your amplifier schematic in the submission sheet.
The reference circuit’s output is AC coupled, which means a capacitor is attached in series with the output. The capacitive coupling is why the microphone output is zero-centered. One way to understand the function of the coupling capacitor is by considering equivalent circuit models. The AC coupling capacitor and the loading from the oscilloscope combine to form a high pass filter. (Consider drawing a full circuit model to see that this is true.) This high pass filter DC signals while allowing high frequency signals to pass. Because DC has to be zero Volts at the filter output, the output signal has to be zero centered.
The electret microphone only has two ports – they are listed as Term 1 and Term 2 in the reference circuit – but those ports have to achieve three functions: provide a ground reference, provide power, and provide output signal. Term 2 is used for ground, which is pretty normal. However, Term 1 is used for both power and output signal. Delivering power on the signal line is called “Phantom Power” in more sophisticated audio systems, and it works because power is delivered at DC while the audio signal resides at higher frequencies.
You need to use dual-rail op-amps for this design because your input signal (the microphone output) is zero centered and your gain is high. It’s possible to build a pair of offset amplifiers that provide a gain of 100 and appropriate offsets, but dual rail op-amps simplify your design.
If your first amplifier stage is a non-inverting amplifier, then add a large resistor (~100k) between the positive amplifier input and ground. This resistor is necessary to prevent the input leakage current of your op-amp from changing your results. You don’t need this resistor if your first stage is an inverting amplifier.
You may need to solder leads to this electret microphone to plug it into your breadboard. You should consider twisting the leads together to form twisted pair wire. These wires do not need to be very long. In the tank room, you will be provided with water-proofed microphones with long leads so that you can dip the microphones into the tank while your circuits remain on the work tables.
4 Distance Measurement Based On Amplitude
One way to locate your robot in the water is to listen to three acoustic beacons and calculate your distance to each of them based on the beacon power received at your robot. Three beacons are installed in the test tank and will be constantly emitting sine waves of approximately 9 kHz, 11 kHz and 13 kHz, and that setup is pictured in Figure 1. You will need to use the microphones in the tank room, which have long wires, to put a microphone into the tank and measure the signals coming out of these beacons. Analyzing microphone data with the FFT will be essential because the signals of all of the beacons are present in the tank at the same time.
Prepare for your experiment by making models of what you expect to see
- Find an analytical expression that describes power at a distance from an acoustic emitter.
- Your measurements in the tank will be FFT magnitudes of Voltages received at your microphone. Convert your analytical expression from describing received power to describing your expected FFT magnitude.
- You won’t have all the parameters for your analytical function (TX power, P-to-V conversion), but you can fit your model to your measured data anyway. Figure out how can you fit a function with unknown parameters to your measurements. Making some fake data in Matlab to test out your procedure may help.
- You need to be sure that your measurements capture evidence of multipath in the tank, and achieving that will require careful spacing of your measurements. Figure out how closely you need to space your measurements in order to observe multipath.
Then carry out measurements in the tank
- Attach a tank microphone to your amplifier from Section 3, and attach the amplifier output to an oscilloscope channel.
- Use your microphone, assisted by the oscilloscope FFT, to figure out which beacon corresponds to which frequency. The orientation of your microphone relative to the beacon can affect your measurement, so be sure to align the receive mic with the transmit speaker.
- For each beacon, measure the received Voltage magnitude as you move your microphone away from the beacon. As a reminder, the spacing of your measurements is very important for spotting an important real-world phenomenon called multipath, and you’ll need to rely on your earlier calculations to figure out that spacing.
- Make three plots, one for each beacon, showing the analytical model of beacon power on the same axes as your measured points.
We are using both benchtop electronics and water in this lab, and the two don’t mix, so BE EXTREMELY CAREFUL when putting anything in the water, removing anything from the water or mounting anything near the water. Instructors will stop your experiments if they think they pose a water hazard to equipment.
Though this section shows that it’s possible to measure a robot’s position using power decay from a beacon, it’s much more common and reliable to measure a robot’s position using the time-of-flight of an acoustic pulse. See the time-of-flight reference design for more details on how to use time-of-flight measurements for sounding.
5 Sampling Audio with a Teensy
This section requires that you use the Teensy sampling rigs (shown in Figure 2) that have been set up in the tank room. The rigs consist of an amplifier with an offset attached to an E80 motherboard that samples the amplifier output. We provide software, E80_Lab05_Teensy_Rig.m and E80_Lab05_Teensy_Rig.ino (which is already running on the rig), that allows you to adjust the sample rate of the Teensy, and we’re going to use that power to explore how sample rate affects real world data samples.
- Connect a tank microphone to a Teensy sampling rig,
- Connect the rig to your computer with a micro USB cable
- Use the E80_Lab05_Teensy_Rig.m software to measure vectors of sample data with sample rates of 10 kS/s and 100 kS/s (kilosamples per second).
- Edit the Matlab script to set the COM port
- Edit the Matlab script to set the sampling frequency
- Run the script
- Your sampled data will be in the
micSignal
variable, so save that variable under another name. Note the sampling frequency and the number of samples. - Repeat steps 2, 3 and 4 for the second sampling frequency.
- Plot the magnitude of FFTs of the 10 kS/s and 100 kS/s sampled data. Describe any differences between the resulting graphs and explain what causes the differences.
- Plot the first 100 points of the time data for the 10 kS/s and 100 kS/s signals. Pay attention to the x axis of the signals. Describe any differences in the measured data and explain why they are there.
- What is the minimum sampling rate you should use to measure signals in the tank? Prove it by sampling data at that frequency and presenting an FFT of that data.
Be sure to return electret microphones, power amplifier boards and speakers to the electronics table.
In this section, as always, we connect to your Teensy pins through the E80 motherboard, which has protection circuits designed to prevent damage to the Teensy.