Hey Everyone, we're back looking at some more options for getting audio data into the ESP32.
In the previous video, we looked at a couple of microphone boards (the MAX4466 and the MAX9814)
Both these boards use Electret Condensor Microphones which are essentially a parallel plate capacitor
with the distance between the capacitor plates varying depending on the sounds waves hitting the diaphragm.
Both the MAX4466 and the MAX9814 integrate both the microphone and the audio amplifier.
They output an analogue signal which then needs to be fed into the ESP32's analogue to digital converter.
In this video, we're going to be looking at a couple of boards with MEMS microphones.
These microphones are constructed using a Micro-Electro-Mechanical System component.
The two boards I'm looking at are the SPH0645 and the INMP441.
What's interesting with these boards is that they integrate the audio amplifier, ADC and
the I2S interface.
So the output from the boards can be fed directly into the ESP32 without using the ADC.
The actual microphones on these boards are packaged up into a small surface mounted device
which will either have a hole in the top or the bottom for the sound to enter.
Both the boards I am looking at are bottom ported so there is a hole in the PCB to let
the sound enter.
The principle is similar to the Electret microphone with a capacitor that changes value due to
air pressure.
You may recall from the previous video that we had some problems with noise on the 3v3
power line from the ESP32 dev board.
I solved that using an RC filter followed by a Low Dropout Voltage regulator.
For this follow-up video, I've gone even further.
I have an LC filter followed by a capacitor multiplier.
This is followed by our LDO regulator, which then has another LC filter on its output.
I may have gone too far...
I've had this circuit made up into a PCB and had it fabricated by JLPCB.
The board includes headers for plugging in the MAX9814 and the two I2S boards I'm testing
in this video.
I've wired up the board so that the SPH0645 is on the left channel and the INMP441 is
on the right channel.
Ideally, I want to be able to record from all three microphone boards simultaneously
to compare the outputs.
Let's have a look at how the I2S interface is wired up.
There are at least three required lines:
We have a serial clock - this is used to clock data to or from the peripheral.
We have a word select (also called the left-right clock or LRCLK) - this selects the channel
that you want to send or receive data for.
And finally, we have the data line.
When the Word Select is low the right device will tri-state its output
and the left channel will send data.
when the word select is high the left device will tri-state its output
and the right device will send data.
I've plugged in the SPH0645 in and left the INMP441 unpopulated.
The I2S peripheral is set up to record audio from both left and right channels.
When we look at what has been recorded from this configuration
we can see there is a small problem.
All our data should be coming out in the left channel,
but we have some data also coming out on the right channel.
This matches with some of the comments I've seen in the forums about the SPH0645 and the ESP32.
The output from the board doesn't seem to match up with the I2S standards.
After a lot of googling, I came across some forum posts with a potential solution.
These settings should fix the timing issues.
After some testing, I don't think they interfere with the INMP441 so we can capture some audio.
As I said earlier, my initial plan was to capture from all three boards are once,
but I've noticed quite a lot of interference from the I2S signals with the MAX9814 output.
So I've captured the ADC signal separately from the two I2S signals.
Here's the audio captured via the built-in ADC.
I've set the gain on the MAX9814 to its minimum value and that does seem to have improved
the amount of noise coming through.
Here's the audio captured directly from the INMP441
And finally, the audio captured from the SPH0645
Another question I wanted to answer is how good these I2S boards are
at dealing with the noisy power supply.
Do we need my power supply filter?
Here's the audio with the INMP441 connected directly to the dev board without any filtering.
There's no sign of the noise that we saw with the two analogue boards.
in the previous video.
So, what have we learnt?
I think the INMP441 board wins this competition hands down.
It seems to be standards compliant
It produces a good signal with no DC offset
And it seems to handle the noisy power supply without any problems
It's much less noisy than the MAX9814
The only downside I can find at the moment is the lack of a built-in AGC
you will need to do something in software if you want that kind of functionality.
So, that's it for this video - please hit the subscribe button if you found it useful
and check out the previous video where we looked at the other two microphone boards.
The code I used is all in the GitHub repo linked in the description.
In the next video, we'll look at getting audio out of the ESP32,
another small step to finishing my next project.
Thanks for watching!
I'll see you in the next video!