Introduction: Arduino LED Audio Spectrum

Picture of Arduino LED Audio Spectrum

This is a guide using Arduino Uno to display the audio waveform of your music using a matrix of LEDs (Light emitting diodes).

Step 1: Gathering Your Materials

Picture of Gathering Your Materials

This is a list of all the materials you will need

1. Arduino Uno (or cheaper alternative)

2. Spectrum Shield (you may have to buy headers and solder them on yourself)

3. A Solder-less Bread Board

4. Wood

5. Solder

6. A bunch of Wires

7. LED's and Resistors (I used these, The number of LED's may vary depending on how many rows and columns you want)

Step 2: Gathering Your Tools

Picture of Gathering Your Tools

It is important to use the right tools! This is a list of the tools you will need

1. A drill

2. A 3/16 Drill Bit

3. A Soldering Iron

4. long nose Pliers (To easily bend wires while working with soldering iron)

5. Wire Strippers/cutters

6. Some type of saw to cut the wood (I used a round-saw)

7. Two clamp bars (optional: to hold down wood)

8. A right angle ruler to measure the wood (ruler will work)

9. A pen to mark the wood

10. And of course a computer to program the Arduino using the Arduino Software

Step 3: Wood Block

Picture of Wood Block

In this guide I will be making a 7 by 5 LED Matrix

7 columns, 5 rows = 35(7 * 5) LEDs and 12(7 + 5) pins

The more columns and rows you put into your matrix: the more pins you will need.

For this project there are 13 available pins so the sum of your rows and columns should not exceed 13.

Each LED should be 15mm apart from each other to ensure easy soldering

The matrix will be 90mm by 60mm we will add a 40mm margin to all sides

  1. So cut a piece of wood out that is 170mm(17cm) by 140mm(14cm)
  2. Now using a ruler and a pen draw the 90mm by 60mm grid
  3. Drill a hole through each point using the 3/16 drill bit
  4. after you drill you may want to sand it down
  5. You can paint or stain the wood (I stained mine to give it a darker color)

Step 4: LED Matrix

Picture of LED Matrix



1. Flip your block of wood over and put an LED in each hole place each LED so that the ground pin is directed toward the bottom left corner of the wood piece.
2. Bend each ground pin straight down, make sure the ground pins are not overlapping any power pins.
3. Now bend all the power pins to the right
4. Solder all the ground pins together
5. Bend the power pins so they will not touch the ground pins and solder them together.
6. Double check to make sure no ground pin is touching a power pin!
7. If you are using hook up wire like I am, cut and strip wires for each row and column long enough to reach the Arduino
8. Solder the wires together

Step 5: Connecting Your LED Matrix to Your Arduino

Picture of Connecting Your LED Matrix to Your Arduino
  1. Connect your Spectrum Shield to your Arduino
  2. Connect row 1 wire to digital pin 6 and row 2-5 wires to Analog pins 2-5
  3. Connect columns 1-7 to the breadboard through resistors and to the Arduino digital pins 7-13
  4. Run this code to make sure all of your LEDs work, I had to swap some out

  5. Run this code I made using Multiplexing to light up to audio

Step 6: Playing Music

Picture of Playing Music

Use an auxiliary cord to connect your shield to any device that has an aux jack(smart phone, computer, ipod, etc)

Then use another auxiliary cord to output to speakers or plug in headphones!

I have the older DEV-10306 - Spectrum shield so both my auxiliary jacks can be used as input or output.

The newer model should specify which aux jack is input and output on the board.

You can use a 9v battery and take the LED matrix anywhere!

Comments

CalebH55 made it! (author)2017-04-20

I made this as an addition to a project for one of my Electrical Engineering projects.

The assignment was to create a speaker (as seen in the pictures). I decided to use this instructable to make an Audio Spectrum Display in the center of my speaker. It turned out fantastic! I attached a couple pictures of the process, as well as a video of the finished product! While creating it I learned a couple things:

I did not need resistors for my LED's, adding them just dimmed the light.

The Arduino needs to be grounded to the same thing the speakers and aux are.

The code provided does not account for noise in the system.

So, I re-wrote the code. I also attached my version. It is very close to the same, but as it sets up, it reads some reference values. It then bases the display off of those. Basically, it teaches the Arduino to ignore the noise.

If you have any questions, feel free to ask!

And thanks for this great instructable aprice!

aprice27 (author)CalebH552017-04-24

Awesome!!! I love your system noise fix! :D

CalebH55 (author)aprice272017-09-21

Thank you!

TravisS114 (author)CalebH552017-08-11

For some reason I can't see your code, there's just a hand picture when I scroll through the pictures.

CalebH55 (author)TravisS1142017-09-21

Travis, it looks like Instructables stopped allowing code to be uploaded. Sorry about that! I'll copy it below:

"

/*

by Ody

12-2015

Edited by Caleb

04-2017

*/

int colpin1 = 7;

int colpin2 = 8;

int colpin3 = 9;

int colpin4 = 10;

int colpin5 = 11;

int colpin6 = 12;

int colpin7 = 13;

int rowpin1 = 6;

int rowpin2 = A2;

int rowpin3 = A3;

int rowpin4 = A4;

int rowpin5 = A5;

int strobe = 4; // strobe pins on digital 4

int res = 5; // reset pins on digital 5

int left[7]; // store band values in this array

int low[7]; // store the min values read here

int store;

int band;

// this runs once, to initalize

void setup()

{

Serial.begin(115200);

pinMode(res, OUTPUT); // reset

pinMode(strobe, OUTPUT); // strobe

delay(4);

// read the initial values

for (band = 0; band < 7; band++)

{

digitalWrite(strobe, LOW); // strobe pin on the shield - kicks the IC up to the next band

delayMicroseconds(30); //

low[band] = analogRead(0); // store left band reading

digitalWrite(strobe, HIGH);

}

// use if you want to see what your min values are

// for (band = 0; band < 7; band++)

// {

// Serial.print(low[band]);

// Serial.print(" ");

// }

// Serial.println(" - low ");

readMSGEQ7();

// initalize the pins

pinMode(colpin1, OUTPUT);

pinMode(colpin2, OUTPUT);

pinMode(colpin3, OUTPUT);

pinMode(colpin4, OUTPUT);

pinMode(colpin5, OUTPUT);

pinMode(colpin6, OUTPUT);

pinMode(colpin7, OUTPUT);

pinMode(rowpin1, OUTPUT);

pinMode(rowpin2, OUTPUT);

pinMode(rowpin3, OUTPUT);

pinMode(rowpin4, OUTPUT);

pinMode(rowpin5, OUTPUT);

digitalWrite(res, LOW); // reset low

digitalWrite(strobe, HIGH); //pin 5 is RESET on the shield

}

// this runs continually. The shorter it is, the quicker the code loops

void loop()

{

readMSGEQ7();

/*// to display values of left channel on serial monitor

for (band = 0; band < 7; band++)

{

Serial.print(left[band]);

Serial.print(" ");

}

Serial.println(" - Left ");

*/

spec(colpin1, left[0], 0);

spec(colpin2, left[1], 1);

spec(colpin3, left[2], 2);

spec(colpin4, left[3], 3);

spec(colpin5, left[4], 4);

spec(colpin6, left[5], 5);

spec(colpin7, left[6], 6);

}

void readMSGEQ7()

// Function to read 7 band equalizers

{

digitalWrite(res, HIGH);

digitalWrite(res, LOW);

for (band = 0; band < 7; band++)

{

digitalWrite(strobe, LOW); // strobe pin on the shield - kicks the IC up to the next band

delayMicroseconds(30); //

left[band] = analogRead(0); // store left band reading

// NOTE: just needs left or right for reference. So we just track one.

digitalWrite(strobe, HIGH);

}

}

// function that lights a column depending on height

void spec(int col, int height, int band)

{

digitalWrite(col, LOW);

//for height

// if you want your LED's to be more or less sensitive, this is what you adjust.

if (height > (low[band] + 5))

{

digitalWrite(rowpin1, HIGH);

}

if (height > (low[band] + 10))

{

digitalWrite(rowpin2, HIGH);

}

if (height > (low[band] + 15))

{

digitalWrite(rowpin3, HIGH);

}

if (height > (low[band] + 50))

{

digitalWrite(rowpin4, HIGH);

}

if (height > (low[band] + 100))

{

digitalWrite(rowpin5, HIGH);

}

//default back to off

delay(2);

digitalWrite(colpin1, HIGH);

digitalWrite(colpin2, HIGH);

digitalWrite(colpin3, HIGH);

digitalWrite(colpin4, HIGH);

digitalWrite(colpin5, HIGH);

digitalWrite(colpin6, HIGH);

digitalWrite(colpin7, HIGH);

digitalWrite(rowpin1, LOW);

digitalWrite(rowpin2, LOW);

digitalWrite(rowpin3, LOW);

digitalWrite(rowpin4, LOW);

digitalWrite(rowpin5, LOW);

}

"

Enjoy!

TravisS114 (author)2017-08-12

Are the other leds getting power bled over to them or is light bleeding over? Noticeable when one line spikes high then a few leds in the nearest line look to be slightly lighting up.

CalebH55 (author)2017-04-05

Hey there, this project looks awesome! I plan on using it to put the spectrum display in between two speakers in a custom box. The tutorial is very thorough, but I am missing one thing. What value resistors did you use? Thanks!

aprice27 (author)CalebH552017-04-19

I used 200 ohm resistors

vanderkieft (author)2017-01-18

Hi, I have followed your tutorial 100%. I have made everything, connected everything and copied your code in my software. Though nothing happends. My leds only light up and dont respond to the music I play through my laptop. I need help

KristianS26 (author)2017-01-03

Hello,

i have the Problem with the LEDs. I don´t have started the music, but the first 2 rows are lighten up and go on and off. When I started the Music then it works only the 3 rows above very well. (Sorry for my bad Englisch) I hope you can help me.

WallyWorld23 (author)2016-05-19

Has anyone tried making this with RGB LED's? Would be awesome.

aprice27 (author)WallyWorld232016-05-31

That would be cool I've been looking into doing just that. You would need more pins and would have to use shift registers!

RoseT16 (author)2016-05-05

Hi, I am making this project for a class but i've run into a few difficulties. I've created the matrix and it receives power the problem I have with the matrix is that for the row that goes into digital 6 doesn't light up when i run the test code. But it lights up if i put it in another digital pin such as digital pin 3. Should I switch it and put it in the 3 instead? Also when i run the audio code all the LEDS come on with no movement is there something I can change to fix that?

aprice27 (author)RoseT162016-05-31

Hi! I am unsure what is causing row 6 to not light up! By all means use pin 3 if 6 isn't working. If all the LEDs come on when playing audio that may mean that your audio might be too loud. Try changing the hard coded numbers in the if statements in function void spec(int col, int height) to larger numbers

if (height > 73) // change 73 to some bigger number

{ // you can use the serial monitor to find the minimum number for first row

digitalWrite(rowpin1, HIGH);

}

I recommenced you watch the video in step 5

pachytrance (author)2016-02-06

Great job!!!! Thanks for sharing. I'll do it for my bedroom in a big scale.

ProgressiveH (author)2016-01-06

iw noticed that your shield has Soldered audio in L G R, i have new shield so im curious if i have to do it to, if so, how? :) also iw noticed that you use Solder-less Bread Board but in step 6 you connected directly (when you put it in your EQ box) why so? :)

aprice27 (author)ProgressiveH2016-01-10

When I got the shield I had some old speakers laying around so I used the LGR pins to connect them directly. It turned out those speakers weren't very good so I decided to use the auxiliary output instead. You won't have to use LGR.

I had made two models the first was the version with the breadboard the second I tried to make like a "finished product" and soldered the resistors and wires on directly so I could use the other wires and breadboard for other projects.

ProgressiveH (author)aprice272016-01-10

cool mate, thanks for reply, i should get missing parts tomorrow and start the project! :)

SocorroL (author)2015-11-19

has anyone done this project and actually works?

I
did this project and the code provided doesnt make the design shown on
the video, the leds just goes up and down, it doesnt get split by
frequencies

I have tried a lot of things to fix the code but i cant get it to look like that

aprice27 (author)SocorroL2015-11-29

It works. However the code can be tricky I'm going to make a video explaining the code and multiplexing when schools out during winter break you want to make sure that all your leds work and that no row wires are touching column wires

SocorroL (author)aprice272015-12-02

yea I tested the leds by using the 7x5test code and all the leds turn on ,so that means they all work, I even bought the same leds you did. And i triple checked the row wires are not touching column wires i even put those little tubes that are left when you strip a wire to protect them

aprice27 (author)SocorroL2016-01-01

It might be the volume levels try turning the volume up or changing values in the spec function

I just put up a video in step 5 along with a schematic check it out it may help

OculumForamen (author)2015-11-15

I'd like to know the artist and song that you played in your video.

aprice27 (author)OculumForamen2015-11-29

The song is Shark by Oh Wonder (Illenium Remix)

OculumForamen (author)aprice272015-11-30

Thanks so much for letting me know

Jonathon

JosiahS4 (author)2015-11-03

Is there a way that I can invert the output to the led's so they are inverted..like this

https://www.youtube.com/watch?v=OZyQ-g3klVU

aprice27 (author)JosiahS42015-11-29

Yes on step 5 just # 2 instead of Connecting row 1 wire to digital pin 6 and row 2-5 wires to Analog pins 2-5 just do the reverse:

Connect row 5 wire to digital pin 6

then row 4 to analog 2

3 to analog 3

2 to analog 4

1 to analog 5

or just flip the board

MakeTogether (author)2015-11-11

Hi,

This is awesome!!

I am also interested in sound visualization.

After trying this one, I will share it.

Joao VitorM1 (author)2015-10-08

We are doing a project based on her, but the LEDs are literally crazy as each band is analyzed not by itself but all doing the same movement together. HELP US !!

MagnusNinja (author)2015-05-05

Hello, I am Currently making this Instructable right now and i am having some issues. Instead of the 7x5 that you have made I changed it to a 6x7 grid of LED's. I don't know if this could be the problem or anything but I changed the Code to the way I had Hooked it up to our Arduino with our Spectrum Shield and whenever I try to assign a row to A0 it turns every light off. Is there a reason for this? And instead of a column going up and down the full rows turn off and on. When i look in the serial monitor as well I get a bunch of gibberish http://gyazo.com/8b721168f4ba74c6d52e497b731ad65f

If you could help that would be great!

aprice27 (author)MagnusNinja2015-05-12

also I used Serial.begin(115200);

make sure the baud in the serial monitor matches this number: 115200

aprice27 (author)MagnusNinja2015-05-12

The Spectrum Shield uses anolog pins 0 and 1 to retrieve the audio band values that it gets from the left and right MSGEQ7s

The board has two MSGEQ7 ICs and we are only really using one of them: Analog pin 0. You can use Anolog pin 1 for other purposes since we don't really need the second ic to access it

So in the code in the "void readMSGEQ7()" function comment out this line of code:

right[band] = analogRead(1); // ... and the right

comment it out by putting two forward slashes so that it looks like this

// right[band] = analogRead(1); // ... and the right

now feel free to use this pin for your extra led row/column

I would have to see your code to see why the rows are turning off and on.

The MSGEQ splits the audio into 7 bands that is why I have 7 columns.

If you wanted to make your led matrix bigger you will need more pins. That means you would have to use shift registers!

Send me your code and I will take a look at it: anwepr24@gmail.com

I'm sorry I didn't get back to you sooner

harithal1 (author)2015-04-13

sir i could not find the spectrum shield or the msgqe7 ic

can you please provide me another alternative

please reply asap

aprice27 (author)harithal12015-04-13

This guide centers around the MSGEQ7 Shield, I don't currently know of any alternative.

If you don't want to buy the shield you can buy the MSGEQ7 and build your own circuit around. Here is the data sheet. I would recommend you buy the shield unless you understand circuit schematics.

The Spectrum Shield can be found on the spark fun website:

https://www.sparkfun.com/products/13116

or Microcontroller shop website:

http://microcontrollershop.com/product_info.php?pr...

fdelamora86 (author)2015-04-06

any recommendations for adding some basic speakers to this?

Killshot52 (author)2015-04-06

OMG SHARK ILLENIUM REMIX

amberrayh (author)2015-04-06

Great job on your first Instructable! I really like the clean look of your little wooden audio-wave form light-show thingy. Thanks for sharing!

About This Instructable

26,973views

239favorites

License:

Bio: Youtube: http://www.youtube.com/user/s293pqrn
More by aprice27:Arduino LED Audio Spectrum
Add instructable to: