esp32-i2s-slm
esp32-i2s-slm copied to clipboard
Varying microphone self noise (INMP441) after restarts
Hi, thanks for the great project!
This is probably not your issue, but I just would like to share my experience with this mic for measuring environment noise.
While doing some experiments I noticed a few issues:
- Even in quite room, the lowest sound level I could get was only 36 dBA, although according to specs it should be 33 dBA
- But really confusing was that self noise could change +-5 dBFS after each restart. Though if applying A-weighting it is less noticeable, but anyway.
My setup is quite simple:
![](https://user-images.githubusercontent.com/4602302/215182911-8e2d63e7-6075-4b90-b274-2de53b52b956.png)
I tried quite a lot of things trying to investigate and/or fix it:
- Powering ESP32 from usb or battery
- Turning WiFi on/off or lowering its power
- Trying IDF 4.4.3 or IDF 5.0/5.1, micropython
- Trying different ESP32 boards (including S3)
- Trying different INMP441 instances (I have only 2). They actually vary a bit and with one mic I could get lower dBA overall than with other. However they both have the same issue of changing self-noise frequencies/level after restarts.
- Trying different wires/pins.
- Trying different sample rates/bits per sample. Actually some combinations work better than others.
Unfortunately I don't have other mics to compare. ICS 43434 should work better, but it is quite hard to get it here.
Also I found a few ways to reproduce the issue:
- By completely powering on/off
- By pressing Reset button
- By removing mic from the breadboard and reinserting it again
- By calling i2s_driver_uninstall and then i2s_driver_install again
- By calling i2s_stop/i2s_start
To investigate it further I made a sketch that does i2s_driver_install/i2s_driver_uninstall every minute and randomly changes sample rate/bits per sample every 5 minutes, and run it for a few hours.
Although it was quite quiet environment (night time), you can see from the chart below, that changing sample rate/bits per channel affects self-noise quite a bit, which might be understandable, but what's more frustrating is that if sample rate and bits per sample doesn't change, noise levels could change after just driver re-installation.
Running it for 10 hours and faceting the chart by sample rate/bits per channel and removing gaps inside one chart we can get this:
From it we can see, that some sample rates/bits per sample doing better than others:
- 10000 samples expectable performs quite bad
- 24/32 bits with 44100/48000 sample rate also has quite bad variability.
- 16 bit with 44100/48000 seems to be quite stable.
- 32 bit with 22050 rate also seems to be OK (surprisingly)
Here is how different noise waves looks like. Those are just two samples with same rate/bits (32 bit@48K), but one is before restart, another - after:
Here are a few self-noise spectrums (1024 point FFT):
Looks like it is quite similar at high frequencies, but it could vary quite a lot at lower/mid.
TBH, I'm not sure what is the best way to deal with this issue (except buying a better mic). Actually, I don't know for sure if this is a hardware or software issue. And if it is fixable or not. Probably would go for now with 16 bit@48KHz for better stability, albeit loosing some precision. Would be thankful for any advice/explanation why this happens, as I'm quite new to electronics/audio domain.
Update:
However seems like there is another weird issue when using bit depth < 32, see https://github.com/atomic14/esp32-tft-audio-monitor/issues/2