Introduction: Clap Switch
Here is a clap switch. You can turn any home appliance on/off with a clap. I personally designed the circuit for better accuracy and customized filtration. You can see the working of the switch in the video attached.
I hope you will enjoy building this project.
Step 1: Circuit Explanation
The signal processing done in the circuit is explained in the image.
There are 4 stages of the signal procesing:
- In first step, the input from the mic is anplified.
- In second step the comparator is used to put a threshold value on the amplified value, to be considered as a clap or not.
- In third step the pulse from the comparator is converted into a longer pulse, this is helpful to reduce the noise in the clap.
- In fourth step, the signal is first used to turn on the LED, and next time it turn the LED off. This is done using a decade counter and resetting the counter on the Q2. Q0 is left blank, Q1 is the led/relay attached to.
Q0,Q1,Q2 are the outputs of the decade counters. if you see the datasheet of 4017. First time clock is given to 4017, it gives output on Q0, on next clock, output shifts to Q1, and so on.
POT1 = used for the voltage for the microphone
POT2 = used for initial biasing for the transistor
POT3 = used to set the reference voltage for the comparator
Step 2: Building the Circuit
Things you will need to build the circuit :
- potentiometer - 100K,20kX2
- LEDs X3
- BC547 X2
- 12v RElay
- resistors 160k, 470X3, 1k, 22k.
- Condenser MIC
- 12v Adapter/batter
- Prefboard/dotted PCB
- IC base - 2x8pin, 1x16pin
- 100nF capacitor (104)
- 10uF capacitor (any voltage)
You can build the PCB in many ways :
The best way is the one in which i made it. You dont need to spend money or time on preparing designs and PCB print for the circuit.,
or you can build it on breadboard,
or you can design your own PCB and solder the components on it.
Happy soldering :)
I hope you will enjoy building the project, any suggestions or questions are most welcomed.
Step 3: Calibration of the Potentiometers
To calibrate the device, the first step would be that you should use lowest voltage LED available to you, in the place of LED1. This is because the low voltage LEDs glow at lower voltage consumption and you will be easily able to identify the glow when you make a clap sound near the mic. (i dont remember my blue LED's voltage consumption but its very low, may be lower than even 1 volt, you can try using small LEDs).
Second thing you need to keep in mind is that you need to set POT2 such that initially the LED1 (low voltage LED) must be off. It must be fine calibration. Its Not hard to do so. The thing is that initially we need to give nearly 0.7 volts at the base of the first transistor. and we can do it by adjusting POT2. POT1 is easy to calibrate. First set the POT2 such that LED1 is off, then make a clap near the mic and notice the glow of the LED1. NOW, Change the POT1 value, set the POT2 again such that LED1 is off, then make a clap and notice the glow of LED1. you will notice the difference in the glow of LED1. you have to set the POT1 and POT2 such that the glow is highest in lowest sound. (POT1 must be greater than 5 kilo ohms). Once you are done with the glowing of LED1, now you should go to LED2 with POT3. POT3 sets the reference voltage to be compared to the voltage after amplification from the transistor (LED1). here you can set the sensitivity of the device, that on how much volume should the switch work. the output can be seen on LED2. you will have better idea when you will adjust it a couple of times. one thing is that you should never calibrate the pots all at the same time, i.e. you should first change the value of one portion of the circuit and notice the change, then change the other part's calibration.