Introduction: Clap Switch Using Linkit One

This is my first instructable and in this instructable I am using linkit one micro controller. Today I am going to tell you how to make a clap switch using linkit one board. There are a lot of instructable telling how to make a clap switch using special ICs but not micro controller. I will tell you how to make it with a micro controller. A clap sensor module is connected to linkit one board. When it detects a clap it switches on the led connected.

Step 1: Gather Parts

here are the parts you would be requiring to make this clap switch:

  • linkit one
  • condenser mic
  • LED
  • 2x10K resistance
  • 0.1uf ceramic disc capacitor
  • Breadboard
  • Jump cables

Step 2: Making a Clap Sensor Module

You can not use a condenser microphone like this only. The output of condenser microphone is very low and it can not be detected by linkit one. We have to build a simple circuit to make our condenser mic work with linkit one board. The circuit diagram is given above

Step 3: Connecting Clap Sensor to Linkit One

After making the sensor module you need to connect it to the linkit one board. You need to connect the second pin(Analog input pin) of the ceramic disc capacitor to analog input 0 and vcc and gnd of the sensor module to vcc and gnd of the board respectively.

Step 4: Connect the Led to the Board

Their should be some physical output by which we can know that weather our clap sensor module is working or not. It could be anything from a motor to a buzzer but I thought of using a led because the sound made by buzzer and vibration of motor can alter the readings clap sensor. A normal green led is used by me. Connect the gnd of led to gnd of linkit one board and positive of the led to digital pin 12.

Step 5: Upload the Code to Check Your Clap Sensor Reading

Here is the code by which you can check your clap sensor module readings and put it in your final code. Upload this code to your board and open serial monitor. Now clap and note the sensor reading this would be the reading which your clap sensor module sends to your board when you clap. Here is the code

int clap_sensor=A0;

void setup()

{

Serial.begin(9600);

}

void loop()

{

int value=analogRead(clap_sensor);

Serial.println(value);

delay(1000);

}

Step 6: Final Code

Here is the final code for your project. After uploading the code, when you will clap it will turn on and off the LED connected accordingly. Change the value given in if-statement by your value. Here is the code:

int clap_sensor=A0;

int led_pin=12;

int state=0;

void setup()

{

pinMode(led_pin,OUTPUT);

}

void loop()

{

int value=analogRead(clap_sensor);

if(value>512 && state=0)

{

digitalWrite(led_pin,HIGH);

state=1;

}

else if(value>512 && state=1)

{

digitalWrite(led_pin,LOW);

state=0;}

}

Step 7: END

This is the end of this instructable hope you like it and enjoyed making it. Use your clap sensor and play with it. You can also modify it. THANK YOU.

Make It Glow! Contest

Participated in the
Make It Glow! Contest

Tech Contest

Participated in the
Tech Contest