+8801933-147547 razibahmmad7327@gmail.com
Select Page

Welcome to Arduino tricks

Arduino Clap Switch

The sound created by applause is detected by associate degree electret mike connected to at least one of the Arduino analog input pins.

arduino tircks

The primary time that the clap is detected by the Arduino, associate degree LED are going to be switched on. The second time that a clap is detected the LED are going to be transitioned. during this project, we tend to area unit planning to build Clapper circuit exploitation the idea of ADC in ARDUINO UNO. we tend to area unit planning to use a MIC and Uno to sense the sound and trigger a response. This put on Clap OFF switches primarily activates or OFF the device, by exploitation the clap sound, like a switch.

How to Bild a Club Switch :

The project originated from the “emergency”, that|during which I found myself for a few time and which seemed like this you wish to travel into the bed at nighttime, however initial you want to activate the sunshine of the chamber to be ready to notice the switch of the side lamp.

 

  1. Arduino Uno board           
  2. Project Board                                                   
  3. Connecting Cable                                             
  4. Electronic Microphone                                   
  5. Resistor – 330ohm                                           
  6. Resistor – 100kohm                                         
  7. Resistir – 1kohm                                               
  8. Capacitor 100mF                                             
  9. LED Light             
arduino tricks
Arduino Code

//———————————————————————
// website https://arduinotricks.com/arduino-clap-switch/
//———————————————————————

void setup() {
Serial.begin(9600); // using serial port to check analog value
pinMode(2, OUTPUT); // LED on digital pin 2
}

void loop() {
int analog_val; // analog value read from A2
static bool led_state = false; // current state of LED

analog_val = analogRead(A2);

if (analog_val > 10) { // trigger threshold
// toggle LED
if (led_state) {
led_state = false; // LED was on, now off
digitalWrite(2, LOW);
Serial.println(analog_val); // print analog value for debug purposes
}
else {
led_state = true;
digitalWrite(2, HIGH); // LED was off, now on
Serial.println(analog_val);
}
delay(50); // wait for clap noise to subside
}
}

Then you switched on the side lamp and run to the chamber’s door once more to show off the bedroom lightweight.



You already notice the chamber lightweight is admittedly simply a method to associate degree finish.

Now, once getting into the chamber, I will directly activate the side lamp victimization twin applause

So save me the unneeded thanks to the bed and back once more to the door to show off the chamber lightweight.

That may sound sort of a hard laziness and that I will already see the primary of you throw your hands up in despair, however it’s here primarily to the tinkering that warms my nerd’s heart.

As clever laptop scientists and hobbyists, one feels like their relentless drive to optimize the method “light on” so was born the subsequent fine-tuning on my side lamp.

Email

info@arduinotricks.com