Sound Sensor Module Interfacing in Arduino

In this article, I will show you how to interface a sound sensor module in Arduino. Using this module, you can capture sound as input to control other parts of your device. Integrating this into your projects can greatly improve the functionality of your device.

Sound Module Interfacing in Arduino: Steps in Creating the Device

Here are the steps in interfacing the sound module in Arduino.

  1. Gathering the Components

    The first thing to do is to collect the hardware components for the Arduino device.
    Arduino Uno
    Sound Sensor Module

  2. Connecting the Components

    Connect the components to the Arduino Uno. Please refer to the wiring diagram below.

  3. Coding the Arduino

    Third step is about coding the Arduino device.

  4. Upload the Sketch

    Final step is uploading the sketch to the Arduino.

Sound Module Interfacing in Arduino: Detailed Explanation

Step 1: Gathering the Components

To start off, this project will have two parts: the Arduino Device and the Program. First thing to do is to collect the hardware components and make the device. To do that, you will be needing the following:

1Arduino Uno
1Sound sensor module

Arduino UNO

Arduino Uno
Arduino Uno

You will be using Arduino Uno for this project. It is an easy to use microprocessor board. Arduino Uno is suitable for any projects and is the cheapest and widely used microprocessor board in the Arduino family. This is great for all kinds of IoT projects.

Sound Sensor Module

Sound Sensor Module
Sound Sensor Module

This is a sound sensor module you will be using. It has 4 pins – GND, 5V, and two output pins for Digital and Analog signals. It has two built-in LEDS – one Power indicator and the other blinks when sound is detected. You can also adjust its sensitivity by tuning the knob clockwise.

Take note that some modules will have 3 pins but it is still the same. It is just that other modules do not provide two output pins.

Step 2: Connecting the Arduino Components

Now you are ready to connect the components to the Arduino Uno. Connect the power and the ground pins to 5V and GND. Next is to connect the VRX and VRY to A0 and A1. Lastly, connect SW pin to a digital pin.

Sound Sensor Wiring Diagram
Sound Sensor Wiring Diagram

In the diagram, the sound sensor module is connected to 5V pin of the Arduino. For the output pin, connect it to digital pin 2. if you have the 4-pin variant, use the digital pin of the module.

Step 3: The Arduino Code

Copy the code below to a new sketch in the Arduino IDE. Once done, you can upload it to the Arduino Uno.

#define sensorPin 2

// Variable to store the time when last event happened
unsigned long lastEvent = 0;

void setup() {
  pinMode(sensorPin, INPUT);  // Set sensor pin as an INPUT

void loop() {
  // Read Sound sensor
  int sensorData = digitalRead(sensorPin);

  // If pin goes LOW, sound is detected
  if (sensorData == LOW) {
    // If 25ms have passed since last LOW state, it means that
    // the clap is detected and not due to any spurious sounds
    if (millis() - lastEvent > 25) {
      Serial.println("Clap detected!");
    // Remember when last event happened
    lastEvent = millis();

Now upload the sketch to the Arduino.

Step 4: Upload the sketch

After you successfully upload the sketch, open the serial monitor of the Arduino. Here you can see that the module detects a clapping sound.

Sound sensor detecting claps
Sound sensor detecting claps


So there you have it! Sound Sensor Module Interfacing in Arduino. This project is intimidating at first but you will see that it is fairly easy to do. You can combine this to other Arduino projects and build an awesome system!


Click the button below to download the sketch for the Sound Sensor.


Feel free to write your questions about this at the comments below.

Leave a Comment