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: 

Comments (68)

  • Francis Manalo's picture
    Francis Manalo

    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?

    Sep 16, 2015
  • Dryx's picture
    Dryx

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

    Oct 04, 2015
  • Jayant's picture
    Jayant

    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.

    Oct 06, 2015
  • Dryx's picture
    Dryx

    Will this work if i use a 6V source?

    Oct 07, 2015
  • Dryx's picture
    Dryx

    How can i adjust the sensitivity of the microphone?

    Oct 13, 2015
  • Abhishek's picture
    Abhishek

    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.

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

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

    Oct 15, 2015
  • Madhu's picture
    Madhu

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

    Oct 18, 2015
  • usman's picture
    usman

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

    Oct 22, 2015
  • usman's picture
    usman

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

    Oct 22, 2015
  • Abhishek's picture
    Abhishek

    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.

    Oct 22, 2015
  • usman's picture
    usman

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

    Oct 23, 2015
  • Zidane's picture
    Zidane

    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

    Oct 29, 2015
  • Maddy's picture
    Maddy

    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

    Nov 03, 2015
  • petchu's picture
    petchu

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

    Nov 24, 2015
  • Maddy's picture
    Maddy

    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.

    Nov 28, 2015
  • chupet's picture
    chupet

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

    Aug 27, 2016
  • petchu 's picture
    petchu

    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

    Nov 28, 2015
  • David's picture
    David

    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

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

    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

    Dec 12, 2015
  • Abhishek's picture
    Abhishek

    Ignore R2 and these two steps are not necessary.

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

    Where can we get this 7474 ic ?

    Dec 14, 2015
  • Abhishek's picture
    Abhishek

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

    Dec 17, 2015
  • Shivu raj's picture
    Shivu raj

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

    Jan 08, 2016
  • Abhishek's picture
    Abhishek

    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.

    Jan 14, 2016
  • Patrick's picture
    Patrick

    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.

    Jan 23, 2016
  • Karina's picture
    Karina

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

    Feb 03, 2016
  • Maddy's picture
    Maddy

    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.

    Feb 08, 2016
  • bruno's picture
    bruno

    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.

    Feb 16, 2016
  • Ashok's picture
    Ashok

    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..

    Feb 17, 2016
  • bruno's picture
    bruno

    buy another microphone :D

    Feb 22, 2016
  • nick's picture
    nick

    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?

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

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

    Mar 16, 2016
  • sekar's picture
    sekar

    nice !

    Mar 18, 2016
  • Shamiul's picture
    Shamiul

    will this work with a 12v source??

    Mar 24, 2016
  • Abhishek's picture
    Abhishek

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

    Mar 28, 2016
  • samuel's picture
    samuel

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

    Apr 04, 2016
  • Shamiul's picture
    Shamiul

    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 :)

    Apr 07, 2016
  • vishal's picture
    vishal

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

    Apr 24, 2016
  • Maddy's picture
    Maddy

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

    May 17, 2016
  • Chris's picture
    Chris

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

    May 09, 2016
  • Debanjan's picture
    Debanjan

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

    May 21, 2016
  • Lena's picture
    Lena

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

    Jun 11, 2016
  • Deep's picture
    Deep

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

    Jul 15, 2016
  • Madhurya's picture
    Madhurya

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

    Jul 25, 2016
  • MiDi's picture
    MiDi

    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 !

    Jul 27, 2016
  • Leshi's picture
    Leshi

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

    Aug 10, 2016
  • Abhishek's picture
    Abhishek

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

    Aug 13, 2016
  • allen's picture
    allen

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

    Aug 10, 2016
  • Abhishek's picture
    Abhishek

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

    Aug 13, 2016
  • talha's picture
    talha

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

    Aug 31, 2016
  • Md Subhan's picture
    Md Subhan

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

    Sep 11, 2016
  • Ankita's picture
    Ankita

    Which condenser mic is to be used?

    Sep 18, 2016
  • Lwin zaw lhyo 's picture
    Lwin zaw lhyo

    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

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

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

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

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

    Oct 22, 2016
  • Junhui's picture
    Junhui

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

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

    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 []

    Oct 31, 2016
  • Joshua's picture
    Joshua

    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?

    Nov 24, 2016
  • ali's picture
    ali

    Can we use the ic 4017 for 7474

    Dec 04, 2016

Leave a comment