Interfacing Sound Sensor with Arduino

A Brief on Sound Sensor (Sound Detector)

A Sound Sensor is a simple device that detects sound. It is simply put a Microphone with some processing circuit. Using a Sound Sensor, you can measure the intensity of sound from different sources like knocks, claps, loud voices, etc.The Sound Sensor used in this project is shown in the image below.
It consists of a microphone, a voltage comparator IC (LM393), a potentiometer, a transistor, couple of LEDS and a few other passive components (resistors and capacitors).

Pins and Components of Sound Sensor

  • Microphone 
  • LM393 Voltage Comparator IC
  • NPN Transistor (marked as J6 on my board)
  • 10KΩ Resistors x 2 
  • 1KΩ Resistors x 3 
  • 10KΩ Potentiometer
  • 100nF Capacitors x 4 
  • LEDs x 2 
  • 510KΩ Resistor
  • 51KΩ Resistor 
The following image will help you identify the components and pins on a typical LM393 IC based Sound Sensor Module.

Schematic of Sound Sensor

If you want to understand a little bit more about the sound sensor module, then knowing the schematic is the best way to get started. There are several Sound Sensor Modules available in the market that are implemented using different ICs like LM324, LM393, LM344, LM386 etc. So, check your sound sensor for the main IC and determine its schematic.
The following image shows the schematic of the Sound Sensor Module that is implemented using LM393 Voltage Comparator IC.
Interfacing Sound Sensor with Arduino Sound Sensor Module Schematic
If you observe in the Schematic, I have pointed out where you can extract the Analog Output from the sensor. In most LM393 based Sound Sensors, only Digital Out is available i.e. when detected sound is Higher or Lower than a certain level, the output of the sensor will Low or High.
In my case, the sound sensor will produce a logic LOW when sound is detected and a logic HIGH when there is no sound.

Interfacing Sound Sensor with Arduino

As the project is about interfacing a Sound Sensor with Arduino, let us see how its done. For this, I have designed a couple of circuit where in the first circuit I will just interface the Sound Sensor with Arduino and detect the sound with the help of an LED.
Coming to the second circuit, I will control a relay with the help of sound (snap of fingers). For both the sensors, the part with interfacing of the Sound Sensor with Arduino is same but the actions after detecting the sound is different.
Also, since I have already mentioned that my sound sensor has only digital output, I will be using only the digital I/O pins of the Arduino.

Components Required

  • Sound Sensor Module 
  • Arduino UNO [Buy Here]
  • Relay Module (5V) 
  • LED 
  • 1KΩ Resistor 
  • Connecting wires 
  • Mini Breadboard 

Circuit Diagram of Interfacing Sound Sensor with Arduino







code

const int ledPin = 12;
const int soundPin = 7;

int soundVal = 0;

void setup ()
{
  pinMode (ledPin, OUTPUT);
  pinMode (soundPin, INPUT);
}

void loop ()
{
  soundVal = digitalRead(soundPin);
  if (soundVal == LOW)
  {
    digitalWrite(ledPin, HIGH);
  }
  else
  {
    digitalWrite(ledPin, LOW);
  }
 }