Sound Detection Module with Raspberry Pi
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.
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.
Images & Screenshots