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!
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 63Next »
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?

Have you found an answer to your question? Because I'm going to use a 230V instead of a 9V and I'm wondering if I have to change something...

can you please send me the hex file? I'm lost with asm compilation...

I really don't understand how to compile it. It will be awsome if you could send me the hex file


tapasxplore4 months ago

Hey everone if you truly want to understand clap swith here is a remarkable post (Top of the world post)

goldenshuttle5 months ago

great post. Another alternative if someone does not want to program and code ; we can use a counter like CD4017 which counts the claps from LM324 output, and you can easily set 2 or 3 or even 4 claps on or off.

U made one ?
Warhead_694 months ago

good day all ..

thanks a lot for the great work, but I only have one question; what is the use of

100k Ohm Multi-Turn Potentiometer ?

thanks a lot and will be waiting for your answer :D

i want to use my arduino uno as microcontroller because i havnt worked on PIC10F222..

so, can I ?

This is a simple one clap switch circuit using 555 Timer

I hope it will help you...

Clap Switch Circuit Electronic Project Using 555 Timer and BC547 Transistor.png

Thanks Bro

EngineeringShock (author)  vinesh.saini.527 months ago

I just made this:

I hope that you find it helpful!

jhunmar1001 year 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?

martinibb1 year 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) 1 year 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! =(
nodoubtman3 years ago
(removed by author or community request)
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,

P.S I have a PIC16F628 to work with. Suggestions what i need to edit in the code?
Thanks again
that doesn't work...
can u send me the hex file?tq. my email is,
can you please send me the .hex file
I would very much like the .hex file please email me at
syedj941 year 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?
markee23 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:

220V clap switch.png
MROHM markee23 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.
pdnashe2 years ago
would be glad if you send me the pic program for the circuit,email me at
danm_daniel2 years ago
faizikhan2 years ago
Sir please Teelll mee The Apllication for this clap detector....???? please reply here fast......
sekkei2 years 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

entegrel sekkei2 years ago
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
entegrel2 years ago
I did it with a different uController, thanks for your post, it helps me with the electret mic.
Wickedweed2 years ago
Hi. Just need to there a missing resistor to the right of the dc blocking cap that connected to 5v since this is a single rail supply?
dbuot632 years ago
hi this project is somewhat similar to my project by i am using different it ok if i ask for the codes??? please email me at
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

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 or
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 if you are able to email me I can show you what circuit I am using.

Thanks a Million
tt44553 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
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.
1-40 of 63Next »