Introduction: Ultrasonic Party Starter
Have you ever wanted the party to start as soon as you enter the room? Now it can every time with the Ultrasonic Party Starter!
This project uses an Arduino and an HC-SR04 sensor to kickoff the party. If you are unfamiliar with the HC-SR04, it is an ultrasonic ranging module. They can be found for very cheap (I got mine on amazon for $3.77 -
http://www.amazon.com/gp/product/B0089VA3AY/ref=oh... ).
It acts much like sonar - creating a pulse of sound or "ping," then measuring the time it takes for the echo to return. We will use it to detect when an object is within a certain range of the device and trigger an RGB LED to flash to the beat of Daft Punk's Aerodynamic.
If you are new to using the Arduino to play sounds, I suggest you start out with the tone tutorial found at the arduino website - http://www.arduino.cc/en/Tutorial/Tone.
If you have never used an ultrasonic ranging module try out http://www.arduino.cc/en/Tutorial/Ping.
The code I wrote for this device was inspired by both of these projects.
Now let's get this party started!
Step 1: Party Parts
The parts you will need:
Arduino Uno
Breadboard
0.5W speaker (8 ohm)
Potentiometer (for volume control)
RGB LED x 1
100 ohm resistor (brown black brown) x 1
330 ohm resistor (orange orange brown) x 3
Jumper wires x 17
Battery Connector
Tequila (optional)
Step 2: The Circuit
Use this diagram to guide you through each step.
Note: The wire colors in the diagram may not match the wire colors I used in the photographs.
Step 3: Connecting the Speaker
I used gator clips to connect the speaker to the leads. If you have a soldering iron, soldering the leads would be ideal. Run the circuit from pin 8 on the Arduino through the potentiometer, through the 100 ohm resistor, through the speaker, and back to the Aruino GND pin.
Step 4: Add the LED
The RGB LED has 4 cathodes. In my diagram, the cathodes from top to bottom are red, commond ground, green and blue. The flat side of the LED is facing the top of my diagram. Note that the longest cathode is the common ground. This should be connected to a ground pin on the Arduino.
Each cathode should be connected to the Arduino, separated by a 330 ohm resistor:
Red to pin 9
Green to pin 10
Blue to pin 11
Step 5: Connecting the HC-SR04
Now to connect our ultrasonic sensor. The sensor can be placed directly into the breadboard. Try not to let the wires in my diagram confuse you. I only used them to indicate where each pin should be placed within the circuit. The Fritzing software I used to create the diagram shows the sensor facing left but in reality we want it facing the right.
Connect:
Gnd to ground
Echo to pin 13
Trig to pin 7
Vcc to 5v
Step 6: The Code
The code for this project includes the header file "pitches.h" borrowed from the toneMelody sketch in the tone tutorial I mentioned earlier. This file defines a frequency for every note. The pitches.h file must be in the same folder for the code to compile.
Enjoy
8 Comments
8 years ago
Is there a software which can generate the tune according to lyrics.
Reply 8 years ago
Not that I know of. Most tone generators work by playing the note that is associated with the signal sent to it. You could program the generator to accept a string as an input and return a certain tone.
8 years ago
hi..i would like to thank you for your effort ..but i have a simple question..what is the program that you used for assembling and simulation of the circuit...which one do you recommend beat?
Reply 8 years ago
The program is called Fritzing. You can download it at Fritzing.org. It's a great program that's easy to use.
Reply 8 years ago on Introduction
ok that sounds fine,,,i tried to play simulation but in vain,,, how can i play simulation to see a led is on foe example?
thanks in advance
Reply 8 years ago
I'm not exactly sure what you mean by play simultion. Are you having trouble making the LED flash?
8 years ago on Introduction
Now that's a party! Thanks for sharing your project. It looks like it was fun!
Reply 8 years ago
It was, thanks!