Tinker, Learn, and Do Engineering with NI myDAQ - Lab 8: Beer Bottle Symphony

Publish Date: Feb 20, 2012 | 0 Ratings | 0.00 out of 5 | Print | Submit your review


As part of the National Instruments Tinker, Learn, and Do Engineering with NI myDAQ course ware, the hands on experiments demonstrate the wide range of possibilities of using NI myDAQ hardware.

The 10 lab experiments cover a wide range of topics including analog and digital circuits, sensors and signal processing of audio sound tracks.

View all of the labs for the Tinker, Learn, And Do Engineering With NI myDAQ course ware.

Table of Contents


In college, a group of students and professors get together to build a beer bottle symphony. Beer bottles of various sizes and shapes are used to generate the notes of a scale. Bottles are filled with different levels of water. By blowing across the top of a partially filled bottle, a resonant note is sounded. The note’s fundamental frequency depends on the level of liquid in the bottle. Once the orchestra is tuned up, the concert can begin.

Fig. 1: Beer Bottle Symphony Requires a Few Good Friends and Some Partially Empty Bottles

This Lab uses myDAQ with a microphone to tune a bottle partially filled with water to a specific note (Fig. 1). With a collection of tuned bottles, a song can be played.

Table of Contents

  1. Required Components
  2. Exercise 8-1: Getting Started
  3. Exercise 8-2: Exploring Sound
  4. Exercise 8-3: Generating a Calibration Frequency Curve
  5. Appendix: Building a Microphone Preamplifier
  6. Related Links

Required Components


Download the files above to access the courseware pertaining to this lesson that illustrate how the mDAQ can be used with NI LabVIEW covering a range of tools from introductory level exercises to design challenges.


  • NI myDAQ
  • 3.5mm Sub-Miniature Stereo Cable (comes with NI myDAQ)
  • iPod and Earphones
  • Stereo Computer Speaker Set (optional)
  • Computer-Type Microphone (JWIN-JMP10 mini laptop microphone for about $5)
  • Empty Glass Bottles (beer or pop)
  • Microphone Preamplifier
    • Op Amp 741 or TI uA741
    • Resistors: 2.2 kΩ, two 22 kΩ, 220 kΩ, and 2 kΩ Pot
    • Capacitors: 10 μF and two 1 μF
    • 3.5 mm Sub-Miniature Stereo Jack and Socket
    • myDAQ Power Supply +15
    • Breadboard

Prerequisite Reference Materials:

Exercise 8-1: Getting Started

Audio Check

Connect your iPod stereo cable to the myDAQ input [AUDIO IN] socket. Connect your earphones or computer input jack to the iPod [AUDIO Out] socket.

Open and [Run] the LabVIEW program entitled Audio Control.vi.

Start your favorite song on the iPod. Sound will tell you that the iPod signal is being streamed from your iPod through the LabVIEW program and back out to the speakers. Use the volume control sliders on the front panel to verify that both channels are working.

Open the block diagram, as shown in Fig. 2.

Fig. 2 Basic Pass-Through Program to Stream Audio from myDAQ

The stereo signals (blue lines) are broken out into left and right channels (orange lines). These signals can be measured and manipulated and then reconstructed (merge function) into a stereo signal for the speakers.

Remove the iPod connection from the [AUDIO IN] and connect your microphone to the myDAQ iPod input [AUDIO IN] socket. [Run] the program again with the microphone input.

Note:  The output is noticeably delayed in time.  This is a property of the computer intercepting and modifying the signals before it is reproduced on the speakers.

Aside: In analog sound systems, placing a microphone in front of a speaker yields a huge feedback sound. In the myDAQ version, the delay prevents any feedback signal.

At the end of Lab 7, it was stated that real-world signals are rich in harmonic content. In the next section, we are going to view and measure that harmonic content.

Capturing and Analyzing Real-World Signals

Load the program Spectrum.vi and look at the front panel (Fig. 3). Connect your iPod stereo cable to the myDAQ input [AUDIO IN] socket. Start a favorite song on the iPod and [Run] this program.

Fig. 3   Spectrum.vi Displays the Real-Time Signal and the Frequency Spectrum

You can hear the music, see the signals in real time, and view the audio spectrums. You can also use the volume controls to enhance the signals or look at the left (red) and right (blue) channels separately.

Look at the block diagram in Fig. 4 to see how it was done.

Fig. 4 Spectrum.vi Block Diagram


The only addition to Audio Control.vi is a LabVIEW Express VI (Spectral Measurements). This VI performs a fast Fourier transform (FFT) and generates a spectrum data set of ‘Power versus Frequency’.  Two graphs have been added on the front panel (Fig. 3) of the signal in real time and its power spectrum in frequency space.

Note: There is also an NI ELVISmx mono version of the spectrum analysis available on the Launcher strip called digital signal analysis (DSA), which has more flexibility in the measurement units and parameters.

Replace the iPod source with your microphone and check out your singing voice. Are you a soprano, tenor, alto, or bass? Is your singing better in the shower?

Note: Adjust the volume on sliders to enhance the spectrum.

Exercise 8-2: Exploring Sound

Listen to the sounds around you. Now you can both hear and analyze them.

Here are a few suggestions.

  1. Take a crystal wine glass and flick it with you fingernail. Crystal glass will ring for a few seconds. Try to measure the resonant frequency and watch the signal decay with time. What happens when you add a little water into the glass?
  2. If you have a fan, measure its frequency spectrum at low, medium, and high speeds.
  3. Place the microphone near a refrigerator and look at the spectrum. Are the sounds the running motor/compressor makes related to the 60 Hz frequency of the supplied wall current?
  4. A shower makes a great white noise source.
  5. Got a musical instrument nearby? Look at the spectrum for a few notes. For example, a guitar generates simple spectrums for each string. Try playing a chord (rich in harmonics).

Resonant Frequency of a Beer Bottle

Take an empty beer bottle and fill it half full of water. Place your lower lip on the top and blow firmly across and into the open bottle. Once the resonant note is struck, slow the blowing and sustain the sound for a few seconds.

Open the program Tuning.vi and look at the block diagram, as shown in Fig. 5.


Fig. 5   Tone Measurements Find the Frequency of the Tone with the Highest Amplitude

Another Express VI called ‘Tone Measurements’ has been added to Spectrum.vi. The Tone Measurements VI takes a block of data and determines the frequency of the strongest signal (the fundamental or a harmonic).

Place your microphone about one centimeter from the bottle top.

Run the program Tuning.vi and capture the resonant frequency of the bottle.

Note: If your microphone has trouble generating a large enough signal for the spectrum display, then a low-cost preamplifier maybe required (see the Appendix at the end of this lab).

Now tinker with the liquid level until you get a resonant frequency close to one of the musical scale notes.

Frequencies of a four-octave music scale are given in the following table.                                 


































Exercise 8-3: Generating a Calibration Frequency Curve

A calibration curve of resonant frequency versus liquid level or volume is useful in setting up a musical scale. Once you have the calibration curve, you can use it to predict the volume required to generate other notes.

Load and use a modified version of Tuning.vi (Tuning with Hold.vi), which has a [HOLD] button to make it easier to capture note frequencies.

Take your beer bottle and measure the resonant frequencies for about 10 different liquid volumes or levels.

Plot the ‘Resonant Frequency versus Liquid Volume’ curve and draw the best fit.

Note: The program Calibrate BB.vi provides a LabVIEW solution to plotting and fitting your data. See Fig. 6.

Fig. 6   Polynominal Curve Fitting Program for Generating a Calibration Curve     

If you are going to cover a couple of octaves, you should select several different sized bottles. The larger the bottle is, the lower the frequency range. A calibration curve for each bottle shape makes tuning the ‘Beer Bottle Symphony’ musical instruments easy.

The Beer Bottle Symphony

One tuned beer bottle is required for each note of the scale. Gather together a bunch of friends for a jam session. Each person can handle one or maybe two notes. Pick a music selection and begin to jam. Who knows? With a little practice, your group maybe the next big sensation on youtube.com.

Appendix: Building a Microphone Preamplifier

There are several low-cost microphone preamplifier kits which can be built to boost the microphone signal levels.  These differ from audio amplifiers (built in lab 7) in that they prepare a microphone signal to be processed by audio equipment, whereas audio amplifiers amplify the signal to be output by external speakers, earphones, etc.”


Fig. 7 A Microphone Amplifier Kit

The kit shown in Fig. 7 is available at


You can also build your own circuit using a Texas Instrument instrumentation amplifier:


Another solution using one op amp, as shown in Fig. 8, is found at


Related Links

  1. Go on to Lab 9: Karaoke Circuits, part of the Tinker, Learn, And Do Engineering With NI myDAQ courseware
  2. Go on to Lab 7: Let's Make a Little Noise, part of the Tinker, Learn, And Do Engineering With NI myDAQ courseware
  3. Back to the Tinker, Learn, And Do Engineering With NI myDAQ course ware
  4. Watch this introductory NI myDAQ video to learn more about the educational design platform
  5. Find more courseware on NI ELVIS II, NI LabVIEW, and NI Multisim


Back to Top

Bookmark & Share


Rate this document

Answered Your Question?
Yes No