Sound Sensor Module

Sound Sensor Module

The sound sensor Module is a small board that combines a microphone (50Hz-10kHz) and some processing circuitry to convert sound waves into electrical signals.

This electrical signal is fed to on-board LM393 High Precision Comparator to digitize it and is made available at OUT pin.

SKU: 25483
shield

Safe shopping

Your data is always protected

Sale_coupon_15

40,00EGP

In stock

In stock

17 People watching this product now!
  • shop Pick up from the Store

Everyday from 9 AM to 7 PM

  • aramex ARAMEX DELIVREY

2-3 Days

Total fees when checkout

  • product-return Return within 14 days

Payment Methods:

Description

Sound Sensor Module

The sound sensor Module is a small board that combines a microphone (50Hz-10kHz) and some processing circuitry to convert sound waves into electrical signals.

This electrical signal is fed to on-board LM393 High Precision Comparator to digitize it and is made available at OUT pin.

sound sensor sensitivity adjustment and comparator

The module has a built-in potentiometer for sensitivity adjustment of the OUT signal.

You can set a threshold by using a potentiometer; So that when the amplitude of the sound exceeds the threshold value, the module will output LOW otherwise HIGH.

This setup is very useful when you want to trigger an action when certain threshold is reached. For example, when the amplitude of the sound crosses a threshold (when a knock is detected), you can activate a relay to control the light. You got the idea!

it.

sound sensor power and status leds

Apart from this, the module has two LEDs. The Power LED will light up when the module is powered. The Status LED will light up when the digital output goes LOW.

Sound Sensor Module Pinout

The sound sensor Module only has three pins:

sound sensor module pinout

VCC?pin supplies power for the sensor. It is recommended to power the sensor with between 3.3V ? 5V.

GND?is a ground connection.

OUT?pin outputs HIGH when conditions are quiet and goes LOW when sound is detected. You can connect it to any digital pin on an Arduino or directly to a 5V relay or similar device.

Wiring Sound Sensor Module with Arduino

Let?s hook the sound sensor Module up to the Arduino.

Connections are fairly simple. Start by connecting VCC pin on the module to 5V on the Arduino and GND pin to ground.

Now connect the OUT pin to the digital pin #7 on your Arduino. That?s it!

The following illustration shows the wiring.

wiring sound sensor with arduino

Calibrating Sound Sensor Module

To get accurate readings out of your sound sensor Module, it is recommended that you first calibrate it.

The module has a built-in potentiometer for calibrating the digital output (OUT).

By turning the knob of the potentiometer, you can set a threshold. So that when the sound level exceeds the threshold value, the Status LED will light up and the digital output (OUT) will output LOW.

Now to calibrate the sensor, start clapping near the microphone and adjust the potentiometer until you see the Status LED on the module blink in response to your claps.

That?s it your sensor is now calibrated and ready for use.

Detecting Sound ? Basic Example

Now that you have your sound sensor Module hooked up you?ll need a sketch to make it all work.

The following example detects claps or snaps and prints message on the serial monitor. Go ahead, try the sketch out; and then we will dissect it in some detail.

#define sensorPin 7

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

void setup() {
	pinMode(sensorPin, INPUT);	// Set sensor pin as an INPUT
	Serial.begin(9600);
}

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();
	}
}

If everything is fine, you should see below output on serial monitor when the clap is detected.

sound sensor output

Explanation:

The sketch begins with the declaration of the Arduino pin to which the sensor?s OUT pin is connected.

#define sensorPin 7

Next, we define a variable called?lastEvent?that stores the time since the clap detected. It will help us eliminate spurious sounds.

unsigned long lastEvent = 0;

In the Setup section, we declare the signal pin of the sensor as input. We also setup the serial monitor.

pinMode(sensorPin, INPUT);
Serial.begin(9600);

In the loop section, we first read the digital output from the sensor.

int sensorData = digitalRead(sensorPin);

When the sensor detects any sound loud enough to cross the threshold value, the output goes LOW. But we have to make sure that the sound is due to clapping and not due to the spurious background noise. So, we wait for 25 milliseconds. If output remains LOW for more than 25 milliseconds, we declare that the clap is detected.

if (sensorData == LOW) {
	if (millis() - lastEvent > 25) {
		Serial.println("Clap detected!");
	}
	lastEvent = millis();
}

Control Devices With a Clap

For our next project we will use the sound sensor Module as a ?Clapper? that turns on AC powered devices with the clap of your hands.

This project uses One Channel Relay Module to control AC powered devices. If you are not familiar with the relay module, consider reading (at least skimming) below tutorial.

tutorial for controlling ac devices with one channel relay module and arduino

Interface One Channel Relay Module with Arduino

Sometimes you want your Arduino to control AC powered devices like lamps, fans or other household devices. But because the Arduino operates at 5 volts,…

Wiring

The wiring for this project is very simple.

Warning:
This board interacts with HIGH AC voltage. Incorrect or improper use could result in serious injury or death. So, it is intended for people experienced around, and knowledgeable about HIGH AC voltage.

First you need to supply power to the sensor and the relay module. Connect their VCC pins to the 5V pin on the Arduino and GND to ground.

Next connect the output pin (OUT) on the sound sensor Module to the digital pin #7 on your Arduino, and control pin (IN) on the relay module to the digital pin #8.

You?ll also need to place the relay module in line with the AC powered device you?re attempting to control. You?ll have to cut your live AC line and connect one end of the cut wire (coming from the wall) to COM and the other to NO.

The following illustration shows the wiring.

wiring sound sensor and relay with arduino

Arduino Code

Here?s the sketch to control devices with a clap.

#define sensorPin 7
#define relayPin 8

// Variable to store the time when last event happened
unsigned long lastEvent = 0;
boolean relayState = false;    // Variable to store the state of relay

void setup() {
	pinMode(relayPin, OUTPUT);  // Set relay pin as an OUTPUT pin
	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) {
		//toggle relay and set the output
		relayState = !relayState;
		digitalWrite(relayPin, relayState ? HIGH : LOW);
	}

	// Remember when last event happened
	lastEvent = millis();
	}
}

Once you have loaded and run the program with your hardware hooked up, the sensor should turn on or turn off the device every time you clap.

Explanation:

If you compare this sketch with our previous one you?ll notice many similarities, except few things.

At the start we declare the Arduino pin to which the relay?s control pin (IN) is connected. We have also defined a new variable?relayState?to store the state of relay.

#define relayPin 7

boolean relayState = false;

In the Setup, we define the?relayPin?as being output.

pinMode(relayPin, OUTPUT);

Now when we detect the sound of the clap, instead of printing the message on the serial monitor, we just toggle the state of the relay.

relayState = !relayState;
digitalWrite(relayPin, relayState ? HIGH : LOW);

Troubleshooting

If the Sound Sensor is misbehaving, try the following steps.

  1. Double check that the power supply is clean. Because the sound sensor is an analog circuit, it?s more sensitive to noise on the power supply.
  2. The electret microphone on the sound sensor is also sensitive to mechanical vibration and wind noise. Mounting it with a resilient material can help absorb vibration.
  3. The sensing range of this sound sensor is very small, probably 10 inches, so you have to make a noise much closer to get a good response.

Package Includes:

  • 1x Sound Sensor Module

Related Products:

 

Customer Reviews