The idea is pretty simple; an mp3 player that you never have to touch. Simply hold your hand over the device to adjust volume, pause, and move to the next track. All the commands basically key on the distance of your hand from the sensor.
A little modification of the demo code for both, some enclosure work, and before i knew it I had a pretty functional little prototype.
Here's the current control scheme:
0-7cm = Pause (LED OFF)
7-30cm = Lowest Volume->Highest Volume (LED DIM)
30-50cm = Highest Volume (LED ON)
50-55cm = Next Track (LED OFF then ON)
So basically the setup works based on your hand's distance from the sensor with feedback given by the LED so you know where you are in the control scheme. There's 'dead zones' setup to avoid accidentally moving from volume mode to next track. For instance, once you're at the max volume (30cm) , there's a +20cm dead zone until you hit the next track and the LED turns bright so that you know you're at the max volume.
Whenever you move your hand away, and the distance becomes 'infinite' (ie, the ceiling) it locks in the last distance it recorded for your hand. So basically you move your hand to the volume you want, then slide your hand off to the side to lock it in.
To pause, move your hand close to the sensor until the LED turns off, then slide your hand away.
To change volume you raise your hand up or down while the LED is dimly lit, until it's brightest (then you're at max volume)
Once you're at max volume, you can pop your hand up, watch for the LED to turn off, then back down to move to the next track (then you're back in volume mode, or just move your hand off to the side).
I plan on expanding on this idea. Ultrasonic proves to be a very simplistic, but very precise user interface for just about everything I've tried it on.
What's next? An alarm clock that I can just wave my hand over to shut it off.
assembly pictures after the break:
I'll do a detailed tutorial when I get to the next phase (better package, more functionality, lcd display(?), etc)
|The music shield only leaves two analog pins available (A4 & A5).|
I used one for the LED and one for the ultrasonic
|Also had to hijack some pins on the ICSP for USB header |
(for 5v and ground)
|A resistor and an LED indicate when the music is paused (OFF), at|
maximum volume (ON), or in vol+/- (DIM)