Grove - Loudness Sensor

From Wiki
Jump to: navigation, search


The Grove - Loudness Sensor is designed to detect the loudness of environmental sound. Based on amplifier LM2904 and a built-in microphone, it amplifies and filters the high frequency signal that received from the microphone, and outputs a positive envelop. This will make 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. Lastly, there is a screw potentiometer that enables manual adjustments to the output gain. Previous Version: v0.9b



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)


With Arduino This module uses the chip LM2904 to amplify the electronic signal produced by the mini microphone. At last, you’ll get the analog-to-digital conversion value. Let's try to read the output value.

As the picture on the below indicates, the Loudness sensor is connected to analog port A0 of the Grove - Basic Shield Loudness Sensor .JPG

Connect Arduino/ to PC by using a USB cable. Copy and paste code below to a new Arduino sketch. int val; void setup() { Serial.begin(9600); }

void loop() { analogRead(0); delay(10); val = analogRead(0); Serial.println(val); delay(200); } Upload the code. Then open the serial monitor to observe the output results. There will be a significant change when blow to the sensor. Loudness Sensor.jpg

The blue line is the original signal from microphone and the yellow is the sig pin of Loudness Sensor. It is the original signal envelope that the module outputs. Here is the test screenshot from the oscilloscope. Blowing to the sensor: Loudness Sensor Test 1.BMP Speak to the sensor: Loudness Sensor Test 3.BMP

With Raspberry Pi 1.You should have got a raspberry pi and a grovepi or grovepi+. 2.You should have completed configuring the development enviroment, otherwise follow here. 3.Connection Plug the sensor to grovepi socket A0 by using a grove cable. 4.Navigate to the demos' directory:

  cd yourpath/GrovePi/Software/Python/

To see the code

  nano   # "Ctrl+x" to exit #

import time import grovepi

  1. Connect the Grove Loudness Sensor to analog port A0

loudness_sensor = 0

while True:

       # Read the sound level
       sensor_value = grovepi.analogRead(loudness_sensor)
       print "sensor_value =", sensor_value
   except IOError:
       print "Error"

5.Run the demo.

  sudo python