IoTBoysRajeev RanjanShambhoo kumar
Published

Control LED By Clap Using Arduino and Sound Sensor

We're showing how to use KY-038 Sound Sensor using Arduino. You can control LED by clap with the help of Arduino and sound sensor.

BeginnerProtip2 hours145,543
Control LED By Clap Using Arduino and Sound Sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SparkFun KY-038 Sound Sensor
×1
LED (generic)
LED (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
Male To Female
×5
Resistor 1k ohm
Resistor 1k ohm
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Design

Circuit Diagram

Code

Source Code

C/C++
Source Code for Control LED using Clap
int soundSensor=2;
int LED=4;
boolean LEDStatus=false;

void setup() {
 pinMode(soundSensor,INPUT);
 pinMode(LED,OUTPUT);

}

void loop() {

  int SensorData=digitalRead(soundSensor); 
  if(SensorData==1){

    if(LEDStatus==false){
        LEDStatus=true;
        digitalWrite(LED,HIGH);
    }
    else{
        LEDStatus=false;
        digitalWrite(LED,LOW);
    }
  }
 } 

Credits

IoTBoys

IoTBoys

7 projects • 98 followers
Startup, Entrepreneur founded by Rajeev and Shambhoo. Having experience more than 5 years.
Rajeev Ranjan

Rajeev Ranjan

8 projects • 59 followers
Having more than 5 years of experience in Microsoft technology and embedded system. Founded IoTBoys to share the knowledge with people.
Shambhoo kumar

Shambhoo kumar

4 projects • 36 followers

Comments