Introduction: Arduino(nano) Clap Switch

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

Comments

author
PéterM102 made it! (author)2017-06-28

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

}

}

author
lokanath mishra made it! (author)2017-02-05

sir can i connect tube lights into it

author
The creator sid made it! (author)The creator sid 2017-02-15

No, you will need a 240V. relay

author
The creator sid made it! (author)The creator sid 2017-02-05

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

author
lokanath mishra made it! (author)lokanath mishra2017-02-10

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

author
The creator sid made it! (author)The creator sid 2017-02-10

I'm currently working on that project.

I will send you once I'm done;)

author
lokanath mishra made it! (author)lokanath mishra2017-02-15

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

About This Instructable

3,364views

48favorites

License:

Bio: I love electronics and Arduino.Stay creative!
More by The creator sid :Arduino(nano) Clap SwitchHow to make a 0-9 counter using an Arduino NanoHow to Make a Dark Sensor
Add instructable to: