INTRODUCTION:
In this tutorial, we will learn about the KY-037 module, how it works and we will build a simple project using the KY-037 module and an Arduino.
SOUND DETECTION SENSOR KY-037:
The KY-037 Module will be our main component for this tutorial. This module has a microphone, and an LM393 differential comparator mounted on a breakout board with a potentiometer and several resistors. Figure 1 shows the module as seen in fritzing.
PIN OUT:
The KY-037 module has three pins.
Pin | Description |
---|---|
G | GND |
S | Signal |
(+) | +5V |
HOW DOES IT WORK?
The microphone converts sounds waves to analog signals which is then fed to a comparator circuit made-up by the LM393 circuit. The circuit compares the signal with a predetermined treshold set by VR1. If the sound intensity is greater than the threshold, it pulls the Signal (S) pin to HIGH, otherwise the S-pin is LOW.
PROJECT – ARDUINO LOUDNESS INDICATOR:
After learning about the KY-037 module and how it works, it is now time to build a project using the module. Our project will get request temperature reading from the KY-037 module and display it on the serial monitor.
PROJECT COMPONENTS:
For this project, we need the following components:
- Arduino Uno board (1 pc.)
- KY-037 Sound Detection Sensor (1 pc.)
- Jumper wires
WIRING DIAGRAM:
Figure 2 shows the connection between the Arduino Uno and the KY-037 Sound Detection Sensor.
The KY-037 module pins are connected to the Arduino Uno board as follows:
Component Pin | UNO Board Pin |
---|---|
G | GND |
S | 8 |
(+) | +5V |
CODE:
Below is the Arduino sketch for our project. I have added comments to explain important parts of the code. Save the code as KY-037.ino and upload it to your Arduino board.
// Arduino and KY-037 module void setup () { pinMode (13, OUTPUT); // built-in LED pin set to output pinMode (8, INPUT); // module output connected to Arduino pin 8 } void loop () { if (digitalRead(8) == HIGH) { digitalWrite (13, HIGH); // if sound is louder than threshold, // switch-On built-in LED } else digitalWrite (13, LOW); }
PROJECT TEST:
Apply power to your Arduino Uno board. If the sound intensity reaches the threshold setpoint set by VR1, the built-in LED of the Arduino will also light-up. Adjust the threshold by turning VR1.