Infrared Theremin
PIC Projects
A theremin is a musical instrument invented by the Soviets in
the early 1900's.  You play it by moving your hands near
antennas.  The proximity of your hands change the
capacitance of the antennas which changes the pitch and
volume of the tone being generated.  The Beach Boys and
Led Zeppelin have both recorded with them.  There are
several interesting theremin clips on YouTube.  

This version uses two pairs of infrared LEDs and
photo-diodes instead of capacitors.  Placing your fingers in
front of them causes the photodiode to see the LED light
reflected by your finger.  Moving the fingers closer and
nearer changes the tone and volume.
I made two versions on this project, one for me, one for my nephew.  
The board layouts are slightly different.
I used a copper tube around the LED to protect the
photo-diode (black) from seeing infrared coming from the side.
The red LED is to help the user - it lets you see when the
device is on and where to put your fingers.  Interestingly, the
infrared is visible by the digital camera, but not with the naked
I tried to make my nephew's rugged, using a metal Life Savers
Christmas ornament as a housing.
This project had a wandering history.  I originally set out to
create a theremin that had two capacitors each made out of
two sheets of aluminum foil.  A microcontroller would charge
the capacitor and then time its discharge across a resistor.  In
this way it would be measuring the capacitance that would
hopefully change with the proximity of my hand.  Unfortunately
the capacitance of my homemade capacitor plates wasn't
changing any measurable amount.

I then switched to the LEDs and photodiodes.  I was still trying
to measure the inputs with a microcontroller.  This prototype
had a life of its own.  Since it was driving a speaker as well, the
sampling of the inputs was measuring more fluctuations in the
board voltage leading to a perpetual random note generating
machine.  Sounds like a 1960's sci-fi machine.  Here is a
I then did away with the microcontroller, making this an
analog electronic project (except for the flip-flop if you're
being really picky).
How it works:
Each photodiode drives a current when it sees infrared
light.  Each control photodiode has another photodiode
farther away wired to cancel out the effect of any
background light.  The difference in their outputs
(corresponding to the light reflected off the finger) is
converted to a voltage to be measured by the input of an
op-amp.  The setup on the right provides the voltage
which will drive the speaker.  The arrangement on the left
feeds into an oscillator circuit, changing the frequency of
oscillation.  The oscillating output drives a flip-flop chip to
cycle off and on.  The square wave generated this way
controls the base of a transistor, letting the variable
voltage from the right side drive the speaker at that
I've got almost no musical talent, so I asked a friend to
record the demo.  Here it is: