Introduction: Ping Organ
http://www.youtube.com/watch?v=6F4xoe1rQMs
Step 1: Parts
1. Arduino
2. Range Sensor (I used a Parallax Ping))) that I picked up a Defcon a couple of years ago, anything like this would work as well http://www.sparkfun.com/products/639)
3. A small speaker (I pulled mine out of an toy moose that sang Blue Christmas)
Ultrasonic range finders basically work by sending out an ultrasonic signal and then they sense how long it takes to come back. Think sonar for a submarine.
Step 2: Schematic
The Schematic is pretty simple. Speaker to Arduino pin 11 and ground. Ultrasonic range finder to power, ground, and Arduino pin 7
Step 3: The Code
The code is pretty simple. I just combined the Ping demo and the Tone demo that come with the Arduino UI. I did it a couple of different ways. You can either take the distance in inches or cm and multiply it by a number (i.e. inches * 10) to get a frequency that's playable. Then as you move around you'll get different frequencies. To make it more playable I got the frequencies of actual notes and told them to play that note when the distance was within a range (I used 20 cm for each note range). Then you just have it play the note. I've attached the sketch.
Attachments
Step 4: Now Dance!
There are many ways you can "play" this organ. You can step in front of it. Put your hand or other object in front of it. Or, like my kids, just flail around in front of it and it makes music.

Participated in the
Microcontroller Contest
Comments
11 years ago on Introduction
Good little "ible!
I've tried it and it works ok, though the code might need a bit of tweaking as sometime it latches on a single "note" This though might be due to the limitations though of the Ping sensor...
Also I am curious if one could modify the code or circuit so that it could send out CV/Gate messages to a drum machine/synth.. Also maybe adding more "ranges" or "notes"....
Also *note* if you want to view the distances the Ping sensor is reading the Serial Monitor has to be set at 9600baud, anything below 9600baud yields gibberish in the serial monitor, also anything set higher 2800baud also yields gibberish.
Other than that this is a really easy one to wire up and is quite fun...
(fun as in annoying to everyone else!)