Position: Index > Switch Circuit >

Clap Switch Circuit

2015-10-07 11:53  
Declaration:We aim to transmit more information by carrying articles . We will delete it soon, if we are involved in the problems of article content ,copyright or other problems.

A clap switch circuit is a classic beginner’s project. Equipment can be switched on and off by just clapping your hands. Add a tiny microcontroller and you can easily build-in some more useful features.
The microcontroller in this circuit makes it a simple job to add some useful features that are not seen on other clap switch designs:

Clap Switch circuit diagram

clap switch diagram

– Changeover relay contacts enable the unit to be wired in conjunction with a manual changeover switch so
that manual override of the switched equipment is always possible.
– The unit is only responsive to a specific sequence of sounds i.e., two claps within a defined time window.
– A safety feature masks the input for a given time window if misuse (repeated commands) is detected (useful if children have discovered how it works).
The safety feature and two-clap sequence detector can be built using TTL or CMOS flip-flops but by using a single microcontroller the circuit can be greatly simplified. A mains power supply is included so no additional power source is required.

The Microchip flash PIC12F629 microcontroller is a neat device; the small 8-pin package contains a complete microcontroller including clock generator, reset circuitry, Flash ROM, RAM and EEPROM. Two of the eight pins are used for the supply connections while the remaining six are general-purpose I/O pins. A few of these pins have special function like the comparator inputs. The sound sensitivity of the circuit can be adjusted by programming the comparator threshold level in software.

Maplin Velleman Clap On/Off switch Video

Ready-made clap switch products

velleman-clap-on-off-switchVelleman Clap On/ Off Switch : MK139 – at only $17
Microprocessor controlled!
Electronic kit, assembly required.
Operates your lighting with a simple handclap!

rf-clapperRF Clapper Plus Cl84512 – at $25
Clap Your Hands & Turn Your Appliances On Or Off
Now With RF Technology You Can Also Press A Remote Control Button & Your Lights Will Effortlessly Turn On Or Off.

The circuit diagram in Figure 1 shows that besides the microcontroller there are very few other components. The two-pin electret microphone produces an electrical signal in response to sound pressure waves. Transistor T1 amplifies the signal and preset P1 allows some adjustment of the circuit sensitivity by altering the bias voltage of T1.

Two of the PIC output pins are used to drive a bistable relay via transistors T2 and T3. This type of relay has two energising coils. A short electrical pulse on one of the coils is enough to switch the relay in one direction while a pulse to the other coil will cause the relay to switch back. This type of relay has two main advantages: the relay is latching in both open and close direction so a short pulse is all that is necessary to switch it. Secondly the latching feature ensures that the relay retains its switched state even during a power failure. Changeover relay contacts enable the unit to be wired together with a changeover type manual switch, allowing the equipment to be switched manually if for any reason the clap switch is switched off.

Pins 2 and 7 are used to switch a twocolour LED providing a visual indication of the switched state of the relay. The last output pin of the PIC is not used and is connected to a jumper to allow switching software options.
Clapping relay Software
When the signal level at GP1 goes low (clap detected) the program waits for approximately 200 ms during which time the LED glows red. After this period the LED switches to green and the software samples the input for approximately three seconds. If a second clap is detected during this period, the controller switches the output. After switching, the controller ignores any further clap sounds for approximately 10 s and the LED lights red. The output state is stored in EEPROM so that if a power failure occurs the software will switch the correct relay coil when power is re-established.

A safety feature counts each switching event on an internal counter, which is decremented slowly in software. Should this counter exceed a threshold level, the circuit will ignore any input signals for approximately one minute and the LED blinks red. This will ensure that the circuit does not respond to an extended burst of noise (e.g., applause).

Clap switch PCB

clap relay pcb
The PCB layout shown in Figure 2 accommodates all components apart from the electret microphone. This is attached to the board at the MIC /– connections with a length of shielded audio lead (keep the wire length to less than around 10 cm).

Mounting the components onto the PCB should be quite straightforward. Start by fitting the single wire bridge next to rectifier B1. Ensure that all polarised components (diodes, LEDs, capacitors and the IC) are fitted the correct way round. The LED leads should be trimmed so that when it is soldered to the board it protrudes through a hole in the lid when the case is assembled; alternatively use a translucent enclosure.

Once all components have been fitted and all solder connections have been inspected the PCB can be fitted into an insulated enclosure. The mains input lead will require some form of strain relief. Be aware that some tracks carry lethal voltages. All appropriate safety guidelines must therefore be adhered to. A small hole can be made in the lid directly over preset P1 if it is necessary to adjust the sensitivity of the circuitwithout dismantling the unit. Lastly, don’t forget to add perforations in the case so that sound waves can reach the microphone capsule.

R1,R6,R7 = 4kΩ7
R2 = 150kΩ
R3 = 22kΩ
R4 = 10kΩ
R5 = 150Ω
P1 = 100kΩ preset H
C1 = 220μF 25V radial
C2 = 100nF
C3 = 1μF 16V
B1 = B80C1500 (round case, 80V piv, 1.5A)
D1,D2 = 1N4148
D3 = bicolour LED (red/green)
IC1 = 78L05
IC2 = PIC12F629CP, programmed
T1,T2,T3 = BC238 or BC547
JP1 = 2-way pinheader with jumper
K1 = 2-way PCB terminal block, lead pitch 7.5mm
K2 = 3- way PCB terminal block, lead pitch 7.5mm
MIC1 = 2-terminal electret microphone capsule
Re1 = bistable relay, 2 x changeover (e.g., Schrack RT314F12)
Tr1 = mains transformer 1 x 6V, min. 2VA, short-circuit proof (e.g., Marschner VN30.15/10522 or Era 030-7340.0T; Conrad Electronics # 506141)

PIC12F629 datasheet
Reprinted Url Of This Article: