Final Exam: Make an “IR Theremin”

Final Exam: Make an “IR Theremin”
In your final exam today, you will make an electronic musical instrument that is controlled via an infrared
(IR) proximity sensor. Your “IR Theremin” must have the following properties (note: these properties are
designed to be modular so divide your work appropriately):

An on/off momentary switch with a pull down resistor

A status LED that represents whether your instrument is on/off

A piezo buzzer for the speaker in series with a potentiometer for volume control

An infrared proximity sensor that outputs different eight different frequencies to the piezo buzzer
depending on the distance to the player’s hand (or other object). The eight frequencies should be
a major scale. Use “pitches.h,”

An LED array that provides visual feedback to the player about which note is being played. You
must use a shift register for this.

Add in a startup sequence and shutdown sequence to provide the user immediate feedback when
the instrument is turned on vs. off
On the back of this sheet, you’ll find a more detailed table of instructions along with point values for
grading.
Power Analysis
After you have finished making your instrument, I would like you to perform a power analysis to figure out
an appropriate battery power supply to make your instrument mobile. In particular, please calculate the
following—the current draw when:

all LEDs on and sound playing (potentiometer set to full volume): ________________ mA

all LEDs on and sound playing (potentiometer set to light volume): _________________ mA

all LEDs on but no sound: _________________ mA

no sound and no LEDs on except for the status LED: ___________________ mA

the system turned off via your momentary switch: ____________________ mA
Assume that you want to use a 9V battery rated at 500mAh capacity. How long would the battery last?
Justify your answer based on the above calculations.
1
Below, you’ll find the required features of your IR Theremin along with point totals. Read this list closely.
You can perform the following steps in any order but the order below represents my suggested sequence.
The bold prefixes (e.g., IR, On/Off, etc.) represent the different high-level functions of your instrument.
Your
Total
Points Points
Description of Required Feature
IR: Strip the ends of the 3-pin JST wire and use the crimping tool to crimp on three
male pins. Connect the JST to the infrared sensor
IR: Hook up and test the IR sensor (a Sharp GP2Y0A21YK Infrared Proximity Sensor)
using your IA2 visualizer. Show me the IR sensor and visualizer working. Also, take
screenshots or a picture.
IR: Using your IA2 visualizer, observe the approximate range of operation (e.g., notice
how if you get too close to the sensor, the voltage trend reverses). What are the
approximate minimum and maximum analog values? Min: __________________ Max:
___________________ Use this information to setup appropriate mapping functions in
your Arduino code.
IR, Signal Processing: In your visualizer, you may also notice that the IR sensor is
noisy. Write a smoothing filter in Arduino. I suggest a moving average filter with a
window size of 10 IR values. Graph the raw IR signal along with the smoothed signal.
Show me the graph. Also, take screenshots or a picture. Use the smoothed signal as
input to your LED array and pieze buzzer.
On/Off: Hook up an on/off momentary switch with a pull down resistor that turns
your instrument on and off. When the Arduino first boots up (i.e., is plugged in), your
instrument should be off. Pressing the momentary switch then turns it on. Pressing it
again turns it off (and so on).
On/Off: Add in a status LED with a current limiting resistor that represents whether
your instrument is on or off
Music: Add in a piezo buzzer that plays a tone in response to the IR sensor
Music: Add a potentiometer in series with the buzzer for volume control
Music: Discretize the IR signal into eight values. Each value should correspond to a
note (frequency) in a major scale and output to the piezo buzzer (the closest IR signal
should be the lowest note; the furthest IR signal should be one octave higher). Use the
Arduino tone function along with pitches.h (download here). Place the pitches.h file
into the folder that contains your .ino file. At the top of this Arduino .ino file, add in
#include “pitches.h.” Open and close the Arduino IDE for this change to take effect.
Music Visualization, Shift Register: Add in an LED array that provides visual
feedback to the player about which note is being played using a shift register
On/Off: Add in a startup sequence and shutdown sequence that lights up the LED
array and plays a tone to indicate to the user that the instrument is starting up or
shutting down
Power Analysis: Perform the power analysis and fill in the blanks
Total:
Bonus Functionality: If you have time, consider adding new features to your instrument. Write
in and describe them below. You can receive up to 10 points bonus for this.
2
5
5
5
10
10
5
10
5
20
15
5
10
100
10