Sound sensor with Arduino

Hello guys, Welcome back to my blog. We discussed servo motors in a previous post. Do you remember it? We presented 11 articles on Arduino basics. If you have not read those articles yet, please read them. I will hope to present Nodemcu lessons in the next articles.OK let’s go to today’s post. Today we are going to talk about the sound sensor.

What is the Sound sensitive sensor?

It is a sound recognition sensor. The sound sensor includes a condenser microphone. It is used to recognize sounds. If you want to change the sound recognition range, you can use the sensor’s preset controller. This sensor cannot detect sounds separately. There are other sensors on the market that are suitable for that. This sensor has three pins. It is VCC, GND, and OUT pins. VCC and GND pins are used to power up the sensor and the OUT pin is used to get output. Using this sensor we can get the digital value. We can get 0 when this sensor detects noise and 1 when it is not. We can connect this sensor to any digital pins on your Arduino board. Using this sensor we can create amazing projects. We will discuss those projects in the following articles. Today we are doing a project to blink an LED bulb using this sound sensor. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Let’s Identify these components.

Step 2

Please attach the components to your breadboard.

Step 3

Connect these components to the Arduino board using the jumper wire. See the circuit diagram below.

Step 4

Ok, Let’s look at the code.

  • The complete program of this project – Download
void setup() {
  pinMode(2, INPUT);//define arduino pin
  pinMode(3, OUTPUT);//define arduino pin
  Serial.begin(9600);//enable serial monitor
}
void loop() {
  bool pulse = digitalRead(2);//Get the value and put into the variable
  if (pulse == 0) {
    digitalWrite(3, HIGH);//LED on
    Serial.println("ON");//print serial monitor "ON"
  } else {
    digitalWrite(3, LOW);//LED OFF
    Serial.println("OFF");//print serial monitor "OFF"
  }
}

Let’s identify this code one by one. This code sets the second pin as the input pin and the third pin as the output pin.

void setup() {
  pinMode(2, INPUT);//define arduino pin
  pinMode(3, OUTPUT);//define arduino pin
  Serial.begin(9600);//enable serial monitor
}

This code reads the sensor value and puts it in the Boolean variable. The variable name is ‘pulse’.

bool pulse = digitalRead(2);

The digital value is checked using the IF condition. The LED bulb turns on when the digital value is 0. The LED bulb turns off when the digital value is 1.

Step 5

Now, select the board and port. After, click the upload button.

Now you can test this project. The full video guide is below. We hope to see you in the next project or tutorial.

Sound sensor with Arduino

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Select your currency
USD United States (US) dollar
EUR Euro
Scroll to Top