The above post which I explained How to turn on electrical appliances by clapping. Most of the Sound sensor which detect false trigger and makes the appliances to turn ON and OFF without clapping or start to work when there is other sound, Many people have complained about this and want to make the devices to turn On and Off for double clap. This post explains how to make a double clap switch.
What are the components Need for this?
Relay module (one relay module is enough) // I used 4 relay module because I don't have a single relay module with me.
Make sure you are connecting the sound sensor to the 12th pin of arduino and Relay to 6th pin of arduino according to the program. This is the old circuit I used for the single clap switch. for double clap I've changed the program to use with 12th and 6th pin.
IF you want to know how to connect circuit follow the video below to know .
download the arduino file from here
Whenever the sound sensor detects sound it produces 5v as output in this case it is a digital sound sensor. The sound sensor pin connected to the arduino. whenever the sensor activated it trigger the input pin of the arduino. when the input pin is triggered arduino starts to count the clap. Arduino will check for the next clap within 400ms . you can change this time limit to make it precise. whenever the count of the arduino equals 2 condition becomes true and it turn on the relay pin.