
Limited Time Download: Follow us on “Microcontroller”, reply “Tutorial” to get the microcontroller eBook, reply “Simulation” to get Proteus simulation materials. Continuously updated…
Source: Geek Fans (http://www.geekfans.com/article-5095-1.html)
In this article, we will use a sound sensor to create a simple voice-controlled light.
Final Effect
Raspberry Pi GPIO Getting Started 07 – Voice-Controlled Light Using Sound Sensor video demonstration:
Hardware
-
Breadboard
-
Dupont Wire
-
1 LED Light Emitting Diode
-
1 Sound Sensor
Hardware Diagram
Principle Explanation
The sound sensor has 3 pins: positive power, negative power, and data OUT, which are connected to the Raspberry Pi’s VCC, GND, and any GPIO pin (input mode), respectively. When the sound sensor detects sound, it outputs a low level from the OUT pin. Note that the low level does not last; once the sound ends, the sensor will stop outputting low level immediately. Additionally, there is a potentiometer on the sensor with a cross-shaped knob that can be rotated with a small screwdriver or knife to adjust the sound sensitivity (the threshold for triggering volume). The short pin of the LED is connected to GND, and the long pin is connected to another GPIO pin (output mode). When the Raspberry Pi receives the low level signal from the sensor, it outputs high/low levels to turn the LED on/off.
Hardware Connection
-
Sound sensor positive power – Raspberry Pi’s VCC
-
Sound sensor negative power – Raspberry Pi’s GND
-
Sound sensor data OUT – Raspberry Pi’s GPIO4
-
LED long pin – Raspberry Pi’s GPIO17
-
LED short pin – Raspberry Pi’s GND
Code (Python)
|
|
Resource Download
prog.py (click to read the original text to download)
Limited Time Download: Follow us on “Microcontroller“, reply “Tutorial” to get the microcontroller eBook, reply “Simulation” to get Proteus simulation materials.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Click the bottom left corner “Read the Original Text“, to enter theForum for Discussion!!!