This is a project that I quickly made one night because I wanted to 'clap' to turn off and on the light in my room! I have a small room for myself, so I basically have no other noise around. So, I was able to use an amplifier, which finds the value of the sound level in its surroundings. I hooked this amplifier, MAX4466 from Adafruit, and a servo that I had from a while ago. This project took some time to engineer for the servo to attach on my light switch. We took a wire, that I got from someone that does jewelry, put tape around the wire, and tightened the servo on the metal plate that was covering the light switch. Then, I found the value for my clap's loudness, and set the range in the code so that the servo will turn off and on the light when that level was reached. I really enjoyed the project; I stayed on my bed for hours, both awake and asleep, being able to turn on and off the light on my bed. A tip might be that you might want to connect the arduino to an external power source, not your computer when having it on for a while, so that you can use your computer during that time for other things.
*** Please make sure that your light switch (plate) is safe to be removed! Be sure to check that there are no electrical components exposed from the light that might cause harm.
Step 1: Parts List
3x Jumper Wires (for the servo)
1x MAX4466 Amplifier [http://www.adafruit.com/products/1063]
1x Servo (almost any servo is fine)
1x Servo Bracket
- This bracket does not have to look exactly like this, but anything similar will probably help you design this.- For example, this looks similar: http://www.robotshop.com/en/lynxmotion-aluminum-c-...
1x Long Wire (to attach servo)
Scotch Tape (to wrap the wire)
Step 2: Assemble Part 1.
Here, you have an amplifier and a servo to hook up on the Arduino. I didn't use a breadboard; I used a protoshield with a board attached, but anything will work. For this assembly, you will need some wires (also the jumper wires).
First, let's hook up the amplifier. Sorry that the diagram uses a potentiometer for the amplifier; I couldn't find an amplifier on the 123D Circuit program. Similar to the picture, when wiring this amplifier, face the black microphone towards you. The Adafruit's amplifier actually says which one should be wired to which, but just for clarification, left is for the Analogue pin, center for ground, and right for power, 5V. Then, use the 3 jumper wires to hook up the servo. The servo motor probably has 3 wires, hopefully in the colors of red, black, and yellow (green, blue, or more for the yellow one). Then, connect the red one to power, black one to ground, and yellow one to a digital output pin. When you finish all this, you are set to move on!
Step 3: Assemble Part 2.
Everyone's light switch is going to look different. However, I am going to explain how I attached my servo motor to my light switch for this step. So, as the first picture shows, that is what the light switch looked like after detaching the metal plate (I unscrew them). Then, I used the metal plate to attach the servo motor with a long strip of wire. Before attaching anything, I wrapped the wire with tape because it seemed like when tightening the wire, great amount of friction was caused, which let the wire to cut itself in half several times. Wrapping the wire with tape helped a lot. Then, the servo motor was attached to the metal plate by crossing the servo perpendicularly, giving support on all 4 sides. Then, I screwed the metal plate back on with the servo, and the servo motor was successfully attached!
Step 4: Code
The code for this project is posted on my blog:
The picture shows where the post is on the blog. Please read the comments and change some things in the code to match your situation and needs.
Step 5: Enjoy!
(yes, this is the same video from the introduction.)
When you have completed all of these steps, your light clapper is good to go!
Just before you attach the servo, make sure that your light switch does not have any electrical wires hanging around that can harm you when trying to attach the servo with a wire. My switch had no electrical wires that were exposed and the wire that I used did not touch any parts of the light switch. Please be careful, and have fun!
** The amplifier only detects the loudness of your surroundings, so the quieter your room is, the better the clapper will work!
Thank you :)