Pages: [1]   Go Down
 Author Topic: Microphone to read how loud a sound is  (Read 1236 times) 0 Members and 1 Guest are viewing this topic.
Offline
Newbie
Karma: 0
Posts: 4
 « on: May 05, 2012, 04:24:29 pm » Bigger Smaller Reset

Hi everyone,
I'm new to this forum.

I am doing a Year 9 (Grade 8 I think) school science fair project on how sound absorbent different materials are. I plan to have two boxes right next to eachother - one with a speaker in it and the other with a microphone to read how loud the sound is (Arduino powered). I then put the different test materials all around the boxes and do another reading to see how much less sound got through with each material.

I already have a speaker, but don't yet have a microphone. For simply reading how loud a sound is, ideally in decibels, what would I use? Here's my proposed code for when I have a microphone:

Quote
//Duncan de Wet 2012
//Freely distribute with this notice in place
//Purpose: Determine how absorbent different materials are. Put speaker in one box and microphone in the other,
//then pad boxes with test material and see how much sound gets through
//Not finalized!

const int spkr = 10;
const int mic = ???; //what port?
int y = 0;

void setup() {
Serial.begin(9600);
pinMode(spkr, OUTPUT);
}

void loop() {
Serial.println("Starting testing.");
Serial.println("Will now create noise for 15 seconds...");
analogWrite(spkr, 100);

while(y < 15) {
y = y + 1;
delay(1000);
x = analogRead(mic); //I'm guessing it's more complex than this, but can do that later.
Serial.println(x);
}

Serial.println("Noise turned off.");
Serial.println();
analogWrite(spkr, LOW);
Serial.println("Please unplug the Arduino, otherwise testing will be repeated in 10 seconds.");
delay(10000);
}

So would this microphone be able to be used to see how loud a sound is (fairly accurately), or what parts would I need? Just want to be sure before I order.

Thanks,
Duncan
 Logged

0
Offline
Karma: 16
Posts: 2857
ruggedcircuits.com
 « Reply #1 on: May 05, 2012, 04:49:48 pm » Bigger Smaller Reset

You have taken on a very complicated task

I would begin by thinking about the problem as a matter of energy, that is, how much energy is reaching your microphone. And yes, the electret microphone you have picked out will work but needs a high amount of amplification -- see the circuit in our Gadget Shield schematic, or buy a pre-made microphone module like this (NOTE: It only works up to 3.3V!) or this (works at 5V).

A good measure of energy is to take many fast readings of the microphone (back-to-back) then add up the square of each reading (watch out for overflow!) Do this for something like 100ms to 1s (the longer you sum, the bigger the number gets but the more things average out). That sum is a quantifiable measure of how much energy is reaching the microphone. To convert that to decibels would be very hard, because you have to know exactly the properties of your microphone, the microphone's amplifier, the acoustic properties of your box, etc.

--
The Rugged Audio Shield: Line In, Mic In, Headphone Out, microSD socket, potentiometer, play/record WAV files
 Logged

Offline
Newbie
Karma: 0
Posts: 4
 « Reply #2 on: May 05, 2012, 05:02:06 pm » Bigger Smaller Reset

Hmm, more complicated than I thought.

I guess it doesn't matter if it's not in decibels, as long as it can show the difference between the readings on a graph.

I'll get to the hard bits later, as long as someone can confirm that the part you just mentioned will definitely do the job and it can be done.

Can you please explain a little more about the square thing - I understand that you're getting heaps of readings and averaging out, but don't quite understand why you get the square of each reading.

Duncan
 Logged

Offline
Sr. Member
Karma: 0
Posts: 342
 « Reply #3 on: May 05, 2012, 05:11:36 pm » Bigger Smaller Reset

While that microphone capsule will work for a proof of concept is far from a decent one ( dont even  mean a high end one).
As previous post mentioned you can do a measurements by comparison ( start with a measurement you know is calibrated, like from a signal generator you know will give you a X signal) and then compare it from there.
But you need to keep in mind that for material absorption materials tests , you would need a specific microphone for acoustic measurements( i have one and i can tell you they are far from cheap) due to the fact that any commercial microphone tend to be directed at the Pro and leisure Audio market( from studio ones that are much better like condenser ones, to cheaper and dynamic ones that have a drop frequency usually below 200/300 Hz), hence the need for a true acoustic measurement mic.
Not even mentioning the fact that, as stated, to convert any reading with the arduino into any of the standard scaled measurements( rms, dbs etc) would be also a really hard task in itself !
Plus the pre amp circuitry will also influence a lot the readings ( will have to be a noiseless one and that can also be highly expensive).
So, i get back to my initial statements. As a proof of concept and project is doable on a string budget as long as you take into acount tthat they  wont be TRUE accurate readings at all, but more lax ones, and only by comparison with one done at the beginning from a reliable calibrated source.

Hope that gives you some insight of the things that await you and ways to approach the project.
 Logged

10 LET Loop=Infinite
20 GO TO 10

Offline
Sr. Member
Karma: 0
Posts: 342
 « Reply #4 on: May 05, 2012, 05:16:48 pm » Bigger Smaller Reset

That electret mic is quite limited for that job, if you want me to be honest.
Not only in HF but also in LF, so that is probably one of the least suitable ones you can find.
Maybe the cheapest, but definitely not suitable for sound propagation and room/material absorption measurements.
Behringer has some cheap ones ( Behringer-ECM8000-Measurement-Mic around 38 pounds/50 dollars) but you have the problem that any measurement mic is a condenser ones, therefore they need phantom power( which works+-48v).
So maybe a dynamic mic capsule, but you wont be doing reading on LF at all as they all lowcut around 100/300 Hz depending the quality
 Logged

10 LET Loop=Infinite
20 GO TO 10

Offline
Newbie
Karma: 0
Posts: 4
 « Reply #5 on: May 05, 2012, 05:25:17 pm » Bigger Smaller Reset

I get your reasoning, but it seems a pity I can't do a simple enough task...

So if the Arduino can't do it viably I can use the Arduino just to make the sound, and measure the sound in the other box with a non-Arduino thing.

Eg:

http://www.amazon.com/HDE%C2%AE-Digital-Sound-Level-Meter/dp/B005511F9Y
http://www.amazon.com/Mini-Digital-Sound-Level-Meter/dp/tags-on-product/B001THX3M0
 « Last Edit: May 05, 2012, 05:30:05 pm by duncan12 » Logged

Offline
Sr. Member
Karma: 0
Posts: 342
 « Reply #6 on: May 05, 2012, 05:37:02 pm » Bigger Smaller Reset

I didnt say it cant be done. I just said that theres a lot of factors to take into account.
You can do a "proof of concept" on a lower level kind of thing, but will only be as accurate as the hardware you might use( or not). Makes sense ?!?
Use a cheap dynamic capsule( that doesnt need powering) or even the one you said. But as i said keep in mind will just be a method of doing it, not the real thing. That is what projects for "school" tend to be, no ?
And of course state and dig a bit deeper when doing the report of the project as well, for the sake of info
 Logged

10 LET Loop=Infinite
20 GO TO 10

Offline
Newbie
Karma: 0
Posts: 4
 « Reply #7 on: May 05, 2012, 07:07:41 pm » Bigger Smaller Reset

I do want it to be as accurate as possible, and I'm getting the idea you can't get an accurate sensor cheaply. So I think instead I'll see if I can borrow a decent  sensor from school.
 Logged

Offline
Edison Member
Karma: 5
Posts: 1730
 « Reply #8 on: May 05, 2012, 08:16:33 pm » Bigger Smaller Reset

For crude measurement just use another speaker, I've done it before and I have no problem getting reading below 100hz
mind you I used a msgeq7 chip to separate the frequencies and I didn't even have any amplification, just one speaker wire to ground the other to the msgeq7 input
 Logged

Offline
Sr. Member
Karma: 0
Posts: 342
 « Reply #9 on: May 05, 2012, 10:34:25 pm » Bigger Smaller Reset

Most normal speakers wont even play the sound accurately, never mind capture it.Some basic decent monitors will cost over 300 pounds, a basic VOCAL mic around 200 (talking about acceptable ones) and even the measurement one i mentioned is just a really cheap one.!
So you might have got some readings, not some accurate ones at that
 Logged

10 LET Loop=Infinite
20 GO TO 10

Offline
Edison Member
Karma: 5
Posts: 1730
 « Reply #10 on: May 06, 2012, 08:13:37 am » Bigger Smaller Reset

I got enough for the msgeq7 to separate the audio channels and for all appearances it works well with the leds pulsing with mapped brightness according to the music,
just and idea but if you use a msgeq7 as well you could compare the overall volume as well as the volume across 7 different frequencies and you can compare those as well and see what blocks higher or lower frequencies not just overal volume
 Logged

Offline
Sr. Member
Karma: 0
Posts: 342
 « Reply #11 on: May 06, 2012, 08:50:51 am » Bigger Smaller Reset

This is the freq response graph of one of the most sold and famous DYNAMIC microphones for live performances and kinda general FIT-FOR-ALL mics in the market( not really cheap, to be honest, though affordable). As u can see start dropping considerably below 200Hz+-. Above 2Khz will start to raise and fluctuate quite badly. If we take into consideration that the most important frequencies in measurements are the really low and really high ones ( actually they are the ones that are aimed at when doing acoustic treatment in studios, halls and  the ones more taken into account when designing any kind of public spaces even), as they are the ones more difficult to control and the ones that most tend to have deep effects in recordings and human perception as well ( plus the ones we dont hear at all, but that add to the conflict), i think it speaks for itself.
Mind the fact the OP repeated several times ACCURATE MEASUREMENTS.
Just shared my knowledge of the subject... Might not be the "brightest spark" in programming, but music production and studio acoustics have been an integral and quite important part of my life for a long time, due to the fact im a producer/composer dubhead.
http://www.shure.com/idc/groups/public/documents/webcontent/rc_img_sm58_large.gif
 « Last Edit: May 06, 2012, 10:10:23 am by iyahdub » Logged

10 LET Loop=Infinite
20 GO TO 10

Atlanta, USA
Offline
Edison Member
Karma: 53
Posts: 1777
AKA: Ray Burne
 « Reply #12 on: May 06, 2012, 09:27:58 am » Bigger Smaller Reset

I would suggest that you keep all results relative, not absolute.  For example, if we were measuring temperature, we would use a reference thermometer and take n readings and then calibrate the probe.  So, how would we do this without the thermometer?  Essentially, we would simply show the plot of the probe (I like Excel) and then use the (Excel) plotting function to try and plot the curve... linear? exponential? logarithmic?

So, if the experiment was changed from "loud"-ness to acoustic-damping you could simply compare, for a series of frequencies, the reflected energy from various (commonly used damping) materials.  Should make a nice experiment and generate volumes of numeric results.  You just need to establish a baseline (at a specific air temperature) for the "perfect reflector / non-damper" which would be the sender pointed to the receiver at 2x the distance used for measurements.  This would then be the normal 1.0 that everything else was reference to at that particular temperature... all tests should be done at a constant temperature.

- Ray
 Logged

 Pages: [1]   Go Up