I've made a wireless microphone.
So let's make a wired one.
As one of the wiser viewers has pointed out: "Not everything needs to be wireless".
There will be a small test at the end of this video to see if you've been paying attention,
so stick around to the end.
There are three microphones in my collection of components that I'd like to try out.
I've got two analogue microphones, an Electret microphone and a dynamic microphone.
And I've got an ICS-43434.
This is a digital I2S MEMS microphone.
If you haven't got one of these then the INMP441 is equally suitable and very affordable.
How do these three microphones work?
An electret microphone is essentially a parallel plate capacitor with the distance between
the capacitor plates varying depending on the sound wave hitting the diaphragm.
They have a built-in Field Effect Transistor that amplifies the signal.
In order to work the Electret microphone needs to have a bias voltage of 1 to 2 volts and
this is typically supplied by the microphone pre-amp.
A MEMS microphone is a Micro-Electro-Mechanical System.
It has a pressure-sensitive diaphragm etched into a silicon wafer.
The principle of operation is actually quite similar to Electret microphones where the
capacitance varies based on the sound waves hitting the diaphragm.
One of the nice things and MEMS microphones is that all the electronics are integrated
into the package so you end up with a nice digital interface.
They are also very compact so you'll find them in a lot of portable electronics.
Dynamic microphones are much simpler in operation, they just consist of a coil of wire moving
in a strong magnetic field.
The movement of the coil is caused by sound waves hitting a membrane and this movement
causes a voltage to be induced in the coil due to the magnetic field.
This very small voltage needs to be amplified by a microphone preamplifier to make it audible.
How are we going to do the USB interface?
You'll find out after this quick word about the channel sponsor.
PCBWay have been supporting the channel for a while, they offer PCB Production, CNC and
3D Printing, PCB Assembly and much much more.
I've made quite a few boards with them and they are great to work with.
You can find a link to their details in the description.
So, how are we going to do the USB interface?
This is actually surprisingly easy - we're going to use a Teensy.
A Teensy can pretend to be many USB devices, including a USB audio device.
What's really cool with the Teensy is that you can design your Audio project in a graphical
environment so it's pretty easy to get some simple code up and running.
Here I'm connecting the I2S input through an amplifier and out to the USB interface.
This generates some very simple code that we can copy and paste it into our sketch.
We just need to set the amplifier gain in our setup function.
If you wanted to get fancy then you could hook the value of this gain up to an analogue
input and have a volume control on your microphone.
There are also a whole bunch of entertaining effects that you can add - all of these run
in real-time on the device so you could easily build yourself a real-time voice manipulator.
If we plug a Teensy running the simple sketch into the computer it shows up as an audio
device and we can record audio from it.
That's pretty amazing for just a few lines of code.
How do we get all our microphones hooked up?
The Teensy can only act as a single USB device and only supports two channels, so I've got
two Teensys connected to support my three microphones.
Hooking up the I2S MEMS microphone is trivial.
The really nice thing about this kind of microphone is that you can just connect it directly to
the I2S interface of your microcontroller.
To make sure it's got a nice clean power supply I'm using a battery and a low drop out regulator
to feed it 3.3volts.
This is probably completely unnecessary but we've seen when using the ESP32 how easy it
is to get power supply noise interfering with the microphone.
For the two analogue microphones there's a bit more work to do.
The electret microphone requires a small bias voltage to work and I've got a nice little
MAX9814 breakout board that can supply this.
This board also has a handy built in 5v linear regulator so once again we can power it from
a nice clean battery - I'll also tap off from this 5v supply for some of the other boards
we need.
The MAX9814 is a very nice little chip and include an automatic gain control so it will
be interesting to see how it performs.
The dynamic microphone requires a very high gain pre-amplifier as the signal coming from
the moving coil is very low.
I've got a small breakout board based around the AD828 op-amp that has been configured
as a microphone pre-amp.
This requires a 5v power supply so I'm taking a line off the MAX9814 board to power it.
Both of these microphone pre-amplifiers will give us an analogue signal so we need to
pass them both through an analogue to digital converter.
Fortunately, I have another breakout board that contains a PCM1808 which is stereo Analogue
to Digital Converter that outputs an I2S signal.
This requires both a 5v supply and a 3.3v volt supply for the 5v supply we'll use the
clean power coming from the linear regulator and battery.
For the 3.3v supply, we can just use the power from the Teensy as this is the supply for
the digital part of the IC.
Now that our signal is I2S we can just connect it straight to the Teensy and use it as a
stereo microphone.
With everything wired up and plugged in I've mapped all these inputs along with my shop
bought USB mic through to one single audio device so I can record them simulataneously.
I've normalised the four different samples to remove any difference in volume.
This is my shop-bought USB microphone.
And this is the ICS43434.
And here's the dynamic microphone.
And finally here's the electret microphone.
To my hearing, both the analogue microphones seem slightly flatter than the shop-bought
USB microphone.
The MEMS microphone doesn't seem to have as much base as the shop-bought microphone, but
it sounds pretty good.
If we look at the spectrograms of each signal we can see some differences.
Both the analogue microphones seem to be missing some of the higher frequencies.
This makes me suspect that the A2D converter may not be giving us the full range.
The MEMS microphone seems to go to the full 20KHz range, but also seems to have picked
up some high frequency noise.
All this has made me wonder what's actually in my shop-bought microphone.
So I've taken it apart and see what makes it tick.
Looking at the microphone it's an electret microphone, we can confirm this by checking
to see if it's magnetic and also by checking the bias voltage which is pretty low.
The electret microphone capsule is bigger than my electret microphone - it's 1.5cm vs
1cm - this means that my shop-bought microphone is going to be more sensitive than my home
made version.
In terms of electronics, everything is being done by this one chip, a RealTek ALC4042.
It's quite hard to find very much information on this chip, but it does seem to be used
in a lot of products.
Having looked inside the microphone, it's quite tempting to attempt some kind of upgrade
to it, but that's probably for another video.
I promised you a test - so here it is.
The audio for this video was actually recorded using my new microphones.
The introduction and first section was recorded using the MEMS microphone, the third and forth
sections were recorded using the electret microphone and the fifth and sixth sections
were recorded using the dynamic microphone.
This final section is being recorded using my shop-bought USB microphone.
Could you tell any difference in the audio?
Let me know in the comments.
I'll see you in the next video!