How to Use a Microphone with Arduino?

How to Use a Microphone with Arduino?

Do you want to add sound capabilities to your Arduino project? This Arduino microphone guide will teach you everything you need to know about using microphones with Arduino! We’ll cover the different types of microphones that are available, how to connect them to Arduino, and how to use them in your projects. By the end of this guide, you’ll be able to incorporate sound into your Arduino projects with ease!

Why Would You Need to Attach a Microphone to Arduino?

There are a number of reasons you might want to do this. For example, you might want to use the Arduino to read sound signals from a microphone and then play them back or use them as input for another project. You might also want to use a microphone as an input for a control system, like one that automatically adjusts the volume of your music based on how loud it is in the room.

First, let’s take a look at what you need to know about working with microphones and Arduino. Then, we will get right to the process!

Arduino and the Basics of Working With It

An Arduino is a microcontroller board that can be programmed to read input from various sensors and control output devices like motors, LEDs, and solenoids. It has an Atmel AVR microcontroller as its CPU and comes with a variety of inputs and outputs (I/O), including analog inputs, digital I/O pins, UARTs, SPI, and I²C.

Arduino and the Basics of Working With It

Arduino uses the C and C++ programming languages, which is why you will need to have some familiarity with it in order to use Arduino for projects that involve microphones. If you don’t know how to code in either, there are a variety of tutorials out there to get you started.

It comes with its own IDE, which you can download for free from the Arduino website. The development environment is where you write your code, compile it, and then send it to the Arduino board to be run.

The world of electronics is an exciting one, with new discoveries being made every day. There are also a number or different Arduino boards available to suit your needs – each having its own set features and capabilities. The one we will be using for this project is the Arduino Uno board. And for a good reason as the Arduino Uno is the most popular Arduino board plus is easy to use. It has 14 digital input/output pins (of which six can be used as PWM outputs), 6 analog inputs and even comes equipped with USB connection capabilities as well as an ICSP header! The ATmega328P processor does all the hard work for you so that your projects are quick, easy-to use–and often fun too.

A microphone is an input device that converts sound into electrical signals. The Arduino can be used to read these signals and do something with them, like play a sound or change the color of an LED. [1], [2]

What is an Electret Microphone?

An electret microphone is a type of condenser microphone that uses an electret material to convert sound into electrical signals. They are often used in portable devices like cell phones, because they are cheaper and require less power than other types of microphones.

Electrets are materials that have a permanent static charge. They are often made of plastic or metal and are typically small and inexpensive. This makes them popular for use in portable devices like cell phones and laptops. They are also relatively easy to use with Arduino.

There are two types of electret microphones: standalone and attached to a breakout board. A standalone electret microphone is a self-contained unit that has its own amplifier and voltage regulator. An attached electret microphone is a type of condenser microphone that plugs into a breakout board, which provides the amplifier and voltage regulator. You may also see these boards being called “sound sensors”.

Breakout boards are boards that provide various connections and components needed to interface with other devices. They can be used to connect sensors, actuators, and other electronics to Arduino. Breakout boards are often used with microphones, because they provide the necessary connections and amplifiers needed to use them with Arduino. [3], [4], [5]

How Does Electret Microphone Work?

An electret microphone contains a small metal plate that has been coated with an electret material. When sound waves hit the metal plate, they cause it to vibrate. This vibration creates a small electric current that can be converted into an electrical signal. The Arduino can read this signal and do something with it, like play a sound or change the color of an LED.

How Does Electret Microphone Work?

Current that can be converted into an electrical signal. The Arduino can read this signal and do something with it, like play a sound or change the color of an LED.

The amount of current that is created depends on the intensity of the sound wave. The louder the sound, the more current is created. This means that you will get a higher voltage reading from the Arduino when it is picking up a loud sound than when it is picking up a soft sound.

You can use this information to control how your Arduino reacts to different sounds. For example, you could use it to make an LED light up brighter or play a louder sound when a person talks loudly into the microphone.

There are also a few different ways that you can filter the sound that is being picked up by the microphone. This can be useful if you want to only react to certain sounds, like someone talking for clapping their hands.

One way to filter the sound is by using a bandpass filter. A bandpass filter allows only a certain range of frequencies to pass through it. This can be useful if you want to react to a specific type of sound, like someone talking or singing. It will block out all other types of noise and sounds.

Another way to filter the sound is by using a low-pass filter. A low-pass filter allows all frequencies below a certain point to pass through it, while blocking all frequencies above that point.

There are also ways to combine these filters together to create even more specialized filters. Experiment with different combinations until you find one that works best for your project. [3], [4], [5], [6]

What is a Pre-Amplifier?

A preamplifier is a device that amplifies a weak signal before it is sent to the Arduino. This is often necessary when working with microphones, as they often produce very small signals.

Pre-amplifiers can be either analog or digital. Analog pre-amplifiers are typically less expensive but can be more difficult to use with Arduino. Digital pre-amplifiers are more expensive but are easier to use and provide better performance. Many microphones also come with their own pre-amplifier. If your microphone has one, you do not need to buy a separate pre-amplifier.

When using an analog preamplifier, be sure to connect it to the Arduino using an analog input pin. If you are using a digital pre-amplifier, be sure to connect it to the Arduino using a digital input pin.

Now that you know a little bit about how microphones work, let’s take a look at how to use them with Arduino.

What is a Pre-Amplifier?

In the following examples, we will be using an electret microphone and an Arduino Uno. Other Arduinos may have different pin layouts, so make sure to check your board’s documentation if you are using one. [3], [4], [5]

How will the circuit work?

The circuit that we will be using is very simple. It consists of the microphone, a resistor, and an Arduino.

The resistor is used to help protect the Arduino from damage. It limits the amount of current that can flow into the Arduino’s input pins. This is important, because microphones can produce large amounts of current, which could potentially damage the Arduino if it was not protected.

The resistor value will vary depending on what type of microphone you are using. You will need to do some testing to find the correct value. We suggest using a 6,000 ohm resistor. You might want to use multiple resistors in parallel if you are using a microphone with a high impedance. If you don’t get it right, the microphone will simply not work.

The Arduino will be reading the voltage that is being output by the microphone. This voltage will vary depending on the intensity of the sound that is being picked up. To help Arduino get readings, an amplifier will need to be used.  [3], [4], [5]

Connecting Electric Microphone to the Arduino

Before we get to the process of how to connect your microphone to Arduino, let’s see what you need to gather for this project.

In addition to an Arduino and a microphone, you will need:

  • A pre-amplifier (if your microphone doesn’t have one built in)
  • A computer
  • LM358 amplifier chip
  • A 6 K ohm resistor
  • A 10 ohm resistor
  • Some jumper wires
  • LED screen
  • Capacitors

Now that you know what you will need, let’s get started. [3], [4], [5], [7]
Connecting Electric Microphone to the Arduino

Connect the microphone through the required pins in Arduino

The first step is to identify which pins on the Arduino you will be using.

Microphones usually have three connectors: ground, signal, and power. Connect the ground connector on the microphone to the ground pin on Arduino. Doing this will create an output signal link for the microphone and Arduino, which is necessary for proper operation.

Next, attach the signal connector to pin A0. This will allow the Arduino to read the incoming signal.

Finally, connect the power connector 5V Vin on Arduino. Connecting your microphone to the 5V pin will provide power to the microphone, potentially even increasing its sensitivity.

If you are using a pre-amplifier, connect it to the amplifier chip as shown in the diagram.The amplifier chip will be connected to pins A0 and GND on Arduino. [3], [4], [5], [7]

Code your microphone on Arduino

Now that your microphone is connected to the Arduino, it’s time to start coding. Open up the Arduino IDE and input the following code into the editor.

The code for this project will be very simple. We will just be reading the incoming signal from the microphone and printing it out to the computer screen.

const int microphonePin = A0;



void loop() {

int mn = 1024;

int mx = 0;

for (int i = 0; i < 10000; ++i) {

int val = analogRead(microphonePin);

mn = min(mn, val);

mx = max(mx, val);


int delta = mx – mn;



Serial.print(” Max=”);


Serial.print(” Delta=”);



Analyzing the code

Now that we have written the code, let’s take a look at what it does.

The first two lines of code simply define the microphonePin variable to be A0 and set up the Serial connection.

In the main loop, we start by declaring two variables: mn (min) and mx (max). We will use these variables to store the minimum and maximum values of val (the incoming signal from the microphone).

We then use a for loop to read in values from the microphonePin over a period of 10000 iterations. For each reading, we store the value in val and then min and max are set to store the minimum and maximum value of val respectively.

We then calculate delta (the difference between mx and mn) and print out the values of min, max and delta.

When you run this code in the serial monitor, you should see something like this:

Min=0 Max=1024 Delta=1024

Inside of the while loop, we also have two functions: “readMicrophone” and “printValues“. The “readMicrophone” function reads the voltage that is being output by the microphone and prints it to the serial monitor window on your computer screen. This function is important, because it allows you to see how loud or quiet the environment is.

It is important to note that these values will vary depending on the environment and the microphone being used. However, this code should give you a good idea of how to read signals from a microphone using Arduino. [3], [4], [5], [7]

Getting Arduino Readings on LED Displays

Now that you know how to use a microphone with Arduino, you may be wondering if it’s possible to get Arduino readings on LED displays.

Getting Arduino Readings on LED Displays

The answer is yes! It is possible to get Arduino readings on LED displays by using a new function. Attach the LED to the pin 13 of the Arduino and use this code below:

const int microphonePin= 0;

const int ledPin=13;

int sample;

const int threshold= 800;

void setup() {

pinMode (ledPin, OUTPUT);



void loop(){

sample= analogRead(microphonePin);

if (sample > threshold)


digitalWrite (ledPin, HIGH);

delay (500);

digitalWrite (ledPin, LOW);


else{ digitalWrite(ledPin, LOW); }


In this code, we are using a new function called threshold(). This function will help us keep track of the sound level that is being recorded by the microphone. If the sound level is higher than the threshold that we set, then the LED will turn on. Otherwise, the LED will stay off.

You can also use this code to create a sound activated light or alarm. Just replace the LED with a buzzer or other alarm and modify the code accordingly. [4]

How to Use Your Connected Microphone

Now that you have everything set up, it’s time to start using your microphone.

Open up the serial monitor and start speaking into the microphone. You should see the values in the serial monitor change as you speak.

Here are a few tips for using your microphone:

  • Speak directly into the microphone. This will give you the best results.
  • Avoid background noise as much as possible. This can interfere with the signal being received by the Arduino.
  • Be patient. It may take some time to get used to reading the values from the serial monitor. With practice, you will be able to get accurate readings quickly and easily.

Improve your Arduino skills with following guides:


How does a microphone work in Arduino?

A microphone is an input device that converts sound into an electrical signal. This signal can be used to control various aspects of your Arduino project.

There are many different types of microphones, each with their own unique properties. For this guide, we will be using a condenser microphone. Condenser microphones are more sensitive than other types of microphones and are ideal for capturing high-quality audio recordings.

If you are using a different type of microphone, please consult the documentation for your specific microphone for wiring instructions.

How do I connect a mic module to Arduino?

There are many different types of microphone modules available, so you’ll need to check the specifications to determine the correct connector. Most mic modules use a three-pin connector, with the middle pin being for ground and the other two pins being for signal and power.

If your mic module has a four-pin connector, then it will likely have an additional pin for power.

Can I turn Arduino into a player?

Yes, you can turn an Arduino into a player by using an audio shield and the appropriate libraries. There are many different shields and libraries available, so be sure to research which one will work best for your project. For example, the AudioZero library is a great start. After downloading the file, you will have to import it and then go ahead to creating your project.

Useful Video: How To Use A Sound Sensor With Arduino


Arduino is a physical programmable circuit board that can read and send input to various sensors and devices. In this project, we will be using a microphone as the input device. You will need resistors, capacitors, LED, wires and an amplifier for this project. Of course, an electret microphone as well. It will convert sound into electrical signals you can use as you please. If you want to take your project up a notch, consider using an amplifier circuit to boost the sound signal before sending it to Arduino.

Once you have your microphone hooked up to the Arduino, you need to enter the code in a special IDE. Now you are free to experiment with your mic. Have fun with it and see what cool things you can come up with. What will you create?