Clap On Clap Off Switch

Published  November 5, 2015   102
J Jayant
Author
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

Have any question realated to this Article?

Ask Our Community Members

Comments

Submitted by Francis Manalo on Wed, 09/16/2015 - 06:38

Permalink

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?

Submitted by Dryx on Sun, 10/04/2015 - 17:45

Permalink

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

Submitted by usman on Thu, 10/22/2015 - 01:23

Permalink

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

Submitted by usman on Fri, 10/23/2015 - 00:01

Permalink

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

Submitted by Zidane on Thu, 10/29/2015 - 17:46

Permalink

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

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

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.

Submitted by petchu on Sat, 11/28/2015 - 16:27

Permalink

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

Submitted by David on Thu, 12/10/2015 - 07:54

Permalink

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

Submitted by Rashid Qureshi on Sat, 12/12/2015 - 18:53

Permalink

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

Submitted by Shivu raj on Fri, 01/08/2016 - 00:28

Permalink

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

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.

Submitted by Patrick on Sat, 01/23/2016 - 16:55

Permalink

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.

Submitted by Karina on Wed, 02/03/2016 - 15:56

Permalink

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

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.

Submitted by bruno on Tue, 02/16/2016 - 22:26

Permalink

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.

Submitted by Ashok on Wed, 02/17/2016 - 23:45

Permalink

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

Submitted by nick on Wed, 03/02/2016 - 18:24

Permalink

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?

Submitted by Shamiul on Thu, 04/07/2016 - 15:04

Permalink

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

Submitted by Debanjan on Sat, 05/21/2016 - 00:02

Permalink

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

Submitted by Lena on Sat, 06/11/2016 - 23:43

Permalink

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

Submitted by MiDi on Wed, 07/27/2016 - 14:56

Permalink

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 !

Submitted by Leshi on Wed, 08/10/2016 - 17:27

Permalink

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

Submitted by Lwin zaw lhyo on Sun, 10/02/2016 - 14:28

Permalink

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

Submitted by shah rukh on Sat, 10/22/2016 - 22:39

Permalink

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

Submitted by Junhui on Mon, 10/24/2016 - 04:52

Permalink

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

Submitted by Uzair Arif on Mon, 10/31/2016 - 15:16

Permalink

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

Submitted by Joshua on Thu, 11/24/2016 - 19:58

Permalink

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?

Submitted by irfan on Sat, 02/04/2017 - 11:43

Permalink

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

Submitted by Junaid Ahmed Khan on Tue, 03/21/2017 - 00:32

Permalink

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.

Submitted by Jaskeerat on Thu, 03/30/2017 - 03:30

Permalink

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?

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!

Submitted by Amit on Sat, 05/06/2017 - 12:42

Permalink

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.

Submitted by Aparna on Fri, 06/30/2017 - 15:47

Permalink

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.

Submitted by macques on Mon, 07/10/2017 - 12:23

Permalink

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

Submitted by midi on Tue, 07/18/2017 - 11:31

Permalink

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?

Submitted by vijesh on Sun, 12/10/2017 - 07:16

Permalink

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