Measuring equipment such as SPL (Sound Pressure Level) decibel meters may seem daunting, but this article by [Shawon M. Shahryiar] shows that making your own need only have two essential ingredients: a microphone and a microcontroller. Obviously the microphone is for measuring the sound pressure level, and its output is then fed into the ADC of the microcontroller which does some math before sending the result to a display.
[Shawon] runs through all of the theory behind the calculations that have to be performed, before showing the C code that runs on the PIC18F242 8-bit MCU targeted by the prototype setup. The display is a graphical LCD type, capable of displaying the text with values as well as bar graphs indicating the measured levels. For the measurements themselves, the RMS value is taken of 16 ADC samples while the algorithm takes into account the specifications of the Seeed-sourced microphone module, specifically its average 50 dB sensitivity rating.
Although a full schematic is not provided, the essentials are all there for anyone to build their own SPL dB meter using virtually any microphone and MCU with built-in ADC. As the article also notes, opting for a higher quality microphone will yield better result and of course a faster MCU will offer more options, including FFT processing. Since the code itself is fairly basic, it should be easy enough to port it to an ARM-based MCU, which would allow one to use for example a TFT LCD.
Take a peek after the break for a video of the article’s SPL dB meter in action.
12 thoughts on “Make Your Own SPL DB Meter With A Microphone And MCU”
Say, that’s a pretty neat trick, referencing the positive op-amp input to the negative rail like that.
Because who needs the negative half of the signal, right?
When all you’re looking to do is measure intensity it should be good enough to approximate with half the waveform.
For forgiving-enough definitions of “approximate”, that may be true…
It’s a little mystifying that the vendor would choose that horribly non-linear, low dynamic range design for that sensor. They are generally known for better engineering than that.
Unless they are intentionally catering for the market that just wants an indication of “sound intensity”, and doesn’t care (or know) to do the high sample rate and minimal signal processing to make an accurate measurement amplitude. Nor must the expected user care much about the signal being highly non-linear, low dynamic range and very temperature-dependent…
Why do you say that design non-linear? In its active range it should be OK
Why do you say that design non-linear?
Just look at it. If it were an ideal opamp, the circuit would amplify only positive inputs. Pretty much a definition of non-linear. The only thing keeping the thing functioning at all is the (highly temperature dependent) op-amp bias current holding up the positive input by a few millivolts because of those large (and noisy) resistors pulling the positive input to the rail.
At very low amplitudes, it’s going to be sort of linear, but the output drive will be near zero unless the bias is high enough to drive the output above a volt or so to get it into the normal linear range of the opamp. Above moderate input sound levels though, the negative side will be grossly clipped. Ergo, nonlinear. And noisy. It’s not a design any competent engineer would willingly do.
The linked article seems to work on the assumption that because microphones ‘typically’ are standardized to 94dB SPL at 1kHz, you can use that as a touchstone. While not completely wrong, this is severly hampered by nonlinearity in the microphone, monlinearity in the amplifier, sound not being 1kHz sine, etc. – The project is not measuring SPL, but displaying signalstrength while being generally aware of logarithms. That, it does well.
This is a neat project, but I’m always hyper aware of devices that call themselves sound level meters. Sound level meters (SLM) have to go through a rigorous process and calibration to determine if they are going to work properly. It’s the same sort of thing that a voltmeter has to go through in order to be considered good.
I can tell you that a phone makes a terrible SLM both because it’s not able to be reasonably calibrated, you have no idea the orientation of the microphone, the person who wrote the software may have taken no end of shortcuts, and the clipping point of the microphone in those systems is really low (94 dB isn’t a very high SPL).
Again, neat project though!
A similar article/project for Arduino: https://blog.yavilevich.com/2016/08/arduino-sound-level-meter-and-spectrum-analyzer/
How do you squeeze the whole Marvel Cinematic Universe in there?
Hi would you be able to provide the schematics please for the microphone and amplification stage
Seriously, dude, did you even read it? Just click on the obvious link in the second paragraph.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)