A Simple Audio Visualizer With RGB LEDs

by Applexanand in Circuits > Arduino

1090 Views, 2 Favorites, 0 Comments

A Simple Audio Visualizer With RGB LEDs

IMG_1943.jpg

Hello again!

First of all thank you so much for the support you guys gave to my first Instructable. This motivated me to publish my second Instructable, the miniature audio visualizer. But before we talk about my project, let us talk a little bit about audio/music visualization

According to Wikipedia, music visualization "generates animated imagery based on a piece of music. The imagery is generated and rendered in real time and is synchronized with the music we play."

Music visualization is greatly seen on EDM concerts, where artists team up with VJs (or video jockeys) to create visual spectacles, that can attract and mesmerize the audience. This can be done with video editing and effects software such as Davinci Resolve Fusion and Adobe After Effects. However, this can also be achieved using hardware.

Now, let us talk about my project.

The audio visualizer which I am gonna show a few sections later, is one of the simplest audio visualizer you can find, and we are adding a spoonful of magic dust in it too, which we call RGB Lighting

The advantages of this kind of audio visualizer is that it can be programmed the way you want the lights to glow. In my case I have two modes of operation, but more on that later

So buckle up, get your laptop and tools, and get ready as we head on to the market for supplies

Supplies

Now, let's head on to the market and look for the following components

  • RGB LED Lights (Preferably two terminal LED diodes)
  • Arduino UNO
  • 1k Resistors (Quantity depends on how many RGB lights are being used)
  • Bread board
  • Jumper Cables
  • Sound Sensor Module

You can head on to the nearest electronics shop and buy the above mentioned components, or if you feel lazy enough, you can order them from Amazon or any online shopping app.

Connecting Each Component

circuit-audio visualiser.png

One LED and resistor are going to be connected in series. Make at least 12 series LED-resistor connections

Each LED-resistor connection will be connected to a digital pin on the Arduino UNO (one pin for each LED-resistor connection). Once connected, we need to connect our Sound Sensor. Connect the A0 pin to A0 of Arduino, + (or Vin) pin to +5V of the Arduino, and finally, the G (or GND) pi to GND of the Arduino UNO.

There are three GND pins in the UNO, two in the Power section and one in the Digital section. You can use any of the three GND pins.

There it is! Our hardware is done. The connection is really simple, so it won't take much time. Because of this simple connection, anyone can build and deploy this circuit.

Now here comes the good part. Adding the code to the Arduino

Programming the Arduino

I have prepared two codes for the same circuit. You can choose any one you like

The code will definitely work if you have been following all my steps carefully

For first timers, here is how you upload the code from the computer to the Arduino. For experts, you know what to do.

To upload the code, go to the Arduino IDE software on your PC. Connect your UNO via USB cable, and select the port where the UNO is connected to.
Once the above step is done, upload the code (You can see a right arrow at the top left part of your screen, assuming you put the IDE at full screen. This button is the Upload button. Click on it)

Once it is done uploading, you can test the visualizer by putting the sensor (or microphone near to a speaker).

If you have an Android phone, you can upload your code from there as well. Connect the Arduino UNO to your mobile via an OTG cable, and open the Arduino app. The rest of the steps are similar to what was shown above.

To power the Arduino UNO you can use a battery bank and connect to the 5V input, or you can keep it connected to the laptop, PC or mobile phone.

If Everything Goes Right or Wrong

Once you have uploaded the code to the Arduino, place the microphone (sound sensor) near a speaker and check the lights. If the lights are not glowing or glowing too much, do not worry! All of them can be fixed.

Open the serial monitor, located at the top right corner of the IDE. There you can see the analog value of the input you are receiving. If the analog values are less than the lowest reference analog value (here it is 250, see the code for understanding), the lights will not turn ON. However, if the analog values are higher than the highest reference analog value (here it is 260), then all the lights will turn ON.

The pins 2 - 13 are divided into pin groups of two, with each pin group having a fixed reference analog value. When the analog values are higher than the reference values, the pin groups will illuminate the LEDs, otherwise it remains OFF.

To adjust the analog values (not the reference values), turn the potentiometer knob present in the sound sensor. This potentiometer is used to adjust the sensitivity of the sensor.

In other words, we have to adjust the sensitivity to obtain the proper output.

Yes It Works!

Simplest Arduino Audio Visualizer Demonstration

If you want to see how the result has turned out, click on the video.

Now once you have confirmed that your audio visualizer is working, enclose it in a semi-transparent or translucent box. This will help diffuse the light at a farther distance (I did not do it since I upgrade the setup constantly, and also I am lazy enough to create a beautiful design)

It's Time to Say Goodbye

IMG_2515.jpg

And with this, our project is complete.

This project can be utilized to build a separate module to attach to Bluetooth speakers, to act as a cool audio visualizer. Another sound sensor can also be incorporated, to distinguish the bass from sound (Here in my project, I used one sound sensor to identify the treble).

Try this project and see for yourself. I hope to hear from all of you in the comments section

Peace and Quiet