1. Introduction
A clap switch is a simple electronic system that turns a device ON or OFF when a sound such as a clap is detected. Clap switches are often used in home automation projects to control lights and appliances without touching a physical switch.
In this project, we build an Arduino Clap Switch using a sound sensor module. The sound sensor detects the sound of a clap and sends a signal to the Arduino. The Arduino then toggles the state of an LED or relay connected to it.
Each time a clap is detected, the Arduino changes the device state. For example, the first clap turns the light ON, and the next clap turns it OFF.
This project is a great example of sound-based control systems and is commonly used in beginner Arduino and electronics experiments.
2. Components
The following components are required for this project:
-
Arduino Uno
-
Sound Sensor Module (Microphone Module)
-
LED
-
220Ω Resistor
-
Breadboard
-
Jumper Wires
-
USB Cable for Arduino
3. Circuit and Connections
Make the following connections to build the circuit.
Sound Sensor Module
-
VCC → Arduino 5V
-
GND → Arduino GND
-
DO → Arduino Pin 2
LED Indicator
-
LED Anode (+) → Arduino Pin 13
-
LED Cathode (–) → 220Ω Resistor → GND
The sound sensor module detects a clap sound and sends a digital signal to the Arduino.
4. Circuit Working
The sound sensor module contains a small microphone that detects sound waves. When a loud sound such as a clap occurs, the sensor generates a digital signal.
The Arduino continuously monitors the sensor output.
-
When a clap is detected, the sensor output becomes HIGH.
-
The Arduino then toggles the state of the LED.
-
If the LED was OFF, it turns ON.
-
If the LED was ON, it turns OFF.
Thus, each clap changes the state of the connected device.
This concept can also be extended to control AC lights and appliances using a relay module.
5. Code
int soundSensor = 2;
int led = 13;
bool ledState = false;
void setup()
{
pinMode(soundSensor, INPUT);
pinMode(led, OUTPUT);
}
void loop()
{
int sound = digitalRead(soundSensor);
if(sound == HIGH)
{
ledState = !ledState;
digitalWrite(led, ledState);
delay(500);
}
}
6. Code Working
First, the Arduino pins connected to the sound sensor and LED are defined in the program.
In the setup() function, the sound sensor pin is configured as an input, and the LED pin is configured as an output.
Inside the loop() function, the Arduino continuously reads the signal from the sound sensor.
When a clap sound is detected, the sensor output becomes HIGH. The Arduino then toggles the LED state. If the LED was OFF, it turns ON. If it was ON, it turns OFF.
A small delay is added to avoid multiple detections from a single clap.
7. Tips
-
Adjust the sensitivity potentiometer on the sound sensor module.
-
Avoid placing the sensor in very noisy environments.
-
Add a relay module if you want to control AC appliances.
-
Use proper insulation when working with AC devices.
8. Uses
This clap switch system can be used in many applications:
-
Home automation systems
-
Touch-free light control
-
Smart room lighting
-
Assistive systems for elderly or disabled users
-
Educational electronics projects
9. Conclusion
In this project, we built a simple Arduino Clap Switch using a sound sensor module. The system detects a clap sound and toggles an LED connected to the Arduino.
This project demonstrates how sound signals can be used to control electronic devices, making it a useful introduction to sensor-based automation systems.