Arduino Clap Switch with LED and Relay Using Sound Sensor

Arduino Clap Switch with LED and Relay Using Sound Sensor

This project shows you how to make an Arduino clap switch. Also, I show you how to interface an LM393 Sound Sensor with Arduino and implement a LED and Relay control project using Arduino, LM393 Sound Sensor, and a Relay Module.

For more details, watch the video below or read the written tutorial below.

Arduino Clap Switch Using Sound Sensor | Easiest Way

Components Required for Arduino Clap Switch

Arduino Uno× 1Amazon
LM393 Sound Sensor Module× 1Amazon
5V Relay Module× 1Amazon
LED and resistor kit× 1Amazon
Breadboard× 1Amazon
Jumper wires kit× 1Amazon
USB cable type A/B× 1Amazon

Software

Arduino IDE

LM393 Sound Sensor Module

The sound sensor module makes it simple to detect sound and is commonly used to determine sound intensity. For protection, switching and monitoring applications, this module can be used. It is easy to adjust its precision to ease of use. It uses a microphone that provides an amplifier, high detector, and buffers for the signal.

When a sound is detected, the sensor generates an output signal voltage, which is then sent to a micro-controller, which performs the required processing.
The sound detector sensor module for Arduino determines whether or not sound has crossed a predefined threshold value. A microphone detects sound, which is then fed into an LM393 op-amp. An onboard potentiometer is used to change the sound level set point. As the sound frequency reaches the threshold, an LED on the module illuminates and the output is reduced.

LM393 Sound Sensor Module Specifications

Operating  voltage3.3 V – 5 V
Sensitivity48-66 dB
Outputsone analog + one digital
Impedance2.2 kΩ
Operating temperature-40 °C to +85 °C
Frequency response50 Hz – 20 kHz
Indicator LED1 power indicator + 1 comparator output indicator
Dimensions44 x 15 x 10 mm
CostCheck price

The LM393 Sound Sensor Module is made by PRC. For more information, you can check out the LM393 Sound Sensor Module datasheet below:

5V Relay Module

A relay consists of three pins: NO (Normally Open) terminal, NC (Normally Closed) terminal, common pin, and coil. The contacts connected to each other are created when a coil is powered on the magnetic field.
The part of a relay that moves is called the COM (Common) terminal. The COM is connected to the NC (Normally Closed) terminal when a relay is turned off. The relay’s NO (Normally Open) terminal is not connected until the relay is turned on. The COM moves from NC to NO when the relay is turned on.

5V Relay Module Specifications

Operating  voltage3.75V – 6V
Quiescent current2mA
Current when the relay is active~70mA
Relay maximum contact voltage250VAC or 30VDC
Relay maximum current10A
CostCheck price

For more information, you can check out the 5V Relay Module Datasheet below:

Arduino Clap Switch with LED Circuit Schematics

Arduino Clap Switch with LED Circuit Schematics
Arduino Clap Switch with LED Circuit Schematics
 

The following connections are also shown in the table:

LM393 Sound Sensor Module Connections

LM393 Sound Sensor ModuleArduino
VCC5 V
GNDGND
A0A0
D0Digital pin 2

Resistor’s one terminal goes to LED and another terminal goes to digital pin 3.

Arduino Clap Switch with Relay Circuit Schematics

Arduino Clap Switch with Relay Circuit Schematics
Arduino Clap Switch with Relay Circuit Schematics

Connections are also shown in the table:

Relay Module Connections

5V Relay ModuleArduino
VCC5 V
GNDGND
INDigital pin 2

A bulb connects with a 5V relay module’s NO pin and NC pin. 

warning signWaring
This board interfaces with a high-voltage AC supply.   Improper or incorrect use may result in serious injury or death. As a result, it is intended for people who are familiar with and knowledgeable about HIGH AC voltage.

Arduino Clap Switch Code

By clicking the button in the top right corner of the code field, you can copy the code. Copy and paste it into Arduino IDE. 

/***** www.arduinopoint.com *****/
/***** Arduino Clap Switch *****/
int SoundSensor=2; // LM393 Sound Sensor Digital Pin D0 connected to pin 2
int LED=3; // LED connected to pin 3
boolean LEDStatus=false;
void setup() {
 pinMode(SoundSensor,INPUT);
 pinMode(LED,OUTPUT); 
 Serial.begin(9600); //initialize serial
}
void loop() {
 int SensorData=digitalRead(SoundSensor); 
  Serial.println(SensorData);//print the value
   if(SensorData==1){

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

Leave a Reply