ARDUINO – Sound Sensor example – IOT

Hello Folks,

This is second article on IoT sensors today. Today I’m going to show how to connect and use sound sensor. Sound sensor used detect the sound in proximity.

The Pre-requisite for this and next few articles are:

1. Raspberry Pi or Arduino Board – in simple words it a small size computer that can connect to TV, Bluetooth, WiFi etc.

2. Sound Sensor
3. LEDs – required to check or test output ( visualize )
4. Jumper Cables – to connect the circuits and LED etc

In this example I have used Arduino Uno board ( as it much cheaper that Raspberry Pi and more than enough for next few examples).
The board has GND, Analog and Digital and Power Pins. The board schematics can be found here

Lets have a look at following sketch-

int soundSensor=2;
int LED=4;
boolean LedStatus = false;

void setup() {
  // put your setup code here, to run once:
 pinMode(soundSensor, INPUT);

void loop() {
  // put your main code here, to run repeatedly:
  int sensorData = digitalRead(soundSensor);

      LedStatus = true;
      LedStatus = false;

As you can see setup() and loop() are two building block/functions to start with.
The setup() method execute once in program lifetime and loop() runs through out. Usually setup() method we initialize/registered the Input, Output pins and other variables.
and in loop() method the main business logic.

Sound Sensor has VCC, GND and OUT pins. Connect VCC pin to Arduino +5v. Complete the circuits as shown in below image.

Sound Sensor connection

Its time to test now – Once done Connect the board to laptop using power USB cable as shown in picture. Then click on ‘verify’ button to compile the project.
Once compilation is successful, click on ‘Upload’ button to run program on board. Once uploading is done, try to make some sound and as a result you will see LED on/off.

Bingo, you done it!!! Stay Connected.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s