Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

How To Make DIY Music Visualizer using Arduino & Sound Sensor by WTC Zone

 How To Make DIY Music Visualizer using Arduino & Sound Sensor by WTC Zone


Creating a music-reactive LED project using an Arduino Uno, a microphone module, and colorful LEDs is a fantastic and fun project. Here's the complete breakdown of the circuit, parts, connections, and code.


Parts Required

  1. Arduino Uno R3 - 1 unit
  2. Colorful LEDs (9 or more) - Different colors
  3. Microphone Sound Sensor Module (e.g., KY-038 or LM393) - 1 unit
  4. Resistors (220 ohm) - 9 units (one for each LED)
  5. Connecting Wires
  6. Breadboard - 1 unit
  7. USB Cable (for programming the Arduino) - 1 unit
  8. Power Source (optional, if not connected via USB)

Circuit Connections

  1. Microphone Sound Sensor Module:

    • VCC → Arduino 5V
    • GND → Arduino GND
    • OUT → Arduino A0
  2. 9 LEDs:

    • LED 1 → Arduino Pin 3
    • LED 2 → Arduino Pin 4
    • LED 3 → Arduino Pin 5
    • LED 4 → Arduino Pin 6
    • LED 5 → Arduino Pin 7
    • LED 6 → Arduino Pin 8
    • LED 7 → Arduino Pin 9
    • LED 8 → Arduino Pin 10
    • LED 9 → Arduino Pin 11
    • Each LED’s negative leg → Resistor → Arduino GND

Working Principle

  1. The microphone module detects sound intensity in the environment.
  2. The output voltage of the microphone changes based on the sound intensity.
  3. The Arduino reads this voltage using the analog pin A0.
  4. Depending on the voltage level, different LEDs are turned ON/OFF, creating a visual effect that corresponds to the music's rhythm and beats.

The Arduino Uno will send HIGH and LOW signals to each relay in a specific sequence, causing each relay to click in turn. Different delays between each relay activation create a varied rhythm. We’ll program some example rhythms you can modify as desired.

Video Link: - Click Here For Video

How To Make DIY Music Visualizer using Arduino & Sound Sensor by WTC Zone simple Circuit: -



How To Make DIY Music Visualizer using Arduino & Sound Sensor by WTC ZoneArduino Programming: -

Arduino IDE Program

Code for DIY Music Visualizer using Arduino & Sound Sensor by WTC Zone

// Define LED pins from D3 to D11
const int ledPins[] = {3, 4, 5, 6, 7, 8, 9, 10, 11};
const int micPin = A0;   // Microphone sensor connected to A0
const int numLEDs = 9;   // Total number of LEDs

void setup() {
  // Set LED pins as OUTPUT
  for (int i = 0; i < numLEDs; i++) {
    pinMode(ledPins[i], OUTPUT);
  }

  // Initialize Serial Monitor (optional for debugging)
  Serial.begin(9600);
}

void loop() {
  int soundLevel = analogRead(micPin); // Read sound intensity from mic sensor
 
  // Normalize sound level to a range of 0 to 1023 (optional for debugging)
  Serial.println(soundLevel);

  // Map sound intensity to the range of LED indexes
  int ledsToLight = map(soundLevel, 0, 1023, 0, numLEDs);

  // Turn on LEDs according to the mapped intensity
  for (int i = 0; i < numLEDs; i++) {
    if (i < ledsToLight) {
      digitalWrite(ledPins[i], HIGH); // Turn ON LED
    } else {
      digitalWrite(ledPins[i], LOW);  // Turn OFF LED
    }
  }

  delay(50); // Add a small delay for smooth effect
}


-----------------------------------------------------------------------------------------------------------------------------

Description

  1. LED Pin Setup:

    • LEDs are connected to pins D3 to D11 on the Arduino.
    • These pins are defined in the ledPins[] array, which the code iterates through.
  2. Sound Sensor:

    • The microphone/sound sensor is connected to the analog pin A0.
    • The sensor's output (soundLevel) is read and mapped to the range of available LEDs (0–9).
  3. LED Glowing Effect:

    • The map() function scales the sound intensity (0–1023) to the number of LEDs (0–9).
    • LEDs light up incrementally as sound intensity increases, starting from D3 for low beats to D11 for high beats.
  4. Dynamic Visualizer:

    • As the music beats rise and fall, the LEDs light up or turn off, creating a bar-like visualizer effect.

How It Works

  • Low Beats: Only LEDs near D3 light up.
  • Moderate Beats: LEDs in the middle (e.g., D5–D7) glow.
  • High Beats: All LEDs up to D11 turn on.

Circuit Connections

  1. Sound Sensor:

    • VCC → Arduino 5V
    • GND → Arduino GND
    • OUT → Arduino A0
  2. LEDs:

    • Each LED's positive leg connects to pins D3 through D11.
    • Each LED's negative leg connects to GND via a 220-ohm resistor.

Customization

  • Adjust the delay(50) for faster or slower transitions.
  • Change the mapping range in the map() function to fine-tune how LEDs respond to sound intensity.

This setup creates a satisfying music visualizer effect where LEDs glow according to the intensity of the sound, ranging from low beats to high beats! 🎵✨ 

Share, Support, and Subscribe!!! 1. PRO KAM EXPLAINED 2. Knowledge KAM 3. PRO KAM Follow us on 1. Facebook 2. Instagram 3. Pinterest 4. Blogspot 5 Twitter If you have any other ideas to make me design, you can describe them in the comment section and if I can, I will make a designing video on it. So I am waiting #prokam #wtc #Arduino #ideas #projects #diy #how #to #ArduinoProjects #UltrasonicSensor #HeightMeasurement #TechDIY #WeTechCreators

Post a Comment

0 Comments

Ad Code

Responsive Advertisement