Grove - Loudness Sensor
The Grove - Loudness Sensor is designed to detect the sound of environment. Based on LM2904 amplifier and a built-in microphone, it amplifies and filters the high frequency signal that received from the microphone, and outputs a positive envelop. This is used for Arduino’s signal acquisition. The output value depends on the level of sound input. In order to avoid unnecessary signal disturbances, input signal will go through two times’ filtering inside the module. There is a screw potentiometer that enables manual adjustments to the output gain.
Version
Product Version | Changes | Released Date |
---|---|---|
Grove-Loudness Sensor V0.9b | Initial | Dec 2012 |
Features
- Grove Interface
- Easy to use
- Basic Grove element
More details about Grove modules please refer to [Grove System](https://wiki.seeedstudio.com/Grove_System/)
Specifications
Parameter | Value/Range |
---|---|
Voltage | 3.5~10 VDC |
Working Frequency | 5~2000 Hz |
Sensitivity | -60~-56dBV/Pa |
Signal-to-noise Ratio | >58 dB |
Output Signal range | Analog Signal (0-1023) |
Platforms Supported
Arduino | Raspberry Pi | |||
---|---|---|---|---|
The platforms mentioned above as supported is/are an indication of the module's software or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.
Getting Started
If this is the first time you work with Arduino, we firmly recommend you to see [Getting Started with Arduino](https://wiki.seeedstudio.com/Getting_Started_with_Arduino/) before the start.
Play With Arduino
Hardware
- Step 1. Prepare the below stuffs:
Seeeduino V4.2 | Base Shield | Grove-Loudness Sensor |
---|---|---|
Get One Now | Get One Now | Get One Now |
- Step 2. Connect Grove-Loudness Sensor to A0 port of Grove-Base Shield.
- Step 3. Plug Grove - Base Shield into Seeeduino.
- Step 4. Connect Seeeduino to PC via a USB cable.
If we don't have Grove Base Shield, We also can directly connect Grove-Loudness Sensor to Seeeduino as below.
Seeeduino | Grove-Loudness Sensor |
---|---|
5V | Red |
GND | Black |
NC | White |
A0 | Yellow |
Software
- Step 1. Please copy below code to Arduio IDE and upload to arduino. If you do not know how to upload the code, please check how to upload code.
int loudness;
void setup()
{
Serial.begin(9600);
}
void loop()
{
loudness = analogRead(0);
Serial.println(loudness);
delay(200);
}
- Step 2. Open the serial to monitor the output. It will be a significant change when blow to the sensor.
Play With Raspberry Pi (With Grove Base Hat for Raspberry Pi)
Hardware
- Step 1. Things used in this project:
Raspberry pi | Grove Base Hat for RasPi | Grove - Loudness Sensor |
---|---|---|
Get ONE Now | Get ONE Now | Get ONE Now |
- Step 2. Plug the Grove Base Hat into Raspberry Pi.
- Step 3. Connect the Grove - Loudness Sensor to to the A0 port of the Base Hat.
- Step 4. Connect the Raspberry Pi to PC through USB cable.
Software
- Step 1. Follow Setting Software to configure the development environment.
- Step 2. Download the source file by cloning the grove.py library.
cd ~
git clone https://github.com/Seeed-Studio/grove.py
- Step 3. Excute below command to run the code.
cd grove.py/grove
python grove_loudness_sensor.py 0
Following is the grove_water_sensor.py code.
import math
import sys
import time
from grove.adc import ADC
class GroveLoudnessSensor:
def __init__(self, channel):
self.channel = channel
self.adc = ADC()
@property
def value(self):
return self.adc.read(self.channel)
Grove = GroveLoudnessSensor
def main():
if len(sys.argv) < 2:
print('Usage: {} adc_channel'.format(sys.argv[0]))
sys.exit(1)
sensor = GroveLoudnessSensor(int(sys.argv[1]))
print('Detecting loud...')
while True:
value = sensor.value
if value > 10:
print("Loud value {}, Loud Detected.".format(value))
time.sleep(.5)
if __name__ == '__main__':
main()
If everything goes well, you will be able to see the following result:
pi@raspberrypi:~/grove.py/grove $ python grove_loudness_sensor.py 0
Detecting loud...
Loud value 15, Loud Detected.
Loud value 11, Loud Detected.
Loud value 250, Loud Detected.
Loud value 429, Loud Detected.
Loud value 203, Loud Detected.
Loud value 16, Loud Detected.
Loud value 11, Loud Detected.
^CTraceback (most recent call last):
File "grove_loudness_sensor.py", line 68, in <module>
main()
File "grove_loudness_sensor.py", line 65, in main
time.sleep(.5)
KeyboardInterrupt
You can use this sensor to detect the loudness. Press ++ctrl+c++ to quit.
You may have noticed that for the analog port, the silkscreen pin number is something like **A1, A0**, however in the command we use parameter **0** and **1**, just the same as digital port. So please make sure you plug the module into the correct port, otherwise there may be pin conflicts.
Play With Raspberry Pi(with GrovePi_Plus)
Hardware
- Step 1. Prepare the below stuffs:
Raspberry pi | GrovePi_Plus | Grove-Loudness Sensor |
---|---|---|
Get One Now | Get One Now | Get One Now |
- Step 2. Plug the GrovePi_Plus into Raspberry.
- Step 3. Connect Grove-Loudness Sensor to A0 port of GrovePi_Plus.
- Step 4. Connect the Raspberry to PC through USB cable.
Software
- Step 1. Follow Setting Software to configure the development environment.
- Step 2. Git clone the Github repository.
cd ~
git clone https://github.com/DexterInd/GrovePi.git
- Step 3. Excute below commands to monitor the loudness.
cd ~/GrovePi/Software/Python
python grove_loudness_sensor.py
Here is the grove_loudness_sensor.py code.
import time
import grovepi
# Connect the Grove Loudness Sensor to analog port A0
# SIG,NC,VCC,GND
loudness_sensor = 0
while True:
try:
# Read the sound level
sensor_value = grovepi.analogRead(loudness_sensor)
print("sensor_value = %d" %sensor_value)
time.sleep(.5)
except IOError:
print ("Error")
- Step 4. We will see the loudness status as below.
pi@raspberrypi:~/GrovePi/Software/Python $ python grove_loudness_sensor.py
sensor_value = 135
sensor_value = 23
sensor_value = 196
sensor_value = 258
sensor_value = 98
sensor_value = 131
FAQ
- Q1: What is the difference between Grove-Loudness sensor and Grove - Sound Sensor?
- A1: The Grove-Loudness sensor have screw potentiometer to adjust the output gain.
Schematic Online Viewer
Resources
- [Eagle&PDF] Grove - Loudness Sensor Schematic
- [Datasheet] LM2904DR Datasheet
Projects
Solar Powered Environmental Monitoring Kit: A solar-powered open source kit for monitoring air quality, sound level, humidity, and temperature.
The Da Vinci Code: The work combines art and electronics. The art part makes the skeleton and consists of 11 layers of medium density fiberboard.
Upgradable to Industrial Sensors
With the SenseCAP S2110 controller and S2100 data logger, you can easily turn the Grove into a LoRaWAN® sensor. Seeed not only helps you with prototyping but also offers you the possibility to expand your project with the SenseCAP series of robust industrial sensors.
The IP66 housing, Bluetooth configuration, compatibility with the global LoRaWAN® network, built-in 19 Ah battery, and powerful support from APP make the SenseCAP S210x the best choice for industrial applications. The series includes sensors for soil moisture, air temperature and humidity, light intensity, CO2, EC, and an 8-in-1 weather station. Try the latest SenseCAP S210x for your next successful industrial project.
Tech Support
if you have any technical issue. submit the issue into our forum.