Raspberry Pi 2 with a Grove Board having a Sound Sensor attached. I’m using as a basis the supplied sample script to test how the sensor works. It’s amended to print a message when the threshold of 200 is exceeded, but after making a noise loud enough to trigger that, it then continues to report high values even though the environment has returned to its quiet state. From the appearance of the code, it gets the momentary value being returned by the module, so I can’t see why it continues reporting a loud noise when there is none.
First, is the sensor functioning correctly, and if so, what can I do to have it report the sound value at the moment of its being measured? Or is it malfunctioning?
Second, what are the values being returned? Are they arbitrary values or decibels?
Can anybody point me at documentation for this device?
It’s ironic that I’m having a sound sensor problem and am getting silence on the forum…
The Seeedstudio wiki page for this sensor seems to be broken at the moment. You can however see an archived version here:
From what I understand, the values read from the sensor are just its voltage with a 5/1024 ratio applied.
Measuring decibels require much more sophisticated (and calibrated) hardware than what this sensor provides.
That said, I do not really know why you have this behaviour.
Could you attach in a .txt file the script you are using? I think I may have a sound sensor somewhere, I could check how it behaves with your script…
Thanks Frederic! The script I’m using is closely based the one on the page you sent me, and I’ve attached it, together with a log of a session in which the sound sensor is right next to a loudspeaker playing some music. As you can see, it settles down to a value about 300, and then the speaker was turned off, and in silence it continued to report a value of about 320.
I used your script, minus the LED part. My setup was based on a GrovePi+ running firmware 1.2.6.
I made a first set of measurements in the silence, to get a reference value, then I turned on a sound source.
After getting high readings (700+), the values felt back to their previous range when I switched the sound off.
I however noticed something weird: during the high-volume phase, I regularly had zeroed values. Maybe I saturated the sensor?
Frederic - I’ve upgraded the GrovePi+ firmware, and now it’s giving slightly less erratic readings, although they’re not very predictable.
After restarting the Pi, room silence, which is mainly just sound of the the PC’s fans, gave a steady reading of about 60. Next, I made some arbitrary loud noises which gave readings of 600-800, after which it now returns to 60 rather than staying at the higher values as it did before. Then I played some more music and got readings of between 400-800, but then when I stopped the music and returned to room silence, it gave sustained readings of 0 in silence for a few minutes, then arbitrarily changed to give readings of between 3 and 7 in continuing silence.
Thanks for your help!
I believe that this component it not always very precise one, and the fluctuations between readings can probably be smoothed by sampling several times in a row and averaging the readings.
Seeedstudio also sells an alternate component, the Loudness sensor, which might also get better results depending on your needs.