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!
Surilli
Published © LGPL

Sound Detection Using KY-038 Module

It is used to detect sound, for example, when creating a clap on/clap off light switch.

BeginnerFull instructions provided9 minutes3,728
Sound Detection Using KY-038 Module

Things used in this project

Hardware components

Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Surilli WiFi
Surilli WiFi
×1
KY-038 sound sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

untitled_sketch_3_6mGgvAM1J2.fzz

Code

Untitled file

C/C++
int Led = 16;// define LED Interface
int buttonpin = 5; // define D0 Sensor Interface
int val = 0;// define numeric variables val
 
void setup ()
{
  pinMode (Led, OUTPUT) ;// define LED as output interface
  pinMode (buttonpin, INPUT) ;// output interface D0 is defined sensor
}
 
void loop ()
{
  val = digitalRead(buttonpin);// digital interface will be assigned a value of pin 5 to read val
  if (val == HIGH) // When the sound detection module detects a signal, LED flashes
  {
    digitalWrite (Led, HIGH);
  }
  else
  {
    digitalWrite (Led, LOW);
  }
}

Credits

Surilli

Surilli

196 projects • 65 followers
Surilli is a premiere Internet of Things centric Technology Company aimed at providing cutting edge innovative solutions.

Comments