Voice Activated Light with Sound Sensor & Raspberry Pi Pico
Voice Activated Light using Sound Sensor & Raspberry Pi Pico Board with MicroPython Code to simulate the Sound Amplifier Module
- Suitable forB.Tech/Diploma RPi Pico students
- Build time1-2 weeks
- LevelBeginner
- Available atAjvika Labs, Kakinada
About this project
Overview
In this guide, we will make a Voice Activated Light using a Sound Sensor & Raspberry Pi Pico Board.
The sound sensor detects the level change of the sound sensor through Raspberry Pi Pico. When the sound loudness is greater than the threshold, the sensor is triggered, and then the
RGB LED
is controlled to light up. Then the LED will automatically turn off after waiting for 3 seconds.
Components Required
In this guide, I used
Elecrow Raspberry Pi Pico Starter Kit
to test different Modules. You can buy the kit and perform some other operations as well. From this kit, you can use the following components.
1. Raspberry Pi Pico Board -1
2. Sound Sensor – 1
3. RGB LED Module – 1
4. Breadboard -1
5. Jumper Wires – 10
6. Micro-USB Cable
Sound Sensor
The sound sensor acts like a microphone, which is used to receive sound waves. The sensor has a built-in condenser electret microphone that is sensitive to sound. Sound waves make the electret film in the microphone vibrate, resulting in a change in capacitance and a small voltage corresponding to the change. This voltage is then converted into a 0-5V voltage, which is received by the data collector after A/D
conversion and transmitted to the microcontroller.
The Sound sensor module has 4 pins VCC, GND, Digital Out, and Analog Out. We can either use the AO pin as an output for analog reading or the DO pin as an output for digital readout. In this module, we only have D0 Pin which is the digital output pin.
Circuit Diagram & Hardware Setup
The circuit for Voice Activated Light using Sound Sensor & Raspberry Pi Pico Board is given below.
Connect the Sound Sensor VCC, GND & Out pin to Raspberry Pi Pico 5V (VBUS), GND & GP0 Pin.
Similarly connect the R, G & B Pin of the RGB LED to Raspberry Pi Pico GP2, GP3 & GP4 Pin respectively. Connect the GND Pin of RGB LED to Pico GND Pin.
MicroPython Code/Program
Copy the following code and paste it into the Thonny Editor.
from
machine
import
Pin
PWM
from
utime
import
sleep_ms
sound
=
Pin
(
Pin
IN
Pin
PULL_DOWN
)
# Port internal pull-down
Led_R
=
PWM
(
Pin
(
)
)
Led_G
=
PWM
(
Pin
(
)
)
Led_B
=
PWM
(
Pin
(
)
)
Led_R
freq
(
2000
)
Led_G
freq
(
2000
)
Led_B
freq
(
2000
)
if
__name__
==
'__main__'
:
while
True
:
(
sound
value
(
)
)
if
sound
value
(
)
==
:
Led_R
duty_u16
(
65535
)
Led_G
duty_u16
(
65535
)
Led_B
duty_u16
(
65535
)
sleep_ms
(
2000
)
else
:
Led_R
duty_u16
(
)
Led_G
duty_u16
(
)
Led_B
duty_u16
(
)
Run the script and start testing the above-connected circuit.
When you clap near the sensor the LED will turn ON for 2 seconds. Then it will turn OFF. You can retest this multiple times.
In this guide, we will make a Voice Activated Light using a Sound Sensor & Raspberry Pi Pico Board.
The sound sensor detects the level change of the sound sensor through Raspberry Pi Pico. When the sound loudness is greater than the threshold, the sensor is triggered, and then the
RGB LED
is controlled to light up. Then the LED will automatically turn off after waiting for 3 seconds.
Components Required
In this guide, I used
Elecrow Raspberry Pi Pico Starter Kit
to test different Modules. You can buy the kit and perform some other operations as well. From this kit, you can use the following components.
1. Raspberry Pi Pico Board -1
2. Sound Sensor – 1
3. RGB LED Module – 1
4. Breadboard -1
5. Jumper Wires – 10
6. Micro-USB Cable
Sound Sensor
The sound sensor acts like a microphone, which is used to receive sound waves. The sensor has a built-in condenser electret microphone that is sensitive to sound. Sound waves make the electret film in the microphone vibrate, resulting in a change in capacitance and a small voltage corresponding to the change. This voltage is then converted into a 0-5V voltage, which is received by the data collector after A/D
conversion and transmitted to the microcontroller.
The Sound sensor module has 4 pins VCC, GND, Digital Out, and Analog Out. We can either use the AO pin as an output for analog reading or the DO pin as an output for digital readout. In this module, we only have D0 Pin which is the digital output pin.
Circuit Diagram & Hardware Setup
The circuit for Voice Activated Light using Sound Sensor & Raspberry Pi Pico Board is given below.
Connect the Sound Sensor VCC, GND & Out pin to Raspberry Pi Pico 5V (VBUS), GND & GP0 Pin.
Similarly connect the R, G & B Pin of the RGB LED to Raspberry Pi Pico GP2, GP3 & GP4 Pin respectively. Connect the GND Pin of RGB LED to Pico GND Pin.
MicroPython Code/Program
Copy the following code and paste it into the Thonny Editor.
from
machine
import
Pin
PWM
from
utime
import
sleep_ms
sound
=
Pin
(
Pin
IN
Pin
PULL_DOWN
)
# Port internal pull-down
Led_R
=
PWM
(
Pin
(
)
)
Led_G
=
PWM
(
Pin
(
)
)
Led_B
=
PWM
(
Pin
(
)
)
Led_R
freq
(
2000
)
Led_G
freq
(
2000
)
Led_B
freq
(
2000
)
if
__name__
==
'__main__'
:
while
True
:
(
sound
value
(
)
)
if
sound
value
(
)
==
:
Led_R
duty_u16
(
65535
)
Led_G
duty_u16
(
65535
)
Led_B
duty_u16
(
65535
)
sleep_ms
(
2000
)
else
:
Led_R
duty_u16
(
)
Led_G
duty_u16
(
)
Led_B
duty_u16
(
)
Run the script and start testing the above-connected circuit.
When you clap near the sensor the LED will turn ON for 2 seconds. Then it will turn OFF. You can retest this multiple times.
Technologies used
Hardware components
- Raspberry Pi
Software & tools
- Thonny
- MicroPython
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.