Arduino Clap Switch (Clapper)




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

Be the First to Share


    • Leather Challenge

      Leather Challenge
    • Stone Concrete Cement Contest

      Stone Concrete Cement Contest
    • Build a Tool Contest

      Build a Tool Contest



    1 year ago

    Can we register a "word" in Arduino to bypass the light keep ON or OFF mode? I wrote the code in a different way and is

    // Prepared by Jojo John Periapuram
    // Buy a good quality microphone board for clap switch purpose as tuning is critical
    // You may turn off the Serial Print, I keep it for tuning purpose
    int analog = A0; //Input
    int digital1 = 5; //Outputs
    int analogValue;
    int digital_sensor;
    void setup() {
    pinMode(digital1, OUTPUT);
    void loop() {
    digital_sensor = digitalRead(digital1);
    analogValue = (analogRead(analog));
    if(digital_sensor==0 && analogValue>500){
    digitalWrite(digital1, HIGH);
    Serial.print("Value1 ON ");
    if (digital_sensor==1 && analogValue>500){
    digitalWrite(digital1, LOW);
    Serial.print("Value1 OFF ");


    Reply 2 years ago

    yeah I took down the channel a year back, school's been keeping me off of here. And to answer your question, I'd try looking at the exact error you got when compiling the code. Sometimes the IDE tells you the exact problem with the code in the error message, like if there's a typo or something. If that doesn't help, see if there's a specific error code that comes up when compiling/uploading. Hope that helps!


    Question 2 years ago

    it says 'micValue' was not declared in this scope
    What do i do