How to use sound sensor with Arduino

how to use sound sensor with arduino, Arduino projects with code
how to use sound sensor with arduino, Arduino projects with code

A sound sensor is an electronic component used to capture audio signals. Sound sensors are used in electronic circuits to control electronic processes via sound, such as turning lights or doors on or off, recording the intensity of the sound signal, or recording sounds, among other uses.
In this post, we will learn how to use sound sensor with Arduino, and how to control an electronic circuit using an audio signal.

Electronic components that we need:

  • sound sensor (Module KY-038)
  • 1 LED
  • 1 resistor (220 Ohm)
  • Electrical wires
  • Arduino UNO
  • Breadboard

Circuit diagram:

Arduino Programming Code:

const int ledpin=11;
const int soundpin=A2;
const int threshold=200;
// by www.andprof.com
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
pinMode(soundpin,INPUT);
}

void loop() {
// put your main code here, to run repeatedly:
int soundsens=analogRead(soundpin); // reads analog data from sound Sensor
if (soundsens>=threshold){
digitalWrite(ledpin,HIGH); //turns led on
delay(1000);
}
else {
digitalWrite(ledpin,LOW);
}
}

Explanatory Video:

How To Use Sound Sensor With Arduino | Arduino project with code and circuit diagram

Previous articleHow to use 16×2 LCD display with Arduino
Next articleHow To Make Clap Switch with Arduino and Sound Sensor