Clap Switch


21

I am just an electronic hobbyist and a student. I make projects for just fun I hope you will like...

This is my first instructables post , this my self built

clap switch.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Grab Your Components

You will need
Arduino UNO x1
P channel MOSFET x1
TDA2822 opamp x1
Condenser microphone x1 (you should just salvage one)
Some jumper cables and breadboard
Relay x1

Step 2: Put Your Components on the Breadboard

Hook it up everything as shown in the schematic and upload

the code provided. If you are using a N channel mosfet you need to change the ‘analogWrite(led, 1);’ with ‘analogWrite(led, 255);’

And ‘analogWrite(led, 255);’ with ‘analogWrite(led, 1);’.

Step 3: Attach Everything and Power It Up

You will need two power supplies one for the arduino and one

for the switching of the relay.

The circuit works on 5v don’t give more than 5v otherwise the circuit will be blown up.

Step 4: Upload the Code

upload the code. And BTW you can use any Arduino and even one attiny85.

Here is the code:
int buf;
int led = 6;
int button = A1;
int ledstate;
int buttoncurrent;
void setup() {
pinMode(A1, INPUT);
pinMode(led, OUTPUT);
analogWrite(led, 255);
buf = 0;
}

void loop() {
buttoncurrent = analogRead(button);
while(buttoncurrent > 150){
analogWrite(led, 1);
buf = 1;
if(buttoncurrent > 150 && buf == 1){
analogWrite(led, 255);
buf = 0;
}
}

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    Discussions