Arduino(nano) Clap Switch

4,996

58

8

Introduction: Arduino(nano) Clap Switch

About: I love electronics and Arduino.Stay creative!

in this tutorial i will be showing you how to make an Arduino clap switch

let's get started!

All you have to do is-

clap once to turn the LED on

and

clap again to turn the LED off

Step 1: ORDER YOUR COMPONENTS:

the components required for this build are:

1xArduino(Any arduino will work)

1x220 ohm resistor

1xLED(Any colour)

1xmicrophone amplifier circuit (variable)

1xBreadboard

some jumper wires or single strand wires

that's all the components!
Now let's move to the next step!

Step 2: CONNECTIONS:

sorry guys, I didn't had the SCHEMATIC so i will tell you all the connections,

here are the connections:

Connect A0 pin of the microphone Amplifier to digital pin 12

Connect GND pin of the microphone amplifier to the GND pin of the Arduino nano

Connect VCC pin of the microphone amplifier to VCC pin of the Arduino nano

Connect one end of the 220 ohm resistor to GND pin of the arduino nano

Connect the other end of the 220 ohm resistor to the cathode(smaller leg of the LED) of the LED

Connect the anode(bigger leg of the LED) to digital pin 12 of the Arduino nano

THAT'S ALL THE CONNECTIONS!

Step 3: THE CODE:

pinMode (micpin, INPUT);

pinMode (ledpin, OUTPUT);

}

void loop() {

if (digitalRead (micpin)==HIGH)

{ if (digitalRead(ledpin)==LOW) { digitalWrite (ledpin, HIGH);} else digitalWrite(ledpin,LOW);

delay(1000);

}

}

Step 4: SUCCESS!

After some small connections and small code we finally get success!

all you have to do is-

clap once the LED turns on

clap again the LED turns off

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Fix It! Contest

      Fix It! Contest

    8 Discussions

    and how do you get that rounded pice (sensor i think)?

    :)

    I found some mistake in your instructable:

    You wrote: "Connect A0 pin of the microphone Amplifier to digital pin 12 [...] Connect the anode(bigger leg of the LED) to digital pin 12 of the Arduino nano"

    Both devices connect to pin 12, but on the photo the A0 pin of the mic connect to D10 pin of Arduino.

    It looks the begining of code is lost. I think it could be this way:

    int micpin=10;

    int ledpin=12;

    void setup() {

    pinMode (micpin, INPUT);

    pinMode (ledpin, OUTPUT);

    }

    void loop() {

    if (digitalRead (micpin)==HIGH) {

    if (digitalRead(ledpin)==LOW) {

    digitalWrite (ledpin, HIGH);

    } else {

    digitalWrite(ledpin,LOW);

    }

    delay(1000);

    }

    }

    No, you will need a relay to do that. That is the subject for my another tutorial. Wait for my next tutorial(the better version of clap switch).

    i know but can u plzz sent me the circuit diagram and the code plzzzzzzzzz.My e mail is lokanathmishra12@outlook.com

    can you plzzz give me the list of requirments.i am already having arduino uno r3,12v 4 channel relay,some jumper wires,and adaptor.anything else required???????

    THANK YOU