Mems Microphone Array and ESP32, with or without codec IC?

Thread Starter

DJ_AA

Joined Aug 6, 2021
308
Hi

I am planning to construct a mems microphone array with 4 to 5 microphones, such as SPH0690LM4H-1 Datasheet Rev A.docx (mouser.co.uk)

These are PDM interfaced. If I have understood it correctly, these just require a CLK pulse, and I am reading digital databack.

I have been advice by ESP32 to use a CODEC IC such as ES7210 pdf, ES7210 Description, ES7210 Datasheet, ES7210 view ::: ALLDATASHEET :::

They mentioned ESp32 would add signal-to-noise ratio of around 58dB to the signal without it.

I am not sure why this would happen as MEMS are digital mics.

Had anyone got experience in using ESP32 and MEMS microphones?
 

Irving

Joined Jan 30, 2016
3,991
I'd go for the I2C mems mics rather than PDM. If I understand them correctly the PDM (pulse density modulation) is just a bit stream where more dense bits represent louder sounds but you still have to encode the data, whereas the i2c version are already encoded in some way (but don't quote me on this - go check).
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
308
Thanks, I will read up on the link.

Is encoding PDM data require high resource, and the reason for using a codec ic?

Have you used ESP32s?
 

Ian0

Joined Aug 7, 2020
10,045
I'd go for the I2C mems mics rather than PDM. If I understand them correctly the PDM (pulse density modulation) is just a bit stream where more dense bits represent louder sounds but you still have to encode the data, whereas the i2c version are already encoded in some way (but don't quote me on this - go check).
Do you mean I2S? The usual digital microphone is pulse density modulation (as you said) and takes quite some effort to convert into PCM data.
There are I2S microphones available, and you can easily connect two to each I2S input
[Edit] I don't think ESP32 has I2S - if it does it will be tacked on to the SPI.
You can read one I2S microphone using the SPI port by faking the WS line with the MOSI output.
 

Ian0

Joined Aug 7, 2020
10,045
Well i have restricted to using Knowles PDM,but how can a uC such as ESP32 effect the SNR?
it depends on how it reads the data. It has to integrate the PDM signal to produce a PCM signal.
Analog Devices make some codecs which can deal with PDM inputs.
Knowles makes some I2S microphones (which doesn't help you if you are stuck with the ESP32)
Audio Precision has an explanation of PDM
https://www.ap.com/technical-librar...t=PDM to PCM,is called the oversampling ratio.
You will have to execute the integration routine 3.2 million times a second, which takes some considerable processing power. A codec can do it in hardware.
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
308
Thanks. It seems that I2S would be a better option avoiding the codec IC and processing.

Just out of curiosity, why would you need to run a routine 3.2 million times a second when using PDM?

I guess with I2S the the audio is already ready to be listened to or processed.
 

Ian0

Joined Aug 7, 2020
10,045
Just out of curiosity, why would you need to run a routine 3.2 million times a second when using PDM?
It is effectively a 1-bit output with a 3.072MHz sampling frequency, and to turn into PCM at 48kHz you need to apply what it known as decimation, effectively a low-pass filter with a cutoff sufficiently below 24kHz to avoid aliasing followed by a reduction in sampling.
The IIR or FIR filter has to be clocked at 3.072MHz. To do it in software, the filter routine has to run 3072000 times a second, and that takes a lot of processor power. In CODECs which deal with PDM inputs, it is probably implemented in hardware.
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
308
Ok, it makes sense now.

I guess the software filtering would also contribute to noise and effect the SNR?

So I guess to keep it simple I2S , will be used.
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
308
Yes, I just need to understand how decode the bytes on other end so I know which mics it's from, as well as how often you sample the data.

Is it can handle 8 mic. Is there any data on array placement to get sound from all directions? If I am correct the mics would need to be placed in certain configuration.
 

Ian0

Joined Aug 7, 2020
10,045
Yes, I just need to understand how decode the bytes on other end so I know which mics it's from, as well as how often you sample the data.

Is it can handle 8 mic. Is there any data on array placement to get sound from all directions? If I am correct the mics would need to be placed in certain configuration.
I can't speak for the ESP32 from first-hand experience, but if its I2S interface is like others, it does everything for you and you just get the data in a set of registers, one register for each input. I've not read the ADAU7118 datasheet, but you will have to find out which end generates the clocks, whether it is the ESP32 or the ADAU7118.

Do you have omnidirectional microphones (like most MEMS)? If so, you will get sound from all directions using just one microphone. You might be able to get unidirectional microphones, in which case you can determine the direction using two microphones at right angles ("Blumlein pair")
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
308
I think esp32 generates the CLK.
Usually each i2c can handle 2 mics , but with this IC the esp32 would need to be setup to know it will be get 8 times the data in that same channel.

The reason for multi mic is to determine in sound is coming from a moving person or object.
 

Ian0

Joined Aug 7, 2020
10,045
I2S (not I2C) can handle more than two channels. Some implementations may be limited to two. You need MCLK/WCLK to equal the number of bits x number of channels.

This is how to determine the direction of the sound back in 1931!

If you correlate the signals from two microphones you can measure the difference in arrival time, and thus determine the direction by a bit of trigonometry.
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
308
Sorry I mean I2S.

Yes usually 2 channels, bit guess I would need to configure the ESP32 so that it get 8 times the data via one channel.
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
308
Are there any application notes that show the effects of different placements of mems microphones on a PCB?

I would presume its best to keep microphones far as possible on the PCB e.g. for 4 mics , place a mic on each corner of the PCB.
 
Top