Table of Contents
Introduction
Hey guys, welcome back to Techatronic. In this article, we are going to show you that how you can make your own music reactive LED using an Arduino microcontroller.
The sound sensor mode that we are using has three pins out of the two are for the power supply and one is for output. For your convenience code and circuit diagram are given below. You can also read more articles on Arduino and IoT written by us.
Description
- All the LEDs are connected in parallel with each other and there is a 220 ohms resistor to protect them from getting fuse.
- When you make the sound near the mic then the output values start increasing and the LEDs will glow with higher intensity.
- For low sounds, the sensor produces low output values which result in the performance of the LEDs.
- When you play some audio near the mic of the sensor then the intensity of the LEDs will increase or decrease based on the loudness of the audio.
- The response time of the circuit is very quick.
- You can also check the clap switch with Arduino and KY-038 sensor made by us.
Components Required
- Arduino UNO
- Sound sensor
- Jumper wires and a breadboard
- LEDs of same color
- 220 ohm resistor
- USB cable for uploading the code
Circuit for Music Reactive LED
Arduino UNO | Sound Sensor | |
A0 Pin | OUT Pin | |
+5 Volt | VCC | |
GND | GND | |
Arduino UNO | LEDs | 220 Ohm Resistor |
A 1 Pin | Anode Terminal | |
GND | Terminal 1 | |
Cathode Terminal | Terminal 2 |
- If you are not famalier with the interfacing of the sound sensor with an Arduino UNO then please go through it first.
- Take a sound sensor module and connect its VCC pin with the 5V pin of the Arduino.
- Then join its GND pin with the GND pin of the Arduino.
- Attach the OUT pin of the sensor with the analog-0 pin of the Arduino.
- Join the negative legs of the LEDs together and then connect it to the GND pin of the Arduino via a 220 ohm resistor.
- At last, attach the positive legs of all the LEDs together and then connect them with the analog-1 pin of the Arduino.
- Use the breadboard for making connections with the LEDs so they can stand still. Your circuit is now ready to use.
PCBWay PCB Prototyping Services
I have assembled the whole circuit on a breadboard. As you know breadboard assembly is not effective for this type of projects. So, PCBWay offers Rapid PCB Prototyping for Your Research Work. I personally, recommend PCBWay because you can get your first-try boards right in 24 hours!
The prototyping stage is the most critical period of time for engineers, students, and hobbyists. PCBWay not only makes your boards quick but also makes your job right as well as cost-effective. This greatly reduces your cost and shortens the time for developing your electronic products.
PCBWay can provide 2 Layer PCBs to highly advanced HDI and flex boards. Even though the PCBs they produce differ a lot regarding functionality and areas of use. I am impressed with the quality of the boards, the delivery time, and the cost-effectiveness
Code for Music Reactive LED
NOTE: Please upload the code which is given below to the Arduino.
// TECHATRONIC.COM
int val;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val=analogRead(A0); // Sound Sensor connect A0 pin
Serial.println(val);
delay(50);
val=map(val, 0, 1023 , 0, 225); // LED Connect to A1 Pin
analogWrite(A1, val); // led connect A1 pin
}
We hope that you liked this music reactive LED project that we made using a sound sensor and Arduino. Please try to make it now on your own and if you have any doubts regarding this project then feel free to use the comments section given below. Also, do check out more projects on Arduino and Raspberry Pi.
Thanks for reading.