In this article, we connect a KY-037 High Sensitivity Sound Detection Module to a Raspberry Pi Pico, any Rp2040 type board will be suitable. We actually tested this with a Cytron Maker Pi Pico
We will use Micropython for these examples but of course you can use the Arduino IDE as well if you have Raspberry Pi Pico support enabled
The KY-037 is a high-sensitivity microphone module designed to detect sound levels and convert them into electrical signals for Arduino, Raspberry Pi, and other microcontroller projects.
Overview and features
- Type: Analog and Digital Sound Sensor
- Primary Function: Detects ambient sound levels and outputs both analog and digital signals.
- Sensitivity: High sensitivity with onboard microphone and amplification circuit.
- Applications:
- Sound-activated systems
- Voice detection
- Security alarms
- Sound-responsive LEDs and robots
- Dual Output:
- A0 (Analog): Provides a continuous signal representing the detected sound level.
- D0 (Digital): Outputs HIGH/LOW based on a sound threshold, adjustable via a potentiometer.
- Adjustable Sensitivity: Potentiometer allows for easy adjustment of the detection threshold.
- Indicator LEDs:
- Power LED: Indicates the module is powered.
- Signal LED: Lights up when sound exceeds the threshold (D0 output HIGH).
- Wide Compatibility: Supports Arduino, Raspberry Pi, ESP32, and other microcontrollers.
Sensor Pinout
Pin | Label | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground |
3 | A0 | Analog output (sound level as voltage) |
4 | D0 | Digital output (sound threshold detection) |
How It Works
- Microphone: Captures sound and converts it into an electrical signal.
- Amplifier Circuit: Boosts the weak signal from the microphone to a usable level.
- Analog Output (A0): Provides a real-time signal proportional to the sound intensity.
- Digital Output (D0): Outputs HIGH or LOW based on sound intensity exceeding a set threshold.
Specifications
Feature | Value |
---|---|
Operating Voltage | 3.3V to 5V |
Analog Output Range | 0 to VCC (Proportional to sound) |
Digital Output | HIGH or LOW (Adjustable) |
Detection Distance | Up to 2 meters (depending on sensitivity) |
Module Size | 38mm x 15mm |
Sensitivity | Adjustable via potentiometer |
Microphone Type | Electret Condenser Microphone |
Usage
- Analog Output (A0):
- Directly reflects the loudness of the sound detected.
- Can be used to measure intensity changes over time.
- Digital Output (D0):
- HIGH (1): Sound detected (above threshold).
- LOW (0): No significant sound detected.
*Adjusting Sensitivity
- Threshold Control: Use the potentiometer to adjust the sound detection level.
- Clockwise: Increases sensitivity (triggers at lower sound levels).
- Counterclockwise: Decreases sensitivity (triggers at higher sound levels).
Use Cases
- Sound-Activated Lights
- Clap-Controlled Devices
- Security Systems (Sound Alarms)
- Robotics (Sound Triggers for Movements)
- Voice-Controlled Projects
- Noise Monitoring Systems
Troubleshooting
Issue | Solution |
---|---|
No Response from A0 or D0 | Check VCC and GND connections. |
D0 Always HIGH/LOW | Adjust potentiometer to set appropriate threshold. |
Analog Value Not Changing | Ensure microphone is facing the sound source. |
Inconsistent Detection | Reduce noise interference or recalibrate sensitivity. |
False Triggers | Decrease sensitivity or add a noise filter in code. |
Parts Required
You can connect to the module using dupont style jumper wire.
Name | Links |
Raspberry Pi Pico | |
37 in one sensor kit | |
Connecting cables |
Schematic/Connection
Pico | Sensor |
---|---|
GPIO26 | A0 |
GND | GND |
3 V | +V |
GPIO28 | D0 |
Code Examples
from machine import Pin, ADC from time import sleep # Initialize ADC0 adc = ADC(0) # Initialization of GPIO28 as an input digital = Pin(28,Pin.IN, Pin.PULL_UP) print("KY-037 Microphone") # Endless loop for reading out the ADC while True: raw_value = adc.read_u16() # Conversion from analog value to a voltage Volt = round(raw_value* 3.3 / 65536, 2) digital_value = digital.value() # Serial output of the analog value and voltage print("Analog voltage value is : " + str(Volt) + " V\t Threshold value: ", end="") # Query whether the digital value has changed with serial output if digital_value == 1: print("value reached") else: print("value not reached") print("----------------------------------------") sleep(1)
REPL Output
Disclaimer
This website may contain affiliate links, which means we may receive a commission if you click on a link and make a purchase. This comes at no additional cost to you.