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
Tip
More details about Grove modules please refer to Grove System
Specifications¶
Parameter | Value/Range |
---|---|
Voltage | 3.5~10 VDC |
Working Frequency | 50~2000 Hz |
Sensitivity | -48~66 dB |
Signal-to-noise Ratio | >58 dB |
Output Signal range | Analog Signal (0-1023) |
Platforms Supported¶
Arduino | Raspberry Pi | BeagleBone | Wio | LinkIt ONE |
---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
Caution
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¶
Note
If this is the first time you work with Arduino, we firmly recommend you to see 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.
Note
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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.
1 2 | cd ~ git clone https://github.com/Seeed-Studio/grove.py |
- Step 3. Excute below command to run the code.
1 2 | cd grove.py/grove python grove_loudness_sensor.py 0 |
Following is the grove_water_sensor.py code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 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() |
Success
If everything goes well, you will be able to see the following result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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.
Notice
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.
1 2 | cd ~ git clone https://github.com/DexterInd/GrovePi.git |
- Step 3. Excute below commands to monitor the loudness.
1 2 | cd ~/GrovePi/Software/Python python grove_loudness_sensor.py |
Here is the grove_loudness_sensor.py code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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.
1 2 3 4 5 6 7 | 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.
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.
Tech Support¶
Please submit any technical issue into our forum.