Arduino(nano) Clap Switch

6,094

59

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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    8 Discussions

    0
    sashacu
    sashacu

    2 years ago

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

    :)

    0
    PéterM102
    PéterM102

    2 years ago

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

    }

    }

    0
    lokanath mishra
    lokanath mishra

    3 years ago

    sir can i connect tube lights into it

    0
    The creator sid
    The creator sid

    Reply 3 years ago

    No, you will need a 240V. relay

    0
    The creator sid
    The creator sid

    Reply 3 years ago

    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).

    0
    lokanath mishra
    lokanath mishra

    Reply 3 years ago

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

    0
    The creator sid
    The creator sid

    Reply 3 years ago

    I'm currently working on that project.

    I will send you once I'm done;)

    0
    lokanath mishra
    lokanath mishra

    Reply 3 years ago

    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