Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
IoTBoysRajiv SharmaShambhoo 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 hours199,531
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

9 projects β€’ 115 followers
Watch, Learn and Built IoT projects | DIY IoT Projects | IoT Projects for College Student.
Rajiv Sharma

Rajiv Sharma

17 projects β€’ 71 followers
Having more than 10 years of experience in IoT and software technology. Founded IoTBoys to share knowledge with IoT enthusiasts.
Shambhoo kumar

Shambhoo kumar

4 projects β€’ 43 followers

Comments