Instructables

How to make a Clap-Clap on / Clap-Clap Off switch circuit!

Picture of How to make a Clap-Clap on / Clap-Clap Off switch circuit!
clapclap2.PNG
clapclap3.PNG
Hi all!
This instructable not only gives the reader the information needed to create a clap-clap on/clap clap off switching circuit, but the logic used to make a hardware-only clap-on, clap off circuit.  More information on a hardware-only version can be found in the final section of this instructable.

This circuit employs some very simple and cheap circuitry, and a simple program. It is relatively easy to make a hardware only clap on/off circuit, but I wanted to create a circuit that required two claps to switch on, and two claps to switch off.  The claps must be in quick succession, as seen in the video below, or else it does not work, which is the entire point of the circuit =)  I will go into detail about the circuitry, and the program.  I will also do my very best to answer any questions you guys may have.  This device can be thrown together in a single evening.

The software works like this:
1) The software waits for an initial loud noise, then starts a countdown sequence.
2) If the device detects another loud noise within about 250 milliseconds, then the relay will toggle on.  If the timer runs out of time without detecting another loud noise, the program resets.
3) Once two claps have been detected, and the relay toggles on.  The software then starts the same sequence over again, only waiting to toggle the relay off. 
4) Once the relay toggles off again after detecting two claps in succession, the program resets back to the original state.

Since the PIC10F222 has a limited instruction set, I had to add in some extra lines of code.  I would have used the PIX18F1220, but that would have been over-kill.  Ah, but how I miss the BTF (Bit Toggle) instruction =)
 
Remove these adsRemove these ads by Signing Up
1-40 of 54Next »
jhunmar1005 months ago

Seems that the code up there is not working Pat.

Assembler Code build failed

Can u make a video of compiling the code and share it to us Pat?

Untitledewewe.png

This is one of the good concepts which may be done in the final year engineering. There is also another circuit diagram of clap switch. If you are interested, try that circuit also.

martinibb6 months ago
Hello! I made the circuit but I have a question. What pins of 10f222 I have to use to programming it; I don't know very well the programming stage of circuits. Thank you!
EngineeringShock (author) 6 months ago
Sorry for taking so long to get back to this, guys. I don't have the hex file available. Just the code posted in the instructable =(
Sorry! =(
nodoubtman2 years ago
(removed by author or community request)
Nojman nodoubtman6 months ago
Hi mate!
Do you still have the code, hex file, for the clap-clap on / clap-clap off switch circuit?
Would be really thankful if you could message me it.
My mail is, mike_n_m@hotmail.com

P.S I have a PIC16F628 to work with. Suggestions what i need to edit in the code?
Thanks again
/Mike
nodoubtman Nojman6 months ago
that doesn't work...
can u send me the hex file?tq. my email is,
leehongmun.5877@gmail.com
can you please send me the .hex file
to attila606@gmail.com
I would very much like the .hex file please email me at gerbessems@gmail.com
syedj9411 months ago
Will it turn off by itself? If yes, how could I keep it from turning off by itself?
abehambino1 year ago
Hello! I'm new to electronics and was looking to make something like the clapper but that responds to other sounds. Does anyone know how to make one?
markee22 years ago
Nice instructables, but the project needs some engineering background i guess , or needs higher level of intellect in electrical or electronics, where ordinary hobbyist like me cant understand . 
As what i understand, this clap switch can detect false triggering from claps where it protects your circuit from turning on and off due to unnecessary sounds or unintended sounds or claps.
Very nice clap circuit actually but needs some programming.

I have a circuit here from my friend and very good for beginners like me, i guess. just see the diagram below if you are interested.  If you are interested only.
copied from: http://www.simple-electronics.com/2010/11/clap-activated-relay-or-switch-220v.html

220V clap switch.png
MROHM markee22 years ago
Isn't Patrick's Battery Operated circuit More Safer since He's Using A 9 Volt Battery???? Your Friend's Circuit uses 220/120 Vac which I believe is a little Dangerous for a Beginner!!! Until you get a little Experience in Electronics I would Suggest You stay with 9 Volts!!! If you still want to Dabble with Line Powered Projects get yourself a Variac/Isolation Transformer So that You can Test Your Line Powered circuit at lower ac voltage Levels,,,safety First!!!! A Variac is a Variable Ac Voltage Transformer while a Isolation Transformer Can Prevent Accidental Shocks If By Chance You Touch a Metal Chassis(Especially in Old Tube radios) It scares me half to DEATH why there are Instructables that have plans to restore tube radios WITHOUT the Use of a Variac/isolation tranformer. Remember 120/220 Vac will respect You if You respect it!!!
ivver MROHM1 year ago
True, but markee2's have more possibilities to use it in practical sense. Ofcourse you have to know how to protect your self and circuit to make something like that with some level of protection, otherwise you are just like bookie.
ivver1 year ago
do you have some scheme to connect it on 230V (or 110V for America) , or you can do it with that circuit then just connect it to some relay which will work as switch?
pdnashe1 year ago
would be glad if you send me the pic program for the circuit,email me at pdnashe@gmail.com
legit
faizikhan1 year ago
Sir please Teelll mee The Apllication for this clap detector....???? please reply here fast......
sekkei1 year ago
I did it without software, using a 555 timer as a monostable multivibrator and a JK flip-flop. BUT I have a problem.
The out of the comparator is a VOLTAGE signal, and the 555 timer is activated with GROUND..... how am I supposed to connect this 2 circuits???? =S

PLEASE HELP!
you need to switch the input to the lm324, between the voltage from the divider and the signal comming from the mic. (This is the comparation stage of the LM324, not the amplification stage)
May be this links can help you a little bit
http://en.wikipedia.org/wiki/Comparator
http://home.cogeco.ca/~rpaisley4/LM555.html
entegrel1 year ago
I did it with a different uController, thanks for your post, it helps me with the electret mic.
http://youtu.be/4OuOy0e1VSY
Wickedweed1 year ago
Hi. Just need to check...is there a missing resistor to the right of the dc blocking cap that connected to 5v since this is a single rail supply?
dbuot631 year ago
hi this project is somewhat similar to my project by i am using different microcontroller...is it ok if i ask for the codes??? please email me at dbuot63@yahoo.com.
thanks
hi im currently going to LTI and i want to do this for my final project. the only problem is our school can only program 8251 microcontrollers or chips like that. is there a chip that is equivalent to the one you used that i could get instead? please email me at dmfbaseball92@yahoo.com.

Thank you.
haske2 years ago
Hello, I really like your circuit and code, but could you please tell me where in code can I increase the time interval for detecting second clap? I would like about 1s interval. Thanks
krrran0002 years ago
I am Karan Shrestha And I wnt to build it but I dont know how to use the software. I m reading in class 11. Please help me. My email is krrran000@gmail.com or brokenheart418@gmail.com
Yadi7862 years ago
Hi Patrick

My name is Riyad, I am currently building a clap switch circuit that I found on the internet for University but it is a single clap switch and I would like to change it to a double clap the hardware way but I don't know hoe to do this. Can you help me please? I don't have much time left as it is due 3days time. My email is riyad.abrahams@gmail.com if you are able to email me I can show you what circuit I am using.

Thanks a Million
Riyad
tt44552 years ago
do you have the code for 16f628a
leandro00123 years ago
Where are you using the LM78L05 Mini 5v Regulator?


Can i do the circuit without this component?

I like the circuit you made. It is simple and very understandable.
EngineeringShock (author)  leandro00123 years ago
Thanks!
If you look at the upper right hand side of the board, you will see a transistor and the regulator. They have the same package.
Thanks, a few days ago I did the circuit and it worked great! Thanks for all your help.
Sorry, I got it, you are using this in the power supply.
Anyways, why using the LM78L05 instead of using a resistor to resist 9v into 5v?

Can I do the circuit without this component ? Because I live in Argentina and it is hard to get this kind of things here.

Thanks for all, and sorry for my bad english.
FallenSub3 years ago
Great circuit! I did this with an Arduino, but that's just an overkill..

Is it okay if I use a 5.7 volts power supply, and skip the voltage regulator? Or is it too much.

Also, how sensitive is this device? Will it work fine on a few meters range indoors without the need to clap like a mad man?
EngineeringShock (author)  FallenSub3 years ago
Hi
Thanks! I'd not change 5.7v. I'd use the regulator. However, a 7805 reguires about 6.5v-7v minimum to regulate properly to 5v.

I just completed a better version of this circuit that does not require an amplifier.

The sensitivity of this circuit is cased on your amplifiers. You can adjust them for your required sensitivity.

jbouffard3 years ago
can this be done with a ir reciever and transmitter?
zeneslev3 years ago
What is the purpose of the 5V pullup on the electret? Is the DC biasing really necessary?
EngineeringShock (author)  zeneslev3 years ago
It is extremely necessary. You are protecting the microphone through current limitation. The resistance of the microphone is about 1k ohms when there is no noise being detected. I have never seen a microphone circuit that has a mic connected directly to the power line.

I don't think you'd see much at the secondary end of the coupling capacitor if you placed the microphone between5v and ground, with the coup0ling capacitor connected to the power line as well.
What I mean is: why do you need to tie the electret to 5V through the 10k resistor? Why not remove the 10k and the 5V source before the coupling cap? All you are interested in is the non dc "small signal" to propagate through the amplifier.

Thanks.
EngineeringShock (author)  zeneslev3 years ago
Oh! I see what you're asking. You want to know why I am even bothering to power the microphone. There is a small internal amplifier in the elctret microphone. It isn't going to offer any sort of electrical signal (AC or DC) unless it has a power source.
1-40 of 54Next »