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

Check out a video I made on this project:

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); }

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017