Sound Detection Module
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.
- Raspberry Pi (any model)
- Sound Sensor
- Female to Female jumper wires
- microSD card with Raspbian installed.
Connect the sound sensor to your Raspberry Pi as shown in the diagram below:
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:
The script will detect sound every time. Press Ctrl + C to terminate the execution of the Python script.