How to add a microphone to Raspberry Pi ?

One of the first things that surprised me when I received my Raspberry Pi was that there was no microphone jack.
This port seemed to be useful for many things, that’s why I did some research and test on the subject. And now I’m able to tell you more about it with this article.

If there is no microphone port in the Raspberry Pi, how can we add one?
It could have been easier if it had been integrated. But you have plenty of methods to add a microphone to a Raspberry Pi according to your needs (jack, USB or even Bluetooth)

As you read the article, you will understand:
– Why there is no microphone directly integrated
– How to add a microphone to the Raspberry Pi
– How to check it’s working and use it in a basic way
– Why would a microphone be useful for your future projects

Why there is no microphone directly integrated

The basic concept of Raspberry Pi is to create a “computer” with these 3 criteria:
– a small size
– a small price
– important possibilities of upgrade

The goal is not really to integrate all components of a PC in a Raspberry Pi, but to put the minimum vital with the least expensive parts while allowing to add other elements easily according to your needs

That’s exactly the same reasoning regarding the microphone
And you’ll see that it’s not that complicated to add one, and at least it will totally fit your needs if you buy it separately

How to add a microphone to the Raspberry Pi

The first thing to do before installing a microphone is to ask yourself what you want to do with it
First choose one that fits your needs, without looking whether it will be compatible or not
Assume that everything is possible

You have made your choice or already have one that you want to install?
Let’s see how to do it for the three most frequent cases

USB Microphone

The first possibility, which is probably the simplest, is to connect a USB microphone
There are many models to suit your needs.
From a simple microphone like a USB key, to USB headphones and even a conference microphone that you put on the table
By chance, whatever your choice is, the configuration will be similar

The advantage of USB is that generally your microphone will be detected automatically by Raspbian, it’s plug & play

In my case, I just plugged it into a free USB port, and  the sound controller peripherals now display the microphone in the list

If you see your microphone in this place that’s it, you have to adjust the amplification, and you can use it

Bluetooth Microphone

If you have a Bluetooth microphone (headphones or other), globally there are two cases that can occur:
– you have a raspberry pi with Bluetooth and your microphone is detected automatically
– you do not have that luck 🙂

Bluetooth microphone detected automatically

I did the test using a bluetooth headset with mic, and I was lucky that it was very well recognized by the Raspberry Pi
So I could easily pair it

Then the sound switched automatically to the headphones, and I recorded my voice with the headset microphone

However, I didn’t manage to adjust the output parameters (especially volume) via the GUI. I had to go through alsamixer:

alsamixer

Bluetooth not detected

In case your Bluetooth microphone is not detected, the microphone manufacturer will generally provide a USB adapter with it.
You can use it

Maybe it’s possible to inject drivers or at least do something to help the Bluetooth recognize your microphone, but I admit I have not encountered this case, so I didn’t look more

Then you go back to the chapter “USB Microphone” and follow the same steps

Jack Microphone

This solution is the most complicated, so it’s better to have a good reason to want to install a microphone jack at any price.
Indeed, since there is no integrated connector, you will need to add an extension to your Raspberry Pi
This solution is to buy and install a sound card, which will allows, among other things, to connect a microphone jack

There are mainly two types of sound cards, and in both cases, it means that you will have to buy an additional component (either a USB soundcard or a Hat soundcard)

USB Soundcard

usb soundcardI think this is probably the most straightforward way to add a jack microphone if that’s what you want

For less than $10 you can buy a USB to jack adapter, which allows you to connect a USB headset and microphone to your raspberry pi

The configuration will be the same as the one indicated at the beginning of this post.
Raspbian will detect the adapter and you will only have to configure your microphone

Hat Soundcard

For DIYers or those who need a better sound quality, there are real sound cards, very close to those that can be found in conventional computers

For about $30, you can install this “Hat” soundcard via the GPIO ports of Raspberry Pi and enjoy a professional product for advanced projects (check on Amazon.com)

How to check it’s working and use it in a basic way

From command line

If you want to be sure that your microphone works well, the easiest way is to do a recording test
To do this, launch a terminal and type the following command:

arecord -D plughw:1,0 test.wav

Then open the sound file with your favorite audio player to check that the microphone recorded well your voice

For example:

omxplayer test.wav

From the desktop

Graphically, there are lots of software that you can use to test your mic or manage your audio recordings
But the one I recommend you to use is Audacity

Just install it with:

apt-get install audacity

Launch it by going to the start menu, then Sound & Video and finally Audacity

The interface is very intuitive.
You have to click on the red “Record” button to start your recording

audacity

You can then check the sound by simply clicking on Play

Audacity allows a lot of editing to your raw sound. For example, you can amplify it, change the frequency of sampling or add various effects

Raspberry Pi projects with a microphone

There are tons of possible projects with a Raspberry Pi, and for some of them, the microphone quality will be essential
Now that you have a functional mic, maybe you can think about this kind of projects. I give you 2 or 3 examples to give you some ideas

Home assistant

Siri, Alexa, Google assistants… Have you ever heard of them?
Personal assistants are taking up more and more place in our lives and can help us with a lot of things

Did you know that it was possible to transform a Raspberry Pi in Amazon Echo?
Well yes, there are many projects on the web allowing you to run the home assistant of your choice on your Raspberry Pi, and thus customize it according to your desires

This project is relatively simple and inexpensive
With your microphone, you already have 50% of the necessary material
A speaker, some coding things, and your Raspberry Pi will become the home assistant of your choice

Baby Monitor

It is a project that can be a little more complicated if we go to the end of things, but that can be interesting
Indeed it is possible to add the following elements on a Raspberry Pi:
– microphone for listening to the baby
– a camera to monitor it
– a temperature and humidity sensor to make sure your room is nice
– a speaker to play a lullaby

What do you want more?
For less than $50  you will replace expensive accessories while having fun!

Conclusion

Here it is, I hope this article will help you understand why there is no microphone port in the Raspberry Pi and how to add one easily whatever your need is
You also got a glimpse of the possibilities you can explore with a microphone connected to your Raspberry Pi

If you have issues installing your microphone, please leave a comment, and I will try to help you

Leave a Comment