I’ve recently bought two I2S MEMS SPH0645 microphone breakouts and hooked them up to a Raspberry Pi to build a bat detector, but I’ve hit a problem.
I followed the (very good) notes on the Adafruit website and got the Pi set up and recording without a problem. However, for data rates above 96 kHz the noise level takes a huge leap. You can hear it in the recording but can also measure the standard deviation and see the jump. You can hear a loud hiss, but you can also hear real sounds in the background.
I’ve tried arecord with all the following devices: dmic_sv, plug:dmic_sv and plughw:1. For dmic_sv, the actual rate used is not always the one requested (e.g. requested = 120 kHz, but 96 kHz is used) and arecord recommends using plug:dmic_sv instead. dmic_sv actually records at 48, 64, 88.2, 96, 176.4 and 192 kHz. A plot of noise level vs sample rate for dmic_sv is here:
for plug:dmic_sv the jump occurs at 140 kHz:
and for plughw:1 it’s at the same frequency, just much lower (unamplified) amplitudes:
I’m not experiencing any overruns so I don’t think it’s a buffer issue.
I’ve tried this on a Pi Zero W and a 3 with the same result. I’ve also tried mono recordings, same problem. My setup is identical to that described in the tutorial.
Quite disappointing as the chip is advertised to work up to 192 kHz which is needed for ultrasonic bat calls.
I guess I could try the arduino setup and see if it helps understand if this is a microphone or Raspberry Pi issue.
Can anyone suggest a way to debug this? Has anyone else had this problem?
(cross-posted to the Adafruit forum)
Even though the microphone on the board might work up to 192kHz. This product is only advertised as working from “about 50Hz-15Khz”. A quick Google tells me that bat calls are 20-80kHz which would be entirely out of range of this microphone.
It seems pretty amazing that you are able to get reliable samples that high. It seems that you are surpassing the range of the microphone, and I’m surprised that you can still pick up background noises at those frequencies.
Good luck with your project! I think you need a higher frequency microphone!
Thanks for your reply.
Hmm, I was sure I’d read somewhere that it would go up to 192 kHz sample rates. I must have been reading about something else!
I know that others who have tried using similar microphones out of the specified frequency range have had some success detecting bats, but the signal-to-noise suffers a bit. So I thought I’d give it a go anyway. Recording with multiple microphones might help because the microphone noise should be uncorrelated between them. Tasmanian bats have calls that go up to nearly 60 kHz so it looks like I should be able to get some data to play with. I have an ultrasonic distance sensor to use as a test signal. It would have been nice to push it all the way up to a rate of 192 kHz though.
The nice thing about these Adafruit units is they’re digital (no ADC needed) and I don’t have to worry about playing with surface-mounted components. Pretty much every other MEMS microphone I’ve seen has that type of mount and I’m not really sure how to go about building circuits of that kind!
I’m still curious to understand what the Pi is doing with the clock frequencies.