Sound Sensor to Led (Arduino)
Hello in this tutorial I will be going through how to use a sound sensor to turn On an LED using an Arduino or UNO board.
Supplies
Materials:
- 5 male to male wires
- 3 female to male wires
- LED
- 220 ohm resistor
- Sound sensor
- Mini Bread board
- Power source (computer)
Assembly :
Use the provided diagram and photos to follow along
1. Place the LED on the board keeping note of the positive side, you will need to align the resistor to it. Then add a male to male wire that connects the resistor to the -3 slot on your uno board. The. Negative side of the LED will be connected to the ground option On your sound sensor followed directly by a wire to the ground slot on your Arduino.
2. Connect the OUT slot on your sound sensor to the board using an M to F. Wire followed by an M to M wire connected to the 5v slot on the Uno board. Finally, connect the VCC slot on your sound sensor to the 2 slot on the uno board.
3. Finally, connect the VCC slot on your sound sensor to the 2 slot on the uno board.
Code:
1. Open uno on your desktop and start a new sketch.
2. The sketch should start by identifying the integers. Because we connected the LED to the 3 on the Uno board, the int in the code for LED is 3 and the sound sensor is 2 for the same reason.
3. After that you need to identify the sound sensor value as one for your if statement because 1 identifies the sound being picked up. Then identify the digital write of the LED as High so it turns on or becomes higher when triggered ( you can change that through adjusting the sound sensor).
4. Your else statement should continue the common of the LED as LOW to allow the light to go off or become lower when no sound is detected.