I'm looking to recognize a particular sound using arduino uno.

I need to recognize a clap sequence to trigger a relay.

Having given it some thought i need it to be continuous listening mode with out any trigger such as a button press. The background will be quiet.

Is the arduino uno powerful enough to do this and how will i get stated on this? Any help is appreciated.

Note i need to do this entirely onthe Uno itself and not on PC like How do I listen for a sound that matches a pre-recorded sound?

I am thinking i will prerecord the sound and compare with a live sample, is this feasible?

3 Answers 3


If it's just a clap sound and the background is quiet, then really all you'd need is to sense how loud the sound is. This can be done using an analog comparator interrupt (this is present on the chip itself but not on the Arduino library). If all the uno is doing is measuring the sound and maybe setting an output pin when it's loud, then just poll the analogs attached to your microphone and trigger the condition when the output is loud enough. You'd probably need to amplify the microphone if you haven't already, but yes, the uno can handle that.

Edit: if it's a clapping sequence, then it can still do it. Again, just measure the time between loud and quiet, don't worry about what the sound is (that is, you don't need to worry about exactly recording and analyzing the sound, you just need to know when it's loud and when it's quiet)

  • How would it work if work if there was a clap and another loud sound like a clap (but not a clap)? Commented Nov 16, 2016 at 18:46
  • 1
    It wouldn't, unfortunately. My answer above really just deals with the case where the only thing that happens is a clap. Otherwise yes, you'd have to properly identify the sound, which is more complex Commented Nov 16, 2016 at 19:01
  • If you make a piece of code that detects a short, high volume. It will work better than just a high volume. You could also do two claps (high volume bursts) with an expected time between them. This will filter occasional high volume sounds.
    – aaa
    Commented Nov 17, 2016 at 17:05

Adding to Michaels answer above which only works for some cases (and it wont work perfectly even with a sequence of claps). To make it work in more cases you would need to store more information about the clap noise- as Michael points out in his comment above "properly identify" the clap- to make the identification more accurate. There are various ways to do this- you could compare it with live recording as you wrote in your question. I suggest tyou try neural networks to do such a comparision I. I would say you would need a two layer neural network with say a sample of different claps for training it-(its probably quicker to train it not with arduino). Here is a library for neural networks for arduino


that you may use. Or you can implement you own neural network. Its well known that sound recognition can be used to analyse sounds.

The built in ADC of Arduino can probably be used to record and good enough for something like a clap in your case-though it cant be used for high quality sound recordings.


I have not tested it but there is an example for the ArduinoSound library which especially detects claps.


 This example reads audio data from an Invensense's ICS43432 I2S microphone
 breakout board, and uses the input to detect clapping sounds. An LED is
 togggled when a clapp is detected.

 * Arduino/Genuino Zero, MKRZero or MKR1000 board
 * ICS43432:
   * GND connected GND
   * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKRZero)
   * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKRZero)
   * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKRZero)
   * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKRZero)

 created 18 November 2016
 by Sandeep Mistry

#include <ArduinoSound.h>

// the LED pin to use as output
const int ledPin = LED_BUILTIN;

// the amplitude threshold for a clap to be detected
const int amplitudeDeltaThreshold = 100000000;

// create an amplitude analyzer to be used with the I2S input
AmplitudeAnalyzer amplitudeAnalyzer;

// variable to keep track of last amplitude
int lastAmplitude = 0;

void setup() {
  // setup the serial

  // configure the LED pin as an output
  pinMode(ledPin, OUTPUT);

  // setup the I2S audio input for 44.1 kHz with 32-bits per sample
  if (!AudioInI2S.begin(44100, 32)) {
    Serial.println("Failed to initialize I2S input!");
    while (1); // do nothing

  // configure the I2S input as the input for the amplitude analyzer
  if (!amplitudeAnalyzer.input(AudioInI2S)) {
    Serial.println("Failed to set amplitude analyzer input!");
    while (1); // do nothing

void loop() {
  // check if a new analysis is available
  if (amplitudeAnalyzer.available()) {
    // read the new amplitude
    int amplitude = amplitudeAnalyzer.read();

    // find the difference between the new amplitude and the last
    int delta = amplitude - lastAmplitude;

    // check if the difference is larger than the threshold
    if (delta > amplitudeDeltaThreshold) {
      // a clap was detected
      Serial.println("clap detected");

      // toggle the LED
      digitalWrite(ledPin, !digitalRead(ledPin));

      // delay a bit to debounce

    // update the last amplitude with the new amplitude
    lastAmplitude = amplitude;
  • 2
    The question is tagged “arduino-uno”, which is a board ArduinoSound does not support. Commented Sep 13, 2019 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.