Learn interfacing Small Microphone Sound Detection Module KY-038 in Arduino. Small sound sensor acts like a microphone which detects sound signals. The sensor will detect sound signals an provide digital or analog output. The sound sensor can be used to make exciting projects like clap switch. In this article, will make led glow on detection of sound. For this, we will be using small sound sensor ky-038 and Arduino UNO. So, let’s start.
Step 1: Required Components
Small Microphone Sound Detection Module KY-038 x 1
Generic LED x 1
Breadboard x 1
220 Ω Resistor x 1
Arduino UNO Board x 1
Step 2: Circuit Time
Following are instruction for making a circuit to interface small sound with Arduino.
- Connect (+) pin and GND pin of the sound sensor to +5v and GND of Arduino.
- Now, connect D0 pin of the sound sensor to digital pin 7 of Arduino.
- Then connect LED to pin 13 of Arduino by placing a 220Ω resistor in between long leg of LED and digital pin 13.
Step 3: Code Time
This code for Small Microphone Sound Detection Module KY-038 in Arduino. Firstly, we initialize pin d0 (sound) and led pin. The output of sensor will be 0 or 1, so, we declare val as boolean and initialize it to 0. We will set the sound pin as input and led pin as an output. In the loop, we check the value of output. If the output is high (sound detected) then LED will turn on otherwise it will remain off.
Step 4: Upload the code to Arduino
Upload the above-given code to the Arduino UNO Board after the components are set as per the Circuit Diagram. The LED turns on and off based on the sound detection.
For information about uploading code to Arduino UNO Click Here.