Sound Detection Module
Introduction
In this tutorial, you will learn how to connect a sound sensor to your Raspberry Pi’s GPIO pin and make it detect sound using Python.
Required Hardware
- Raspberry Pi (any model)
- Sound Sensor
- Female to Female jumper wires
- microSD card with Raspbian installed.
Wiring
Connect the sound sensor to your Raspberry Pi as shown in the diagram below:

Code
On your Raspberry Pi, open a terminal window. Install python by the following commands:
sudo apt-get update
sudo apt-get install -y python-dev python-rpi.gpio
Download and save this file to your desktop
With the following commands you can execute the Python script that displays the distance:
cd Desktop
python sound.py
The script will detect sound every time. Press Ctrl + C to terminate the execution of the Python script.
Images & Screenshots
