Introduction: Arduino Clap Switch (Clapper)

Hello! Today I'm going to show you how to build a clap switch with a basic circuit and Arduino board.

Step 1: Parts

For this project, you will need:

  1. Osepp sound sensor
  2. LED (1)
  3. Jumpers (6)
  4. 10k resistor
  5. Breadboard
  6. Arduino Uno
  7. USB B Cable

I also have a video tutorial for this project on my new Youtube channel. Her's the link:

https://www.youtube.com/watch?v=wDvmfDVoGYU&t=2s

Step 2: The Circuit

Alright, so this circuit is pretty simple. Here's hot you got to do:

  1. Plug in the sound sensor into your breadboard.
  2. Connect the ground pin of the sensor to a GND terminal of the Arduino, the Vin pin to the 5V bus of the Arduino, and the Analog pin to the A0 pin of the Arduino.
  3. Now you need to set up the LED. Hook up your 10k resistor to the Gnd pin of the Arduino and the cathode of the LED.
  4. After you've done that, connect a jumper for PWM pin 11 of the Arduino to the anode of the LED.

Once you have successfully built the circuit, upload the code.

Step 3: The Code

Now that you have your circuit built, all you have to do is upload the code to the board. Open the Arduino IDE and upload this code, and Ouila, you now have a working Clapper. That's pretty much it for this project. Thanks for reading and, as always, Happy Making!


int micPin = A0; // microphone sensor input
int ledPin = 11; // select the pin for the LED int micValue = 0; // variable to store the value coming from the mic sensor

void setup() { Serial.begin(9600);

}

void loop() { // read the value from the sensor:

micValue = analogRead(micPin);

micValue = constrain(micValue, 0, 100); //set sound detect clamp 0-100 // turn the ledPin on

int ledbrightness = map(micValue, 0, 100, 0, 255);

Serial.print("incoming value from microphone =");

Serial.println( micValue);

analogWrite(ledPin, ledbrightness);

delay(100); }

Comments

About This Instructable

479views

27favorites

License:

More by DerpyCyclops:3D-Printed Mini LampSimple Motion DetectorHow to Test a PIR Sensor
Add instructable to: