Introduction: Clapping Led System Using Sound Sensor

About: I m pursuing electronics and communication engineering.I have a keen interest on robotics,analog,digital electronics.

Hello Everyone,My name is Harji Nagi.I am currently second year student studying electronics and communication engineering in India.

This instructable is the written version of my " Clapping Led System" YouTube video that I've uploaded. I strongly recommend you to check it out.

Today I made two clap LED system.Sound sensors can be used for a variety of things, one of them could be turning lights off and on by clapping. Today however we are going to use the sound sensor to LED lights which will glow LED by 2 claps.

Step 1: Step 1:Hardware Required

The components which I am using in this project is:

1)Arduino Nano

2)Sound sensor

3)3 LED

4)Resistor(220 ohm*3)

5)Breadboad

6)Jumper Wires

Step 2: Step 2:Connections

For Connections: Click Here

As a power source I am using power bank to power up Arduino Nano.

You can Watch out vedio here =>VEDIO

Step 3: Coding

int Sensor = A0;

int clap = 0;

long detection_range_start = 0;

long detection_range = 0;

boolean status_lights = false;

void setup()

{

pinMode(Sensor, INPUT);

pinMode(10,OUTPUT);

pinMode(9,OUTPUT);

pinMode(8,OUTPUT);

}

void loop()

{

int status_sensor = digitalRead(Sensor);

if (status_sensor == 0)

{ if (clap == 0)

{

detection_range_start = detection_range = millis();

clap++;

}

else if (clap > 0 && millis()-detection_range >= 50)

{ detection_range = millis(); clap++; }

}

if (millis()-detection_range_start >= 400)

{

if (clap == 2)

{

if (!status_lights)

{

status_lights = true;

digitalWrite(10, HIGH);

digitalWrite(9, HIGH);

digitalWrite(8, HIGH);

}

else if (status_lights)

{ status_lights = false;

digitalWrite(10, LOW);

digitalWrite(9, LOW);

digitalWrite(8, LOW);

}

}

clap = 0;

}

}

Step 4:

First of all, I would like to thank you for reading this guide.I hope it helps you.

If you want to support me, you can subscribe my channel and watch my videos.

Visit My Youtube Channel