){.nav-menu .menu-item-has-children a{padding-right:20px}.nav-menu .menu-item-has-children a:after{position:absolute;right:7px;top:10}}.vce-ad-container{margin:30px auto;display:block;clear:both;width:728px;position:relative;max-width:100%}.vce-ad-below-header{margin-bottom:0}@media only screen and (max-width:1200px) and (min-width:1024px){.vce-ad-container{width:630px}.vce-ad-below-header{width:728px}}@media only screen and (max-width:1023px){.vce-ad-below-header,.vce-ad-container{width:728px}}@media (max-width:767px){.vce-ad-container{width:375px}}@media (max-width:400px){.vce-ad-container{width:300px}}@media (max-width:320px){.vce-ad-container{width:280px;max-width:100%}}:root .main-navigation ul ul{opacity:1}@media only screen and (min-width:1024px) and (max-width:1200px){.container{max-width:1000px}.vce-main-content{width:700px}.main-navigation ul ul{display:none}.top-header{overflow:hidden}.main-navigation a{padding:15px 9px 15px}.search-header-wrap a{padding:15px}.header-3-wrapper .site-branding{max-width:300px}h1.entry-title{width:540px}.entry-title{display:block}}@media only screen and (min-width:670px) and (max-width:1023px){.header-3-wrapper .site-branding{max-width:300px}.header-3-wrapper .nav-menu>li>a{padding:0 15px}h1.entry-title{width:540px}.entry-title{display:block}}@media only screen and (max-width:1023px){.container{max-width:90%}.vce-main-content{width:100%;padding:15px 0!important}.main-navigation ul ul{display:none}.vce-res-nav{float:left;position:absolute;left:0}.header-3-wrapper{height:50px!important;padding-top:0!important;text-align:center}.header-3-wrapper .site-branding{position:relative;float:none;top:0!important;left:initial!important;text-align:center;max-width:initial;padding:3px 0 7px}.site-branding{padding:4px 0 7px;display:inline-block}.site-branding img{max-width:120px;max-height:28px}.main-header .header-3-wrapper .site-title,.main-header .header-3-wrapper .site-title a.has-logo{line-height:40px!important;font-size:26px!important}.sidebar{margin:0 auto 20px;float:none!important;display:block;clear:both;padding-top:0!important;width:100%;max-width:300px}h1.entry-title{max-width:100%}.vce-responsive-nav{display:block;margin:10px 0 9px}.nav-menu,.top-header{display:none}.main-header .site-title,.main-header .site-title a{line-height:36px!important;font-size:40px!important}li>ul{margin:0}}@media only screen and (min-width:200px) and (max-width:670px){html{margin-top:0!important;overflow-x:visible}html body,button,input,textarea{font-size:14px;line-height:22px}.container{max-width:95%}.vce-main-content{padding:0 0 10px!important}.main-box,.sidebar .widget{margin-bottom:10px}.vce-wrap-right{width:100%;max-width:100%;text-align:center}.vce-single .entry-header{margin:20px 0}.vce-wrap-right{text-align:center}body h1.entry-title{font-size:24px;line-height:30px;padding:0 20px}body p{margin-bottom:20px}body h1{font-size:24px;line-height:34px;margin-bottom:10px}body h4{font-size:18px;line-height:28px;margin-bottom:10px}.sidebar .widget-title{line-height:22px}.vce-wrap-right>ul{float:none;display:inline-block;margin:10px 0 0}}#cookie-notice *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#cookie-notice .cookie-notice-container{display:block}#cookie-notice.cookie-notice-hidden .cookie-notice-container{display:none}.cookie-notice-container{padding:15px 30px;text-align:center;width:100%;z-index:2}.cn-close-icon{position:absolute;right:15px;top:50%;margin-top:-10px;width:15px;height:15px;opacity:.5;padding:10px;outline:none}.cn-close-icon:before,.cn-close-icon:after{position:absolute;content:' ';height:15px;width:2px;top:3px;background-color:#fff}.cn-close-icon:before{transform:rotate(45deg)}.cn-close-icon:after{transform:rotate(-45deg)}#cookie-notice .cn-button{margin:0 0 0 10px}.cn-button.bootstrap{font-family:-apple-system,BlinkMacSystemFont,Arial,Roboto,"Helvetica Neue",sans-serif;font-weight:400;font-size:13px;letter-spacing:.25px;line-height:20px;margin:0;text-align:center;text-transform:none;display:inline-block;touch-action:manipulation;white-space:nowrap;outline:none;box-shadow:none;text-shadow:none;border:none;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;text-decoration:none;padding:8.5px 10px;line-height:1}.cn-button.bootstrap{color:#fff;background:#20C19E}.cn-text-container{margin:0 0 6px 0}.cn-text-container,.cn-buttons-container{display:inline-block}@media all and (max-width:900px){.cookie-notice-container #cn-notice-text{display:block}.cookie-notice-container #cn-notice-buttons{display:block}#cookie-notice .cn-button{margin:0 5px 5px 5px}}@media all and (max-width:480px){.cookie-notice-container{padding:15px 25px}}

Simple Clap Switch/Blow Switch – Do It Yourself

I get a lot of requests to publish simple clap switch projects even in this wireless and internet of things era. Of course, there are countless projects available across the web, and hobby/educational kits are also available for cheap. Even so, I respect the needs of my readers and followers. So, in this post I want to share some random thoughts about clap switch design ideas. Okay, let me write something useful for you!

Not joking, the easiest method to make a clap switch is to buy a do-it-yourself kit from a trusted seller. If so, all you then needed is only a soldering iron and enough spare time to do the soldering work well. For example, below you can see a clap switch kit sold by the famous Chinese online store – IC Station (http://www.icstation.com).

Surprisingly, this hobby kit is designed with a few transistors instead of an IC. However, its output does not have an onboard relay to control external loads – only an LED to indicate clap function instead. The circuit has two main stages – first one is a microphone preamplifier circuit and the second is a bistable multivibrator circuit. This 4-transistor kit is designed to be powered by 5VDC supply. According to the seller’s description, frequency response of the microphone circuitry is restricted to 3kHz (I am a little confused about this foggy description).

I know many of you may not be interested in following this shortcut. So below is an Arduino concept!

In order to build the Arduino clap-operated switch, you need one “Sound Detection Sensor Module” (see below).

In this Chinese module, sound signal is detected by an electret microphone capsule (https://en.wikipedia.org/wiki/Electret_microphone) which is fed into the LM393 voltage comparator (https://www.ti.com/lit/ds/symlink/lm393-n.pdf). The sound level setpoint can be adjusted via an onboard trimpot. When the sound level exceeds the preset threshold, an LED on the module illuminates and the output goes low (H → L).

This is the specification of the above-shown sound detector module (copied from the seller’s page):

  • Operating voltage: 3.3V-5V
  • Outputs digital switching output (high and low level 0 and 1)
  • Operating current (Vcc=5V): 4-8mA
  • Microphone sensitivity (1Khz): 52-48dB
  • Microphone Impedance: 2.2KΩ
  • Microphone Frequency: 16-20Khz
  • Microphone S/N ratio: 54dB
  • Signal output indication LED
  • Single-channel digital signal output
  • Outputs low level and the signal light when there is sound

This is the proposed Arduino hardware wiring diagram:

And, here is the code (Arduino Sketch):

 * Simple Arduino Clap Switch (v1)
 * Key Hardware: Arduino Uno R3 & Sound Sensor Module
 * Read the article to get the full project details!
 * Author: T.K.Hareendran/06-2021
long long int last_states = 0;
void setup() {
  pinMode(8, OUTPUT); // Switch Output = D8
  pinMode(A2, INPUT); // Sound Input = A2
void loop() {
last_states = last_states << 1;
//if(analogRead(A2) > 500){ // For AO Input
  if(analogRead(A2) < 500){ // For DO Input (See Notes)
  if(last_states == 0){
    digitalWrite(8, !digitalRead(8));

Here, both the Arduino hardware and software are configured in a way that it can be modified to work happily with almost all Chinese sound detection sensor modules. Usually, the sound detection sensor module has three connection terminals (+5V, GND, OUT) but you can also see modules with four connection terminals (DO,+, G, AO) where the fourth connection (AO) is the analog signal output.

Yes, this is certainly not a perfect setup, and you need to do some tinkering to make the final version more practical and effective, but I think this is good enough for us at the moment. I am not a seasoned coder. So, if you find something that is not in the right way, feel free to correct me!

Looking at my schematic again with fresh eyes you can clearly see an unknown resistor R2 at the analog input point. Actually, that pulldown resistor is not very important, but there is nothing wrong with adding it there. Anyway, make sure that R2 isn’t too low otherwise it might load the inputted signal you are trying to detect/measure. I was going to go with a 100K (or higher) resistor. Look, here we tailored the analog input A2 to sense both variable range input (analog signal output from the module) and high/low input (digital signal output from the module).

Moreover, output of the Arduino clap switch (D8) is used to turn a single LED (LED1) on and off but that is just for debugging tasks. You should extend the D8 output, through the 2-pin connector CN1, to an appropriate electromagnetic relay to clap-control your electric loads like lamps, fans, etc.

A word of caution: Don’t tinker with fatal mains voltages unless you’re really sure about what you’re doing!

So, you would need to have an NPN transistor, a resistor, and a flyback diode for the electromagnetic relay intended to control the desired load. Really, any small BJT with a minimum hFE of say 50 to 100 could be used – it will however depend how much current you’re willing to draw from the concerned I/O pin, how much current is required to energise the relay’s coil, and the actual hFE of the transistor picked by you, since they vary wildly and the current gain (β)  could easily be significantly more than the stated minimum.

The flyback diode in the circuit is there to conduct the current generated by the de-energising relay coil back across the relay coil, allowing the power to dissipate more gradually, thus heading off an accidental voltage spike.

Or you can try a pre-made Chinese relay module that has an active-high trigger input option.

Finally, below you can see snapshots of my quick prototype used in preparing this tutorial.

As clearly mentioned in the title, this setup can also be used as a ‘tricky’ blow switch! A blow switch is ideal for those who have very limited movement and allows the user to blow into the mouth piece (microphone) to activate a panic alarm. Next time I will describe ways of using inexpensive electronics components to make a dedicated blow switch for nurse call systems.

Voila! That’s the end of today’s post. You can now go ahead and use this adaptable idea for your real-world applications. Enjoy!

Leave a Comment X

1 Comment

  • Author’s Note:

    The threshold values in the code can be tweaked to trigger an appropriate action when a certain sound level is reached. For example, when the amplitude of the sound crosses a predefined threshold (500 now), the code activates D8 I/O of the Arduino in this setup.

    See, when the ADC reports 500, voltage appeared at the Arduino analog input is around 2.45V (10-Bit ADC & 5V).

    Further, this circuitry cannot distinguish between a gentle handclap and a loud noise from another source. That’s quite natural. However, you can modify the basic code by adding an algorithm which take care of the processes of detecting/evaluating claps, resetting counters & states, and toggling the I/O, etc. I won’t get into the details now, but you can see an improved design later!