Sound Pressure Level meter - Page 1
Forum section: electronics / projects

author: Radiohead
author_rank: Contributor
timestamp: June 12, 2017, 07:47:15 pm
content: Hello Folks,For my work I'm building an battery powered enviroment sensor which measures temperature, relative humidity, barometric preassure, light intensity, CO2, etc. For these measurements all kinds of device and modules excist, but one of the requirements is to measure the sound pressure level. For this measurement I haven't found any excisting off-the-shelf solution, so I came up with the idea of using electret/mems microphone, amplify it, add some DC offset and measure the amplitude with a microcontroller's ADC.In order to find the limitations of this solution I calculated the sound pressure from decibels to Pascals in order to calculate the output amplitude of an electret or MEMS microphone with the given sound pressure. I've studied some appnotes from InvenSense products (previously Analog Devices parts) to convert the output amplitude of a MEMS microphone with a Sensitivity of -35dB to 17.8mV_rms/Pa. For the example shown below, I've set the amplification of the Electret/MEMS micophone output amplitude to a gain of 100. For the ADC I've taken a 12 bit ADC with a reference voltage of 1,25. The voltage reference value isn't so important, as I can change the value, add additional gain or add a divider if needed. With the voltage reference and amplified output voltage known I can calculate the ADC amplitude for each given sound pressure.As can be seen on the added picture, the 40 - 90 dB range falls into the range of the ADC and should be measureable. For 0 -40 dB the output amplitude is too small, and for 90 - 130 dB the output amplitude will clip on the ADC's input. I could change the gain, voltage reference value or sensitivity, but since the sound pressure is non linear, changing any value won't change much. I could increase the dB range by making the gain variable, but I feel that isn't the best solution. The dB range of this analog method is quite limited and probably not the most accurate, but I don't need to design an accurate reference meter eventhough I would like to design something that has a larger range and is moderatly accurate.I've been playing with the idea of using a MEMS microphone with I2S output instead of analog output, so I won't need the amplification and ADC circuit. The problem with this approach is that the microcontroller I'm currently using has no I2S peripheral. I'll need to use an additional microcontroller which has the I2S peripheral in order to use this approach and I haven't used an microcontroller which such interfaces just yet.To wrap things up, I'd like to know If there are better approaches to make a relative easy method to measure the sound pressure level without using raspberry pi's or with the complicated methodes I've found so far.

author: The Soulman
author_rank: Super Contributor
timestamp: June 12, 2017, 09:36:16 pm
content: Your chart shows exactly why most affordable SPL meters use a manual range switch.This could also be made auto-ranging by controlling the gain of the pre-amplifier with the micro controller, but only if you're only interested in longer term (average) data, transients could be missed.Best is to use a higher resolution adc, 16bit and 24bit are common in audio.Oversampling your 12bit adc is another option.How much accuracy is needed and over what band-with and dynamic range?Ps, I've looked at the specs of these mems microphones, they have a signal to noise ratio of 60 to 65 dBanything more than a 12 bit adc isn't going to improve things..All you want to know about adc resolution and a lot more can be read here:http://qtwork.tudelft.nl/~schouten/linkload/adc-tutorial.pdf

author: thm_w
author_rank: Super Contributor
timestamp: June 12, 2017, 10:38:18 pm
content: Here is a company with a relevant product (uses mems), but can't tell how it was implemented:https://convergenceinstruments.com/product/sound-level-meter-data-logger-for-long-term-outdoors-applications-noise-sentry-rt/https://convergenceinstruments.com/operation-mems-microphone-sound-level-meter-dusty-environments/There are also the $10 SPL meters from ebay, but they might just be an ASIC.Depending on the data rate and speed of your micro, bit banging I2S could be a possibility.But do these MEMs mics allow A-weighting the signal? That is something you would have to do.I did design a similar product to what you are talking about, but left out the SPL/microphone part. So, be sure to post whatever solution you come up with.https://hackaday.io/project/21912-portable-air-quality-monitorRelevant:https://en.wikipedia.org/wiki/Noise_dosimeterhttp://www.google.com/patents/US4554639

author: CatalinaWOW
author_rank: Super Contributor
timestamp: June 13, 2017, 12:36:15 am
content: A log amp before the A-D will let you make measurements over the entire range, but will require significant effort to get a calibrated, temperature stable response.

author: DaJMasta
author_rank: Super Contributor
timestamp: June 13, 2017, 02:07:41 am
content: Whatever design you end up with, it's work checking against a well calibrated sound meter. Physical attributes of the chassis and fluctuations in the individual mics will affect the mic's response pretty significantly, and a spec sheet is not likely to be really well characterized over the mic's range (and certainly not per mic module). If you can measure a finished version of yours, you can probably get a good idea what sort of adjustments need to be made to the lot of them, but because even small variations in component position and mounting relative to the hole letting sound into the product can make a difference, if you want it to be repeatable across units you're probably going to need individual calibration.Then there is definitely some difficulty in getting temperature stability and whatnot... but if you want to go deep into the compensation curves, you could actually make good use of your temperature sensor and barometric sensor in the unit already to compensate and calibrate more accurately, then you just have to minimize the tempcos and aging of the parts on your analog frontend.Something like an envelope detector into an ADC against a calibration curve of some sort is probably the simplest, but then you'd want to be doing any A weighting or whatnot with a filter that's based on normalizing the mic's frequency response to the A weighting curve... which could be an interesting design hurdle. If you have processing power to spare, a regular audio codec adc means handling a lot of data, but then you get fairly low noise, high resolution ADCs, and full customizability for software calibration of each individual mic as well as any sort of weighting curve you want. It wouldn't take a ton of processing to do a small FFT (128-256 points?) on a 44kHz or similar single channel input, average a few of them together, then adjust the bin power levels in software for the weighting curve and mic characteristics and whatever else. Probably way overkill, but it would be a very comprehensive, very configurable SPL meter with the capacity to be more than that.

author: Radiohead
author_rank: Contributor
timestamp: June 13, 2017, 06:28:40 pm
content: QuoteAccuracy is not important, so +/-5dB would still be accaptable, I'd rather have a larger range such as 40 to 120dB. I had already determined that increasing the ADC resolution was rather pointless with MEMS microphones, it's the logarithmic scale that's limiting the range.QuoteNice project! I doubt bit banging I2S will work, the A-weighting and RMS amplitude calculation would still need to be done in software. I'm using a simple 16bit 32MHz PIC, so I would be better off with an additional dedicated microcontroller with an I2S interface. I've looked on ebay and allibaba if there might be an SPL module that could do the trick, but I guess there's little demand for such a module.QuoteMy colleague thinks this is the best option, but I have my doubts about the influence of temperature and microphone tolerances, just like you suggest. Most Log opamps I've seen so far are all designed for fiber optics and quite expensive (to my opinion) in low quantity. I'll need to dig a little deeper to determine if this will work properly.QuoteHaving a good reference meter to compare with is allways a good idea, but there is also a device (forgot the name) used to calibrate sound pressure level meters with, which would be invaluable to have.QuoteThe product will be mounted on a pole/high place so I think this will outweight the placement of the components, eventhough the placement of the mic and possible calibration will be important.QuoteWith envelope you mean something like this Sparkfun module, which has a precision rectifier:https://www.sparkfun.com/products/12642?QuoteIf I had the processing power, needed high accuracy and had enough time, I would go for this approach.Thanks for all your suggestions and responses, I'm gonna take some time to check the suggested options.

author: DaJMasta
author_rank: Super Contributor
timestamp: June 13, 2017, 07:19:37 pm
content: QuoteExactly, there are potential issues with sound content that covers several octaves, but if you have some sort of filtering stage (like an equalizer of sorts), to either flatten out the frequency response or to fit it to a weighting curve, before the peak detector stage in that schematic, you should be able to get pretty good results. The difficulty comes from not being able to weight at that ending stage like with a DSP, so if you just had a preamp into the envelope detector, if you had an incoming sound with spectral components in areas where the mic's frequency response wasn't on the weighting curve you wanted, then they'd skew your reading even if the primary tones were in the right range.

author: floobydust
author_rank: Super Contributor
timestamp: June 13, 2017, 07:28:00 pm
content: Don't need to sample the ADC at the actual audio rate, it's a waste of resources.You need a rectifier, peak detector and since you are measuring a log quantity, you could make one of those stages a log amp.There will also be error according to directivity- no mic works well in all directions (sphere), side lobes are always present.I factory tested telephone handsets (electret condenser mics) down to +/-0.1dB with some very nice Brüel & Kjær equipment. The mics were surprisingly within a few dB of each other, just the JFET had variation. Easy to calibrate using a reference mic or SPL meter at 1m distance.CUI electret mics

author: Grubi
author_rank: Contributor
timestamp: June 15, 2018, 08:31:13 am
content: Hi @Radiohead,have you implement this SPL meter using MEMS microphone?How was the results, can you share some details?I am also involved in such environmental project, but for now I am using simpleanalog SPL meter or currently testing some I2C/RS485 modules from China,but tohse always use old, good capacitor microphones.

author: tve
author_rank: Newbie
timestamp: July 05, 2018, 06:46:28 pm
content: I'm also interested in this and I'm wondering why not use a MEMS microphone with digital output to avoid all the ADC issues? For example, the Knowles SPW0690LM4H-1 has attractive specs, costs <$2 in qty 1 at Digikey, and has digital PDM output.