Arduino UNO is used to control ON / OFF AC lamps using 1x detection applause with voice sensor. The first clap turns on the AC light. The 2nd clip turns off the AC light. Voice sensor used with microphone module which output is logic LOW when there is sound while normal / no HIGH logic sound. Relay as actuator connected to AC light and will control ON / OFF AC lamp.
Hardware Requirement
- Arduino Uno Board
- Voice Detector Module (Microphone Module)
- Relay 1 Channel
- LCD 16*2
- Power supply +5 Volt
- Jumper
Voice Detector Module (Microphone Module) | Source
Block Diagram
Schematic
Arduino - Microphone Module Wiring
Arduino - Relay Module
Source Code/Sketch
boolean lampON=false;
int inSensor = 8;
int lamp = 9;
void setup(){
pinMode(inSensor, INPUT);
pinMode(lamp, OUTPUT);
digitalWrite(lamp, LOW);
}
void loop(){
if (digitalRead(inSensor)==0){
if(lampON==false){
digitalWrite(lamp, HIGH);
lampON=true;
delay(2000);
}
else{
digitalWrite(lamp, LOW);
lampON=false;
delay(2000);
}
}
}
int inSensor = 8;
int lamp = 9;
void setup(){
pinMode(inSensor, INPUT);
pinMode(lamp, OUTPUT);
digitalWrite(lamp, LOW);
}
void loop(){
if (digitalRead(inSensor)==0){
if(lampON==false){
digitalWrite(lamp, HIGH);
lampON=true;
delay(2000);
}
else{
digitalWrite(lamp, LOW);
lampON=false;
delay(2000);
}
}
}
How it Works
1. Connect the Arduino with Peripherals needed.
2. Plug in the Power Source on the device.
3. Add some library if needed
4. Compile and upload the script program above to your arduino.
5. The light will light when there is 1x applause, then the appliance does not respond to the next
applause for 2 seconds. Meanwhile, to turn it off with 1x applause as well.
Video for Project III -1. AC Lamp Controller with Clapping (The Clapper) based on Arduino
Required file
No comments:
Post a Comment