7 band spectrum analyzer using msgeq7 and lm3915

Hi all,

I’m still very new to Arduino and have very limited coding experience. I have looked all over the interweb and keep finding completed projects like the one i want to do but no one has put schematics or code online for me to experiment with.

I’m trying to build a 7 band spectrum analyzer for a Cmoy headphone amplifier using an msgeq7 chip to split the frequency into 7 bands and lm3915 chips to drive the LED’s. I have all the components working using SKOBA’s tutorial on the msgeq7 and can display the RAW audio in signal (not yet split) using one lm3915 and a 10 led array (looks pretty too). Ive also used two lm3915’s and two led arrays to display right and left channels (this also looks pretty dang cool).

Check it out (This is just raw audio, no msgeq7 or Arduino)

My question is…

How do i take the 7 different bands off the msgeq7 (using SKOBA’s tutorial) and write each separate band to a different pin on the Arduino so that each pin/frequency is driving its own lm3915?

Is this possible? Is this the easiest way to do it? Remember… I’m still very new to coding so the simpler the better.



There is easier way:


Default value 32 band, adjustable simply combining few bands in a group.
In the project 3 group, 10 or 11 bands each.

And lm3915 "implemented" in the code, for UNO board only 4 levels possible w/o using analog port,
Mega or multiplexing chips would be necessary for more levels, let say 10 or 20.

The other question here is what you want the result to look like... Your demo (well done!) just shows pre-attenuated audio amplitude being shown on the graphs. Are you looking at making 7 (or 14) graphs for this? Would you like to cycle through them and show different spectra on the same two? What's the end game on this? I have a pretty solid background on the MSGEQ7 and the Arduino, and prefer it to the FFT method, though that's always been because I need better resolution than FFT provides (on the slow Arduino processor).

If you DO need 14 outputs, perhaps you should look at the TI TLC5940 (TLC 5940 - PWM Driver - COM-10136 - SparkFun Electronics). It takes three or so pins then deftly handles 16 outputs with constant current control so that you won't damage your LEDs. I'm not EASILY seeing any current limiting device in your video, so that's a big thing to fix unless I'm just missing it - I'm essentially blind.


Thanks for your reply! That certainly is a nice little colour organ! Unfortunately, after looking at the code that was used i started to feel dizzy! ha! I'm still very new to this and the road I've been going down so far seems to click a bit better for me. I still like the idea though so will definitely have a go at your method after i get this working!


You seem to be thinking along the same lines as me. You're right, the audio I'm using at the moment is coming straight out of the Ipod headphone jack (I'm just taking it from the amplifier input). This of course means that it depends on the volume of the ipod. I have some ipod plugs on the way from the netherlands which will allow me to take a line out feed directly from the bottom of the ipod.

At the moment I'm planning on just seven bar graphs, one for each frequency from the MSGEQ7. Is there a way to expand those seven frequencies from the MSGEQ7 into more? If so, i would like to eventually display a larger spectrum.

The TI TLC5940 you suggest appears to add PWM pins to the Arduino. Is this correct? My understanding is that the analog signals coming from the MSGEQ7 cant be reproduced through PWM.

The LM3915 requires just one limiting resistor to program the LED current. The rest is done internally :0) I'm using a 180 ohm resistor with a 5v supply.

Now...... with all that said, after posting this yesterday, i emailed the link to a friend who had a look and immediately sent me 2 options for achieving the result I'm after. He quickly "whipped up" some code and gave me a rundown of how to wire the circuit. In theory, it sounds perfect and after posting this I'm heading down to Jaycar to get some parts.

The idea is basically to use one LM3915 to drive seven multiplexed LED bar graphs. I always thought i'd need one LM3915 for each bar graph. Anyway, the Arduino would simply be used as a timer to signal the strobe and reset on the MSGEQ7 and to switch a transistor on each of the led bar graphs in sequence therefore allowing only one bar graph to display at a time.

Ive already tried this with two bargraphs on the breadboard and it seems to work well. Once i get the parts I'll wire it up, take a video and post the results.

The other option floated was to use a 555 timer and a decade counter to switch the transistors eliminating the need for an Arduino. This would be a preferable option if i was to box this project up! Would hate to hide my Arduino away in a dark box out of sight!

Once again thanks for your help guys! I've been kind of on the right road but just need that helping hand that only experience can give.

Once i get it up and running i'll post the results!

So, as promised, here is my progress.

Sorry about the quality. This was filmed very late at night after i finally got it working. It's very temperamental.

As you can see, the first bar graph doesn't behave the same as the other 6 and when the music is paused, all LED's go out except for the bottom 2 in each bar. Also, when i remove the audio plug all together from the 3.5mm socket, the bar graphs all jump to about 7 or 8 Led's lit. This is with no signal at all. I'm not sure why this is and requires some investigation.

It is all being kept in time by an Arduino mini running a simple timing code to fire the strobe and reset of the msgeq7 and each transistor that switches the LED bars on.

If anyone has any suggestions on how to stop the LED's being lit with no audio or how to stop the slight flicker while it's running, I'd love to hear them.

Cheers all

Hey there, nice work!
I am working on a similar type of project. did you use the exact hardware set up in that tutorial? I have mine set up that way and it is not working at all. I get constant analog reads of almost 1000 at each band, even when input is grounded... Did you ever run into this sort of problem? It has me scratching my head pretty intensely...

[EDIT] It is basically behaving as if the A0 pin were plugged into nothing, with a bit of drop from VCC, as if the chip is not doing anything... I am stumped... Any ideas are appreciated.

Hi there. Thanks for the kudos.

Yes I am using the exact same hardware setup in the tutorial. No different! I did come across that problem once or twice during my messing around and although I can't remember specifically what was causing it, it basically came down to checking and re-checking the schematic. You've almost certainly just missed grounding one of the pins or something along those lines.

Once i had finished building the board in the above video, for the life of me, i couldn't get it to work. Upon closer inspection, i hadn't grounded pins 6 and 2. Rookie mistake i know, but easily fixed.

Once you have your project up and running please post i video. I'd love to see what you're up to.


and you are using all ceramic caps?

Yes, all ceramic caps. Can you post a pic of your setup?

Here is my circuit:

I'm beginning to maybe think that some of my cap values must be wrong or something?? I hope you can find something wrong! Thanks for your help.

Well i can't immediately see anything wrong with that but i'm certainly no expert.

I've only used ceramic caps like your 33pf cap so the other ones you're using are unfamiliar to me. Your two 100nf caps and 10nf cap all look like different types. Are you sure they're the correct values? Also, are you sure there's + and - getting to both of the power rails i.e are all the pins actually being grounded or receiving power correctly? Try grounding the audio input using the same ground rail you're using for the chip.

The only other thing i can think of is if you have another chip, try swapping them

If none of these things work then I'm afraid I'm out of ideas!

Hopefully someone else reading this thread might have some more suggestions.

...This is with no signal at all. I'm not sure why this is and requires some investigation.
If anyone has any suggestions on how to stop the LED's being lit with no audio or how to stop the slight flicker while it's running, I'd love to hear them.

remember that the MSGEQ7 has a ~20dB gain internally. It's going to amplify the great cosmic void and dutifully hand out the output. When you turn off your music, you'll need to implement a clamping mechanism that will halt the display of the output from the MSGEQ7 when the music isn't playing. I've spoken with the chip's designer abut this a few times, and that's the recommended solution.

Hmmmm. Thanks Brucethehoon. I was afraid of that. Is there an easy way of doing that or is it more trouble than it's worth?

I'm going to start by rebuilding the board and ensuring that the input and output don't cross each other or the power and ground rails. Hopefully this will at least reduce some of the interference.


Fast version because i need to get up inroughly 4 hours:
You can to this easily if you have a stereo jack that has a NC shunt or similar. Google away on that. Essentially, you only turn on output when there is a plug in the jack and you can detect that based on the type of jack you use.

There are a dozen other ways, this is the fast one.

Bed time!

Good one. Thanks for that. Looks like I'll be spending some quality time with my pal google!


So this is the final version. Working exactly how i want it to.

I adjusted the lower range of the LM3915 LED driver so it no longer displays the lower frequency noise from the MSGEQ7. As you can see when i pause the music there's no more flicker.

The first bar graph now behaves as it should. I adjusted where the delay was in the Arduino code and that sorted that out.

I also replaced the boring old yellow LED bars with fancy looking blue ones :0)

Damn well done! Thank you, as well, for posting back so regularly and showing that it works. It's something MOST folks don't bother with.

Great job! If you had the time at some point to post a schematic etc, it would undoubtedly be reused quite a bit! (if you do, link here from the YouTube video... Hate when great looking projects on YouTube are dead ends)

You could also do this using math in the Arduino code. I built an MSGEQ7 project to drive a set of addressable GE RGB LED Christmas lights and experienced the same issue, but just “trimmed” the output in the Arduino code.

In the example below I am creating a basic color organ that maps the mid/high/low from the audio to the R/G/B channels of the LEDs. I subtract 100 from the value read from the MSGEQ7 (0-1024) then divide the result by 64 to get the color intensity of the LED channel on a scale of 1-16. If the resulting value is negative I set the LED intensity to zero. This essentially trims out the low end “noise” when no audio is playing. You can experiment with what numbers works best to use depending on your input.

  for (int q = 0; q < 7; q++)
    digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // to allow the output to settle
    spectrumValue[q] = analogRead(analogPin);
    digitalWrite(strobePin, HIGH);

  ledeqred = (spectrumValue[3]-100)/64;
  if (ledeqred < 0){ledeqred=0;}

  ledeqgrn = (spectrumValue[5]-100)/64;
  if (ledeqgrn < 0){ledeqgrn=0;}

  ledeqblu = (spectrumValue[1]-100)/64;
  if (ledeqblu < 0){ledeqblu=0;}

My project let’s the user cycle through 7 effects - 2 of which are driven by audio through the MSGEQ7.
The second effect based on the MSGEQ7 is a sort of xmas color organ that starts with alternating red and green bulbs at 50% brightness, so they never go dark. The high/low read from the audio then determines the brightness from 50%-100%. It works very well to Christmas music.

I think flexibility like this would be an advantage to keeping an Arduino in your project - just change the code to add new effects!


PS. If you are interested in the GE RGB LED Christams lights you can read the mega 459 post thread over at DIY Christmas. Pictures of my MSGEQ7 build are in message #372.

is it possible to you provide the code and schematic of what you make? maybe on a github account or something like that?

I'm interested and adding this to my Si4735 based radio.

Hey Spleen,

I am just getting into the wonderful world of Arduino and Sound. I have a grand project in mind, and part of it requires a spectrum analyzer w/ display, almost exactly like you have set up. Would you mind sharing that code your friend whipped up for you?

I would really appreciate it,