Lab 5: Underwater Acoustics and Fourier Analysis

Team size: 4

Submission Sheet: html docx

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:

  1. 11 kHz sine wave, amplitude 1.5 V, offset 0 V.
  2. 12 kHz sine wave, amplitude 1.5 V, offset 0 V.
  3. 11 kHz square wave, amplitude 1.5 V, offset 0 V.

Do the following:

  1. Connect a function generator to an input channel of the oscilloscope.
  2. Double check that your oscilloscope channel is DC coupled and using an appropriate 1x/10x setting.
  3. Drive signal 1 into the oscilloscope
  4. Set the time scale of the oscilloscope so that 50 cycles of the signal fit on the screen.
  5. 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.
  6. Capture an oscilloscope trace for the current signal, and for each of the signals below.
    1. Signal 2
    2. Signal 3
    3. Signal 3 with the the “window” setting changed from rectangular to Hanning.
    4. Signal 3 with the time scale changed to shrink the horizontal time axis.
  7. 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.
    1. Turn off the FFT function on the scope
    2. 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.
    3. Ensure the “max length” setting is selected on the “save” menu and save the waveform
    4. Take the FFT of that data in Matlab with a rectangular window
    5. Take the FFT of that data in Matlab with a Hanning window
    6. 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.

  1. Build the reference circuit from the datasheet for your electret microphone.
  2. 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.
  3. 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.

  1. 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).
  2. Calculate the bandwidth you expect out of each op-amp stage using the gain-bandwidth product of your op-amps.
  3. Test your amplifier using appropriate signals from the function generator.
  4. 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.

Figure 1: Test tank with beacons and long microphones

Prepare for your experiment by making models of what you expect to see

  1. Find an analytical expression that describes power at a distance from an acoustic emitter.
  2. 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.
  3. 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.
  4. 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

  1. Attach a tank microphone to your amplifier from Section 3, and attach the amplifier output to an oscilloscope channel.
  2. 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.
  3. 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.
  4. Make three plots, one for each beacon, showing the analytical model of beacon power on the same axes as your measured points.
Warning

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.

Note

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.

Figure 2: Teensy sampling rig
  1. Connect a tank microphone to a Teensy sampling rig,
  2. Connect the rig to your computer with a micro USB cable
  3. 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).
    1. Edit the Matlab script to set the COM port
    2. Edit the Matlab script to set the sampling frequency
    3. Run the script
    4. 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.
    5. Repeat steps 2, 3 and 4 for the second sampling frequency.
  4. 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.
  5. 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.
  6. 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.
Note

Be sure to return electret microphones, power amplifier boards and speakers to the electronics table.

Note

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.