Clap On Clap Off Switch

digital

ByJayant 102

Clap On Clap Off Switch using IC 555

A "Clap On Clap Off" switch is an interesting concept that could be used in home automation. It works as a switch which makes devices On and Off by making a clap sound. Although its name is “Clap switch”, but it can be turned ON by any sound of about same pitch of Clap sound. The main component of the circuit is the Electric Condenser Mic, which has been used as a sound sensor. Condenser Mic basically converts sound energy into electrical energy, that in turns used to trigger 555 timer IC, through a Transistor. And triggering of 555 ic works as a Clock pulse for D-type flip-flop and would turn ON the LED, which will remain ON until the next clock pulse means until the next Clap/sound. So this is the Clap Switch which will turn ON with first Clap and turn OFF with the second Clap. If we remove the D-type Flip flop from the circuit, the LED will be turned OFF automatically after some time and this time will be 1.1xR1xC1 seconds, which I have explained in my previous circuit of clap switch. For better understanding, I recommend to study the previous circuit before study this one.

 

Working Explanation

Here we are using Electric Condenser Mic for sensing the sound, transistor to trigger the 555 timer IC, 555 IC to SET & RESET the D-type flip flop and D-type flip flop to remember the logic level (LED ON or OFF) until next Clap/sound.

 

Components

Condenser Mic

555 Timer IC

Transistor BC547

Resistors (1k, 47k, 100k ohm)

Capacitor (10uF)

IC7474 more precisely DM74S74N (D-type flip flop)

LED and Battery (5-9v)

 

Circuit Diagram and Explanation

Clap On Clap Off Switch Circuit Diagram

You can see the connections in above "clap on clap off circuit diagram". Initially the transistor is in OFF state because there is not enough (0.7v) base-emitter voltage to turn it ON.  And the point A is at high potential, and point A is connected to Trigger pin 2 of 555 IC, as a result Trigger pin 2 is also at high potential. As we know that, to trigger the 555 IC through Trigger PIN 2, the voltage of the PIN 2 must be below Vcc/3. So at this stage no output at OUT PIN 3, means no clock pulse for D-type Flip-flop (IC 7474), thereby no response from D-type Flip-flop, and so LED is OFF.

 

Now when we produce some sound near condenser mic, this sound will be converted into electrical energy and it will raise the potential at the Base, which will turn the Transistor ON. As soon as the transistor becomes ON, the potential at Point A would become low and it will trigger the 555 IC because of the low voltage (below Vcc/3) at Trigger Pin 2. So the output PIN3 will be high and a positive clock pulse will be applied to D-type Flip-flop, which makes Flip-flop to respond and LED will turn ON. This SET state of flip flop will remain as it is until the next clock pulse (next Clap). Detailed working of D-type Flip-flop has been given below.

 

Here we are using 555 timer IC in Monostable Mode, whose output (PIN 3 of 555 IC) has been used as a clock pulse for D-type Flip-flop. So the clock pulse will be HIGH for 1.1xR1xC1 seconds and then it would become LOW. You can learn 555 IC operations through some 555 timer circuits HERE.

 

Working of D-type Flip-flop

Here we are using Positive Edge Triggered D-type flip-flop, which means this flip flop only responds when clock pulse would go from LOW to HIGH. OUTPUT Q will be shown according to state of INPUT D, at the time of the Clock pulse transition (Low to High). Flip flop remembers this OUTPUT state Q (Either HIGH or LOW), until the next positive clock pulse (Low to High). And again shows the OUPUT Q, according to the input state D, at the time of clock pulse transition (LOW to HIGH)

D type flip flop circuit

D-type Flip-flop is basically the advanced version of S-R flipflop. In S-R flipflop, the S=0 and R=0 is forbidden, because it is making the flip-flop behaving unexpectedly. This problem is resolved in D-type Flip-flop, by adding a Inverter between both the inputs (see the diagram) and the second input is given by the Clock pulse to both the NAND gates. Inverter is introduced to avoid same logic levels at both the inputs, so that “S=0 and R=0” condition never occurs.

 

D-type Flip-flop doesn’t change its state while clock pulse is low, because it gives the output logic level “1” at NAND gates A and B, which is the input for NAND gates X and Y. And when both the inputs are 1 for NAND gates X and Y, then output don’t change (remember S-R flip-flop). The conclusion is that it will not change its state while clockpulse is LOW, regardless of INPUT D. It only change when there is transition in Clock pulse from LOW to HIGH. It won’t change during the HIGH and LOW period. We can deduce the truth table for this D-Flip-flop:

Clk

D

Q

Q'

Description

↓ » 0

X

Q

Q'

Memory
no change

↑ » 1

0

0

1

Reset Q » 0

↑ » 1

1

1

0

Set Q » 1

 

IC 7474

We have used IC DM74S74N of 7474 series. IC DM74S74N is the Dual D-type Flip-flop IC, in which there are two D-type Flip-flops, which can be either used individually or as a master-slave toggle combination. We are using one D-type Flip-flop in our circuit. Pins for first D flip-flop are the left side and for second flip flop are at right side. Also there are PRE and CLR pins for both the D-type Flip-flops which are active-low pins. These pin used to SET or RESET the D-type Flip-flop respectively, regardless of INPUT D and Clock. We have connected both to Vcc to make them inactive.

IC 7474 Pinout

After understanding the D-type Flip-flop and IC DM74S74N, we can easily understand the use of D-type Flip-flop in our circuit. When we first triggered the 555 IC by first Clap, the LED glows as we get Q=1 and Q’=0. And it will remain ON until the next trigger or next positive clock pulse (LOW to HIGH). We have connected Q’ to to INPUT D, so when LED is glowing, Q’=0 is waiting for Second Clock pulse, so that it can be applied to the INPUT D and makes Q=0 and Q’=1, which in turns TURN OFF the LED. Now Q’=1 is waiting for next clock pulse to make the LED turn ON by applying Q’=1 to INPUT D, and so on this process will continue.

 

To test this circuit you need to clap loudly as this small condenser mic don’t have long range. Or you can directly hit at the mic lightly (like I have done in the video).

 

Some Important Points

  • If circuit doesn’t works at first, then connect the CLR (PIN1 of IC DM74S74N) to the ground to RESET the flip-flop, then again connect to Vcc as shown in circuit.
  • We can modify this circuit using Relay to control the Electronic devices (120/220V AC). 
  • Control PIN 5 of 555 Timer IC should be connected to Ground through a 0.01uF capacitor.
  • We should use a 220 ohm resistor to connect LED.

Video

Get Our Weekly Newsletter!

Subscribe below to receive most popular news, articles and DIY projects from Circuit Digest

Comments

  • Francis Manalo's picture
    Francis Manalo
    Sep 16, 2015

    where is you R2 Resistor in your diagram?, because in the list of your resistors they are 4 resistor which is 1k, 10k, 47k, and 100k, so where is 10k or R2?

  • Dryx's picture
    Dryx
    Oct 04, 2015

    Can you send me a modified circuit for 220VAC? please.

  • Jayant's picture
    Jayant
    Oct 06, 2015

    To operate 220v appliances, you need to interface Relay in place of LED. Check this article for using Relay module. Basically you need to connect Input of Relay module (I/P) to the Q (5) output of D type flip flop.

  • Dryx's picture
    Dryx
    Oct 07, 2015

    Will this work if i use a 6V source?

  • Dryx's picture
    Dryx
    Oct 13, 2015

    How can i adjust the sensitivity of the microphone?

  • Abhishek's picture
    Abhishek
    Oct 22, 2015

    By using the proper value of Pull-Up resistor with your Mic, refer datasheet. Or use variable resistor and try different values. Or use different Microphone.

  • aniket saha's picture
    aniket saha
    Oct 15, 2015

    Can I use BC548 /BC 557 transistor in place of BC547

  • Madhu's picture
    Madhu
    Oct 18, 2015

    Yes you can use BC548. But don't use BC557 as it is a PNP transistor and we are using NPN here.

  • usman's picture
    usman
    Oct 22, 2015

    i used 74f74pc ic and im having problem , when i connect battery ,light gets onn and remain on what should i do ???

  • usman's picture
    usman
    Oct 22, 2015

    YOU LEFT PINS 8 , 9 , 10 ,11, 12, 13 OF DM74S74N

  • Abhishek's picture
    Abhishek
    Oct 22, 2015

    Yes, we left those PINs as we are only using one D type Flip Flop (out of two) inside the IC. Please check the PIN diagram and description.

  • usman's picture
    usman
    Oct 23, 2015

    thank you abhishek for reply i really appreciate you , please let me know on more thing , i used f74f74pc ic . when i connect 9v battery so led(Red) remain onn , mean without any clap it gets on .. am i using wrong ic ???

  • Zidane's picture
    Zidane
    Oct 29, 2015

    I would like to do this but how could I make it so that it has more than one led, for example I want to clap 2 times then the 2nd led will turn and when I clap 3 times the 3rd led will turn on etc. Thanks

  • Maddy's picture
    Maddy
    Nov 03, 2015

    This particular circuit is quite complex to design. Either you need to use three mic at distance or you need to cut out the one mic after trigger. You should try to do this using Microcontroller, or use IC4017 but latter will increase the complexity. Share here if you achieve this.
    Thanks

  • petchu's picture
    petchu
    Nov 24, 2015

    Pls can I use 74Ls174 ic for my clap on clap off switch? If yes how can I connect to pins

  • Maddy's picture
    Maddy
    Nov 28, 2015

    Although 74LS174 consists six D-type Flip Flop but it doesn't have Q' (Q bar) at the output, which is required in this circuit to be fed back into D input. You can use 74LS174, but circuit need to be modified accordingly and may need to use a NOT gate at output Q to generate Q bar. Better use 74LS175, it has four D type Flip flop with both Q and Q bar.

  • chupet's picture
    chupet
    Aug 27, 2016

    Yes because its an ic that you can use in the circuit and that is the alternate for that ic

  • petchu 's picture
    petchu
    Nov 28, 2015

    Thank u very much!!. Its now I understand what d flip flop ic is all about. But honestly maddy am still new to this system. So hw am I to create a nor gate. Or may be I shud go read about logic gates

  • David's picture
    David
    Dec 10, 2015

    Hi, i made the same circuit as yours, same components, eneverything. My Flip Flop starts overheating when i connect de 1 with 4 and after VCC.
    Please help

  • Rashid Qureshi's picture
    Rashid Qureshi
    Dec 12, 2015

    It doesn't work...Can you pls tell me where to put R2. And do I have to do the following steps as you mentioned:
    •Control PIN 5 of 555 Timer IC should be connected to Ground through a 0.01uF capacitor.
    •We should use a 220 ohm resistor to connect LED.
    Pls help. I am stuck after making the whole circuit.

    Regards
    Rashid Qureshi

  • Perish Jimi's picture
    Perish Jimi
    Dec 14, 2015

    Where can we get this 7474 ic ?

  • Abhishek's picture
    Abhishek
    Dec 17, 2015

    You can get it from local electronics market or can order online, the detail about the IC is explained in above comment.

  • Shivu raj's picture
    Shivu raj
    Jan 08, 2016

    i used MC74ACT74N ic and im having problem , when i connect battery ,light gets onn and remain on

  • Abhishek's picture
    Abhishek
    Jan 14, 2016

    Check the datasheet of MC74ACT74N and do the connections accordingly. Then try using 10k pull up resistor for condenser mic. Also check all the above comments if they solve your problem.

  • Patrick's picture
    Patrick
    Jan 23, 2016

    Hi. I used 74LS74AP and the connections are the same as DM74S74N but my problem is when I connect the battery the LED is on and remains on even after I clap. Can you help me please? Thank you very much.

  • Karina's picture
    Karina
    Feb 03, 2016

    Will this work without relay? And what is the cable at the picture(the unshown full pic) connect to?

  • Maddy's picture
    Maddy
    Feb 08, 2016

    its already without relay. I think you want to ask, that whether it will work with relay. Yes, you can interface Relay to control AC appliances like here Remote Controlled Light Switch. And this is a single cable, not connected anywhere, it is just banded, and the band has been cut in the image. Follow Circuit Diagram, instead of image.

  • bruno's picture
    bruno
    Feb 16, 2016

    I made the same circuit like you with SN74S74N (same dataseet), when i connect to battery the led is off and when i clap led get on and remains on even after i clap again.

  • Ashok's picture
    Ashok
    Feb 17, 2016

    Hi. I am trying to do this circuit without D flip flop so I'm taking output directly from PIN3. But the circuit is not working. No value is changing on base of transistor when clap..

  • bruno's picture
    bruno
    Feb 22, 2016

    buy another microphone :D

  • nick's picture
    nick
    Mar 02, 2016

    I made the same circuit like you with SN74S74N (same dataseet), when i connect to battery the led is off and when i clap led get on and remains on even after i clap again. what should i do?

  • Marcus Casas's picture
    Marcus Casas
    Mar 16, 2016

    I made the same circuit with DM74LS74AN. What changes can i do so that the circuit will work?

  • Shamiul's picture
    Shamiul
    Mar 24, 2016

    will this work with a 12v source??

  • Abhishek's picture
    Abhishek
    Mar 28, 2016

    yes, it should but better use 9v battery as shown or some 5v source.

  • samuel's picture
    samuel
    Apr 04, 2016

    thanks alot , is there an equivalent of IC DM74S74N? coz i have searched for it and failed to get

  • Shamiul's picture
    Shamiul
    Apr 07, 2016

    I want to use a 741 op-amplifier, beacause the elctret mic is not working properly so can you please give me the full circuit diagram after adding the op-am in the circuit. Thanks :)

  • vishal's picture
    vishal
    Apr 24, 2016

    I used ic 74AC74PC, but the led remains "on" and does not respond to clap.
    please reply ASAP.

  • Maddy's picture
    Maddy
    May 17, 2016

    Check the datasheet of 74AC74PC and do the connections accordingly.

  • Chris's picture
    Chris
    May 09, 2016

    Can I use a 2N3904 NPN Transistor instead of the BC547?

  • Debanjan's picture
    Debanjan
    May 21, 2016

    Thanks 4 sharing the circuit. Its working fine. But mic is not working from distance. How it can be connected to house hold appliance

  • Lena's picture
    Lena
    Jun 11, 2016

    Is it ponsible to include the remote control system in the circuit of the clap sound? If yes how should I do it?

  • Deep's picture
    Deep
    Jul 15, 2016

    I guess S=0 and R=0 state is there in SR flipflop. The S=1 and R=1 state gives invalid results instead.

  • Madhurya's picture
    Madhurya
    Jul 25, 2016

    Do we have any specific condenser mic used for clap switch?

  • MiDi's picture
    MiDi
    Jul 27, 2016

    Thank you for your diagram.
    It works, but...
    but it works in reversed way.
    I mean that, when I clap, it turn off. then after 3 sec, it turn on again.
    Please do some fix, mate !

  • Leshi's picture
    Leshi
    Aug 10, 2016

    Is it possible to use a cd4027be IC and can it be possible to use a 2n222 transistor instead.

  • Abhishek's picture
    Abhishek
    Aug 13, 2016

    check its datasheet whether It have all the pins needed in the circuit.

  • allen's picture
    allen
    Aug 10, 2016

    how do we supply the clock pulse.and is it -ve edge trigered

  • Abhishek's picture
    Abhishek
    Aug 13, 2016

    Clock Pulse is being supplied by 555 Timer IC here and its +ve edge triggered.

  • talha's picture
    talha
    Aug 31, 2016

    sir, can I use d type flip flop M74LS74P in this circuit???

  • Md Subhan's picture
    Md Subhan
    Sep 11, 2016

    I want to use this sweech in AC circuit to on/off my fan then how to use this sweech.

  • Ankita's picture
    Ankita
    Sep 18, 2016

    Which condenser mic is to be used?

  • Lwin zaw lhyo 's picture
    Lwin zaw lhyo
    Oct 02, 2016

    Plz help me
    I have alredy made but When testing
    when I clamp the sound The LED is turned On but when I clamp again the LED is not become completly off .Meaning that instead of it must trun off but LED get alittle supply voltage so the LED is lighting alittle in Off mode
    Please help me

  • Anshul Bharti's picture
    Anshul Bharti
    Oct 12, 2016

    What to do if I want clap on and off circuit to use for 220V aupply,i.e.how to connect relay?

  • shah rukh's picture
    shah rukh
    Oct 22, 2016

    how to introduce the relay in this circuit?do you have a diagram for that?

  • Junhui's picture
    Junhui
    Oct 24, 2016

    My condenser mic isn't giving out any signal. Is there any specify condenser mic we have to use?

  • Uzair Arif's picture
    Uzair Arif
    Oct 31, 2016

    Kindly can you please create a video with step by step instructions on how to create a clap on clap off switch. Email it on my email []

  • Joshua's picture
    Joshua
    Nov 24, 2016

    Is it okay to use SN74LS74N? And how do i introduce the relay on the circuit? Do i ned to parallel a diode between gnd and output on flipflop?

  • ali's picture
    ali
    Dec 04, 2016

    Can we use the ic 4017 for 7474

  • SAVIO VINCENT's picture
    SAVIO VINCENT
    Jan 31, 2017

    It worked

  • irfan's picture
    irfan
    Feb 04, 2017

    hey, i have make a simulation on your circuit...but it is not working...the led does not turn on...are there any mistake on your circuit...Please reply ASAP

  • Armaan's picture
    Armaan
    Mar 10, 2017

    Instead of a condensor mic, can you use a loud speaker?

  • Junaid Ahmed Khan's picture
    Junaid Ahmed Khan
    Mar 21, 2017

    sir
    I followed all the steps and did same as the circuit diagram and instructions. But its not working.
    Please help me as soon as possible.
    It will be better if you upload a video showing step by step.
    Thanks.

  • James's picture
    James
    Mar 28, 2017

    The data sheet for the D flip flop says the IC has a max voltage of 5.25 V. How does this work with a 9V source?

  • Jaskeerat's picture
    Jaskeerat
    Mar 30, 2017

    I have to snap 3-4 times as current flowing to the base of transistor i.e electrical impulses released by mic are too less!! what should I do?

  • B's picture
    B
    Jun 16, 2017

    U can increase the sensitivity of the mic by connecting a 100 nF capacitor with the positive of the kick and the other end to theBase of the transister also connect 2 10 k ohm resister one from the capacitor to Vcc and the others from collector of the transister to Vcc ,also connect a 1m resister from the Base of the transister (i.e from one end of the capacitor) to the Vcc . And continue the output from the collector to ic 1 as shown above. It worked for me!

  • Unpopular's picture
    Unpopular
    Aug 21, 2018

    Can you please elaborate your statement? I hope it will work

  • izati's picture
    izati
    May 03, 2017

    how much volt this 10uF..?

  • Amit's picture
    Amit
    May 06, 2017

    I did everyrhing as the circuit diagram 3 times but when i connect battery the led remains on and does not switch off even if i clap. The 7474 also becomes warm.

  • Arun chaudhary's picture
    Arun chaudhary
    May 11, 2017

    i made the circuit but the light is not being off after being on
    once

  • allwin's picture
    allwin
    Jun 12, 2017

    can I use ic 74ac74pc instead of ic Dm74s74n in this circuit

  • Abhishek's picture
    Abhishek
    Jul 05, 2017

    Check if your IC has two D-type flip flop, if yes then you can use it.

  • Aparna's picture
    Aparna
    Jun 30, 2017

    I am using the same circuit. Its working fine with LED and Buzzer at the output. Now I am trying to drive a Motor through driver IC ULN2803. The Motor turns on but turns off immediately before receiving the second clap. Do I need to do anything different then this.The Motor is 6v Dc 100rpm Motor.

  • macques's picture
    macques
    Jul 10, 2017

    I connected the components as instructed but when I clap the led doesn't even turn on, what could be the possible reasons?

  • midi's picture
    midi
    Jul 18, 2017

    i follow all the step and use all the component that being mention,but the led light up already after a battery is being supply to the circuit. it does not required any clap. please help me. i need to do this for my final year project. any idea?

  • Venkat sai's picture
    Venkat sai
    Oct 29, 2017

    Sir can share Gcb board structure of above project

  • vijesh's picture
    vijesh
    Nov 30, 2017

    How can i use relay in this circute..pls help me

  • vijesh's picture
    vijesh
    Dec 10, 2017

    Can i connect relay???according to this circuit??pls replay...

  • Aswinth Raj's picture
    Aswinth Raj
    Dec 11, 2017

    Yes you can replace the LED with a relay driver circuit and control the relay

  • vijesh's picture
    vijesh
    Dec 19, 2017

    Which transistor can use for relay driver according to tis circuit

Pages

Log in or register to post Comment