Acoptex.Com

Learn ESP32, ESP8266, Arduino, and Raspberry Pi

Arduino guide for microphone sound sensor

We will learn how to use the microphone sound sensor with the Arduino board.

Tag: Project 132a Microphone sound sensor for Arduino. Acoptex.lt

Project resources

Parts required

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

  1. Microphone sound sensor 1 pc
SOUND MODULE

2. Jumper cables  F-M 4 pcs, jumper cables M-M 5 pcs

jumper cables

3. Arduino Nano and Mini-B USB cable 1 pc

ARDUINO NANO

4. Resistor 220 Ohm 1 pc

resistor 220 ohm

5. LED 1 pc

led

6.Small or half breadboard 1 pc

breadboard

Understanding the microphone sound sensor

These sound sensors are inexpensive, easy to interface with and are able to detect sounds of voice, claps or door knocks. You can use them for a variety of sound reactive projects, for example, making your lights clap-activated or keeping an “ear” on your pets while you’re away.

The sound sensor is a small board that combines a microphone (50Hz-10kHz) and some processing circuitry to convert sound waves into electrical signals. The sound sensor has two LEDs. The Power LED will light up when the module is powered. The Status/Out LED will light up when the digital output goes LOW.

This electrical signal is fed to on-board LM393 High Precision Comparator to digitize it and is made available at OUT or DO pin.

The module has a built-in potentiometer for sensitivity adjustment of the output signal. Rotate the knob counterclockwise to increase sensitivity and clockwise to decrease it. You can set a threshold by using a potentiometer; So that when the amplitude of the sound exceeds the threshold value, the module will output LOW otherwise HIGH. This setup is very useful when you want to trigger an action when certain threshold is reached. For example, when the amplitude of the sound crosses a threshold (when a knock is detected), you can activate a relay to control the light.

How do the Electret Microphones work?

Inside the microphone is the thin diaphragm, which is actually one plate of a capacitor. The second plate is the back plate, which is close to and parallel to the diaphragm.

How do the Electret Microphones work?
Image credit: soundonsound.com

When you speak into the microphone, sound waves created by your voice strike the diaphragm, causing it to vibrate. When the diaphragm vibrates in response to sound, the capacitance changes as the plates get closer together or farther apart. As the capacitance changes, the voltage across the plates changes, which by measuring we can determine the amplitude of the sound.

Calibrating Sound Sensor

To get accurate readings out of your sound sensor, it is recommended that you first calibrate it. The module has a built-in potentiometer for calibrating the digital output (OUT or DO).By turning the knob of the potentiometer, you can set a threshold. So that when the sound level exceeds the threshold value, the Status LED will light up and the digital output (OUT or DO) will output LOW. Now to calibrate the sensor, start clapping near the microphone and adjust the potentiometer until you see the Status LED on the module blink in response to your claps. That’s it your sensor is now calibrated and ready for use.

Understanding the Arduino Nano

You can read more about it here.

Signals and connections of the Arduino Nano

You can read more about it here.

Signals and connections of the michrophone sound sensor

Signals and connections of the michrophone sound sensor Acoptex.com
Signals and connections of the michrophone sound sensor Acoptex.com
  • OUT, DO – Digital output pin. Outputs HIGH when conditions are quiet and goes LOW when sound is detected. You can connect it to any digital pin on an Arduino or directly to a 5V relay or similar device.
  • GND, G – ground pin. Connect it to the GND pin of the Arduino board.
  • +5V– power supply pin. Supplies power for the sensor. Connect it to the 5V pin of the Arduino board.
  • VCC – power supply pin. Supplies power for the sensor. It is recommended to power the sensor with between 3.3V – 5V.
  • AO – Analog output pin. The analog output voltage changes with the intensity of sound received by the microphone.

Wiring

Wiring of microphone sound sensor
Microphone sound sensorArduino Nano
VCC, +5V
GND, GGND
OUT, DOD7
LEDArduino Nano
LED cathodeD13
LED anodeGND

Step by Step instruction

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Arduino Nano board into your PC and select the correct board and com port.
  4. Verify and upload sketch to your Arduino Nano.
  5. After uploading the code, you can clap next to the sensor. If the LED is not lighting up, you need to change the sensor sensitivity by rotating the potentiometer. You can also adjust the sensitivity so that the LED follows the beat of a certain music and add more LEDs for a more spectacular effect.

Wrapping up

We have learnt how to use the microphone sound sensor with the Arduino board.

Check for more DIY projects here.

Thank you for reading and supporting us.

Check for more DIY projects on Acoptex.lt and Acoptex.com!

If you are looking for high quality PCBs PCBWay is the best choice: