Introduction: Clap Controlled Light Switch

Hey everyone! So, I'm making this Instructable as a project to get people introduced to The Factory, Mississippi State University's MakerSpace. I wanted to show people one of the many cool things you can do with microcontrollers. This is my first Instructable so I hope you all enjoy!

The Factory Website

The Factory Facebook

Step 1: Supplies Required

The supplies for this system are pretty simple. Here they are

The links I posted are just some places that I found the supplies, but you can get these supplies from lots of different places. The mic does not come with header-pins soldered onto it so you will need to do this yourself.

Step 2: Building the Circuit

We will be connecting all of the components to our small breadboard. Here's an image of the basic circuit showing how each components connected to the power pins and digital out/analog in pins on the Arduino. Connect the +5V and GND pins from the Arduino to the breadboard in different places. This will give you a place to connect the mic and servo to direct power. Make sure that the Servo is connected properly with the +5V power and ground pins connected to the proper place on the breadboard and the Signal pin to 9 on the Arduino. That pin was designed for servo control. Connect the Mic Out pin to pin A0 on the Arduino. VCE on the Mic goes to the positive power and GND to ground. Also, be sure that you have a 300-600 Ohm resistor connected between pin 2 on the Arduino and the positive side of the LED before the other end of the LED is connected to ground.

Also, the mic that I linked in the instructions has adjustable gain, so you can change it's sensitivity by turning the small knob on the back. Be careful about turning it too far.

Step 3: Program Arduino

Make sure you download the Arduino software. Connect the Arduino Uno to the computer with its USB cable. Go to Tools and go to "Board" to select the version of Arduino you're using ("Arduino/Genuine Uno"). Go to Tools and check "Port" to connect your board to a particular USB port. You can use my code that I've linked here. If you need to change the sensitivity of the mic, change the "trigger" value that's initialized at the beginning of the code. If you want to change the amount of time it takes between claps, adjust the "timeout" value to a time in milliseconds. Sketch >> Upload or Ctrl+U will upload the code to the board.

Step 4: Build a Mount and Mount It!

My mount is pretty rough, but it worked for when it was needed to. You'll need to put all the components together on a board or in a case. I used a zip tie to hold down the Arduino, some tape to hold on the battery and breadboard, and some screws to hold the servo on the back. The servo is on the back of the mount so it can easily turn the light switch. The arm that will push and pull the switch will need to be sturdy, like a hard piece of wire or a piece of wood. Attach one end to the servo spoke so that it can rotate and attach the other end to the light switch. You may need to zip tie the end of the arm to the switch.

Mount the system above the light so the arm can hang down directly over the switch for easy pushing and pulling. I used some Velcro to mount. It may take some some fiddling to get everything working properly.

And there you go! Enjoy your homemade clap-light!