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:
– 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.
Clap switch COMPONENTS LIST:
Resistors:
R1,R6,R7 = 4kΩ7
R2 = 150kΩ
R3 = 22kΩ
R4 = 10kΩ
R5 = 150Ω
P1 = 100kΩ preset H
Capacitors:
C1 = 220μF 25V radial
C2 = 100nF
C3 = 1μF 16V
Semiconductors:
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
Miscellaneous:
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)
The microcontroller in this circuit makes it a simple job to add some useful features that are not seen on other clap switch designs:
– 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.
Clap switch COMPONENTS LIST:
Resistors:
R1,R6,R7 = 4kΩ7
R2 = 150kΩ
R3 = 22kΩ
R4 = 10kΩ
R5 = 150Ω
P1 = 100kΩ preset H
Capacitors:
C1 = 220μF 25V radial
C2 = 100nF
C3 = 1μF 16V
Semiconductors:
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
Miscellaneous:
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)