Menu Close
Spread the love

Arduino sound sensor

 

Clapper attiny85 clap your hands and the lights, TV, Fan turn on or off.
It’s very easy to do the Clapper, please share this link with your friends and subscribe to my YouTube channel for upcoming projects

 

Parts Required:

  1. ATTINY85
  2. Digital Sound Detector Sensor Module
  3. 1 Kanal Relais 5V/230V
  4. Wire to connect it all together

 

Clapper attiny85 On/ Off Switch:

  1. upload this code to Attiny (How To Upload code to Attiny)
  2. connect all  Parts together

 

clapper attiny85

 

ATTiny85 Pinout:

Attiny85

 

 

Clapper

 

Arduino Code:

 

Arduino Menu up

/* switch
*
* Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
* press), the output pin is toggled from LOW to HIGH or HIGH to LOW.  There's
* a minimum delay between toggles to debounce the circuit (i.e. to ignore
* noise).  
* David A. Mellis
* 21 November 2006
*/

int inPin = 2;         // the number of the input pin
int outPin = 3;       // the number of the output pin
int state = HIGH;      // the current state of the output pin
int reading;           // the current reading from the input pin
int previous = LOW;    // the previous reading from the input pin

// the follow variables are long’s because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers

void setup()
{
pinMode(inPin, INPUT);
pinMode(outPin, OUTPUT);
}

void loop()
{
reading = digitalRead(inPin);
// if the input just went from LOW and HIGH and we’ve waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (reading == HIGH && previous == LOW && millis() time > debounce) {
if (state == HIGH)
state = LOW;
else
state = HIGH;
time = millis();
}

digitalWrite(outPin, state);
previous = reading;
}

Arduino Menu Down

 

Download: sound sensor claper

Thank you for visiting. If you found this information helpful, please consider subscribing to the Officialhrm YouTube channel and liking their Facebook Page for more updates and helpful content. Don’t forget to share this website with your friends.

Download

File Description Date added File size Downloads
zip sound sensor claper August 15, 2018 5:02 pm 465 KB 8114
Posted in Attiny85 Projects

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *