esp32-i2s-slm icon indicating copy to clipboard operation
esp32-i2s-slm copied to clipboard

Varying microphone self noise (INMP441) after restarts

Open stas-sl opened this issue 1 year ago • 5 comments

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:

  1. Even in quite room, the lowest sound level I could get was only 36 dBA, although according to specs it should be 33 dBA
  2. 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:

I tried quite a lot of things trying to investigate and/or fix it:

  1. Powering ESP32 from usb or battery
  2. Turning WiFi on/off or lowering its power
  3. Trying IDF 4.4.3 or IDF 5.0/5.1, micropython
  4. Trying different ESP32 boards (including S3)
  5. 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.
  6. Trying different wires/pins.
  7. 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:

  1. By completely powering on/off
  2. By pressing Reset button
  3. By removing mic from the breadboard and reinserting it again
  4. By calling i2s_driver_uninstall and then i2s_driver_install again
  5. 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.

image

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:

image

From it we can see, that some sample rates/bits per sample doing better than others:

  1. 10000 samples expectable performs quite bad
  2. 24/32 bits with 44100/48000 sample rate also has quite bad variability.
  3. 16 bit with 44100/48000 seems to be quite stable.
  4. 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: image

Here are a few self-noise spectrums (1024 point FFT): image

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

stas-sl avatar Jan 27 '23 19:01 stas-sl