School project: sound meter

Hello,

I'm a student in high school, and this year we have to make a programming project. We are using Arduino. We decided to make an intelligent sound meter. It's supposed to be used in class: it receive the sound, and when it's too high, a led switch on.

We have analyzed the sound recorded by our electret sound sensor with an oscilloscope, but our teacher made it for us and he didn't explain nothing. So we don't understand why analyzing this signal needs to use a diod, condensors and resistors.

We have done a program which switch on a led when the sound sensor record sound, but it's not as hard as the final program we will have at end. We're confused, we really don't know how to go on and the teachers are not helping...

I can use this "basic program", to do the same thing, but I need to know how to make "sound levels": when a sound level of 75 dB is exceeded (for exemple), the LED switches on.
It's the only thing I need to understand, I think I can go on alone.

Sorry for my bad english, I'm a french student, and french forum doesn't answer.

Thank you for helping!

Hi,
Tell us more about your sound sensor..

and he didn't explain nothing.

So if he didn't explain nothing he must have explained something. :confused:

This project comes up every year, and every year the results are the same. There is not a good correlation between pecieved loudness and the waveform or envelope of the waveform. Therefore the results are not very practical. I remember quite a few years ago one student wanted to make a sign for their canteen to light up when it got too loud and he couldn't find the right level to trigger the sign. This was because their is no "right" level.

why analyzing this signal needs to use a diod, condensors and resistors.

Those parts are used to convert the sound waveform to a voltage level that is roughly proportional to the intensity of the sound (not the perceived "loudness"), over some short period of time.

To measure dB, you need to take the logarithm of the voltage and multiply by some factor. The easiest way to determine that factor is to compare your results for a given sound with the indication of a commercial sound volume meter, but this will only be a rough approximation.

Either you have poor teachers or you haven't been paying attention in class.

As Mike says, this has been discussed before so you might want to search the forum.

...I've made a VU meter "lighting effect", but it doesn't read in dB and it's intentionally not calibrated because I want a good "meter effect" with quiet songs and loud songs, and with any volume control setting. (And my effect runs off the electrical audio signal so there's no microphone.)

So we don't understand why analyzing this signal needs to use a diod, condensors and resistors.

Assuming you have a "microphone board" for the Arduino, you don't need to understand the electronics. :wink: But, you do need a preamplifier to boost the few-millivolt microphone signal to about 1V for the Arduino.

THE MOST IMPORTANT THING - Do you have an SPL meter to calibrate the one you're building? It's theoretically possible to calculate the SPL level from the voltage if you have the sensitivity spec for the microphone, and if you know the gain of the amplifier, but in practice all SPL meters are calibrated with a known sound level, and like Mike says this is going to be difficult to get "accurate" results, even with calibration.

THE BASICS - Decibels are a relative measurement calculated as dB = 20 x log(A/Aref) where A is amplitude (such as voltage). For dB SPL (sound pressure level) 0dB is approximately the quietest sound you can hear. For digital audio files 0dBFS (zero decibels full scale) is the largest value you can hold with a 16 or 24-bit integer and the dB levels are usually negative. There are various 0dB references for electrical signals (voltage or power).

For example, if 75dB SPL gives you a reading of 500 on the Arduino ADC, a reading of 250 would be 20log(250/500) = -6dB. That means with a reading of 250 you have 69dB SPL.

THE COMPLICATIONS - Sound is "waves" (as you've seen on the oscilloscope). If you "take a reading" with the Arduino you are reading at some random-unknown point along the wave anywhere between the positive & negative peaks and your readings will "look random". ([u]Here[/u] is an easy introduction to how digital audio is sampled/digitized.)

So, you have a couple of choices. You can take an average or RMS (or a moving average), or you can find the peaks. Note that the true average is zero, since the waveform is positive half the time and negative half the time, but you can take an average of the absolute values or you can simply throw-away/ignore the negative values.

I'd say the easiest thing is to find the peaks over a short period (maybe 1/10th of a second) and then take an average (or a moving average) of those peaks.

Note that the Arduino's ADC can't read negative voltage so you'll never get a negative reading. Most Arduino microphone boards will bias the output at 2.5V so that silence reads 512. You can subtract-out the bias in software.

For calibration, pink noise will best represent real world sound/noise, but you might want to start with pure tones. [u]Audacity[/u] can generate tones, white noise, or pink noise files that you can play on your computer or phone, etc.

MORE COMPLICATIONS - The human ear is more sensitive to mid-frequencies than to low & high frequencies, and the ear doesn't respond instantly to "loudness". For this reason, real SPL meters are [u]weighted[/u]. Since that's somewhat difficult (and you probably won't attempt it) your readings won't exactly-match a the real meter's readings.

Thank you for all your answers

We've seen the decibels logarithm in physics. I got a sound level sensor and we had an idea: we could maybe record a sound with our micro-elektret sensor, while listening this same sound with a sound meter (in decibels), then find when the sound level get to 75 dB for the both devices.

I can't answer all your questions because I need to leave right now. I'll read and answer later, thank you very much for all your consideration.

I've read all your tips Doug, and thank you.

I actually got a SPL meter, and I've already made sound measures to find what was the "noise limit" acceptable in a classroom (around 75 dB). We're going to make the comparison experience in one week.

I've understood what dB are, thank you, physic lessons were useful! I found that to make these "levels" of sounds, we need to use the "casing" (dunno if it's the good word) of the wave signal we got, to make a signal which is close to a logical one (we can't use analogic signal to switch on the LED). And when we got this (using a condensor and a resistor), we need to increase electronically the microphone gain. Finally, we have to couple each sound level to a bit-rate level (0 to 1023), if I understood well.

Can anybody explain how I can use the condensors and resistors? How does it works?

we need to use the "casing"

The word is "envelope " not casing.
Not sure you have got the hang of what to do from that explanation. You need a capacitor and a resistor and a diode to make an envelope follower. Google it.

we have to couple each sound level to a bit-rate level (0 to 1023),

No.
The input sound will give a reading between 0 and 1023 you need to convert that reading into a dB level by doing some maths. As dBs are ratios you need a referance level of known intensity for one reading and the Unknown sound as the other.

Allright, I understood. So I really need to do this comparison experience. Thank you!