Create an immersive audio-visual experience with our DIY Music Reactive LED system, synchronizing captivating light displays to the beat of your favorite music using Arduino.
Devices and components
Arduino Uno Rev3
Breadboard 100x160
5mm base red LED
KY-037
Binding wire
Materials and tools
Screwdriver (various)
Software and tools
Arduino IDE
Project description
Connect me on
Introduction
Working on Basic
Usage
Prototype images
Arduino Feature:
Sound sensor operation:
LED Feature:
While downloading the code:
After downloading the code:
Watch the demo video
Upload this code to the Arduino board
1const int soundSensorPin = A0; // Analog pin connected to the sound sensor
2const int ledPins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; // Digital pins connected to the LEDs
3
4void setup() {
5 pinMode(soundSensorPin, INPUT);
6 for (int i = 0; i < 10; i++) {
7 pinMode(ledPins[i], OUTPUT); // Set the LED pins as outputs
8 }
9 Serial.begin(9600); // Initialize serial communication for debugging
10}
11
12void loop() {
13 int soundValue = analogRead(soundSensorPin); // Read the analog input value
14
15 for (int i = 0; i < 10; i++) {
16 int lowerBound = 70 + (i * 100);
17 int upperBound = lowerBound + 100;
18
19 if (soundValue >= lowerBound && soundValue < upperBound) {
20 for (int j = 0; j <= i; j++) {
21 digitalWrite(ledPins[j], HIGH); // Turn on the LEDs up to the current index
22 }
23 for (int k = i + 1; k < 10; k++) {
24 digitalWrite(ledPins[k], LOW); // Turn off the remaining LEDs
25 }
26 }
27 }
28
29}
Downloadable files
Circuit diagram
This will help you to Connect all wires
Circuit.png
Code.ino
Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.