Here’s how I built an audio frequency spectrum display around the MSEQ7 spectrum analyzer – in stereo:
I took a lot of inspiration from this:
… and built it first with an Arduino and Sparkfun’s spectrum shield. Later I replaced this combo with an attiny2313 and two bare MSGEQ7s.
The original uploader planeboy21 did not link to any description or schematic, but gave a few hints in the comments. From this I figured a few things.
First, the analog output of the MSGEQ7 is directly connected to the signal input of a single LM3915 which drives all 10 LED bar graph displays. The analog signal is multiplexed over the seven bands. In other words, while we cycle through the frequency bands, we provide power to only one of the bar graphs at a time.
The Arduino’s job is to orchestrate the whole thing, send the reset and strobe signals to MSGEQ7, and to multiplex the bar graph displays. The Arduino never does an analog to digital conversion of the MSGEQ7 signal. This is important. It allows me to replace the Arduino with an attiny2313 which lacks lacks ADC, but has more than enough IO pins for this project.
MSEQ7 timing
There is a pretty good article MSGEQ7-Based DIY Audio Spectrum Analyzer: Construction at eetimes.com. This is where I got this timing diagram from:
We can read the MSEQ7’s signal at the times shown in green. The output of the MSGEQ7 is connected to the input of the LM3915 which controls one 10-LED bar graph display at a time. There are 7 bar graphs – one for each frequency band. While cycling through the bands, we have to switch on the respective bar graph.
Source code is at github.
Schematic
This is for a single audio channel. For stereo I simply duplicated the MSGEQ7 + LM3915 section. The CAT1 .. CAT10 go the the cathodes of the bar graphs, the AN1 .. AN7 to the anodes. The LEDs are switched by P-channel MOSFETs.
The two resistors R13 and R14 around the LM3915 control the brightness. I picked resistor values which will give a pretty high current of 28mA for the LEDs. This is on purpose, because each bar graph is “on” only 1/7th of the time.


Wow, totally love the way you have implemented this project with so few components! Could you provide some info on how to program the attiny2313? I have never programmed anything other than arduino’s using the IDE. Also, whats the difference between the makefile and the main.c?
Thanks 😀
I use an an AVR ISP2 (http://www.atmel.com/tools/AVRISPMKII.aspx). There are many other, and cheaper, programmers out there, e.g. the USBtinyISP. You can also use an Arduino as a programmer (https://www.arduino.cc/en/Tutorial/ArduinoISP)
The main.c contains the actual source code. The Makefile describes how to build (compile, link, etc) it.
-ubiyubix
great stuff, many thanks! What would it take to run the code on a arduino again? I’m really keen to try it out and have plenty of arduino mini’s doing nothing and all the other required hardware 🙂 I can’t follow some of your code as its a little alien to me at the moment. Thanks again, great project!
The Arduino mini is built around the atmega328p. This will work just fine. In general, an Arduino board has a regular micro-controller at its core and some support components around it, for example usb and power supply. You do not have to use the Arduino IDE to program this board. You can directly use the AVR gcc compiler and a programmer to flash the chip. Here is an introduction on how to do this: http://www.ladyada.net/learn/avr/programming.html
cool, thanks I will have a look at getting a programmer then 🙂 So you could not flash your code to a 328p via the arduino IDE? Do you still have to use the arduino bootloader if using a AVR programmer?
No, you don’t need a bootloader. In fact you use an AVR programmer to put the put bootloader onto the microcontroller.
I see, thanks. Any chance you could post the code that you had working on the 328P? I have a programmer on order but I’m impatient and I would like to try it out 🙂
Yes, I have code the runs on the atmega328p. It’s the code I put on github. It works with an attiny2313 or an atmega38p. Change the Makefile from:
DEVICE = attiny2313
CLOCK = 8000000
to:
DEVICE = atmega328p
CLOCK = 16000000
assuming you have a standard Arduino board with a 16Mhz crystal. Read the makefile and use “make flash”. Be careful with the FUSES settings. The values are for the attiny2313 only. I am going to change to Makefile to fully support both micros later today.
I have updated the Makefile on github to include fuses settings for different devices. I don’t think you need to update those settings, but it’s safer to have the correct values in the Makefile in any case.
Brilliant! Many thanks for doing that. I have no idea what to do with the makefile though? Just had a bit of a search but can’t find any info – I have only ever uploaded .ino files via the arduino IDE? Thanks again
Can’t explain what a Makefile does in a few words. You can compile it using the Arduino IDE with minimal changes. Try this:
https://github.com/alohr/avr-msgeq7/blob/master/arduino/msgeq7/msgeq7.ino
thats great, many thanks I will try it out ASAP! thanks again for sharing 🙂
Hi there.
I made the video that you reffered to at the start with the blue LEDs. I love how yours has turned out. It looks very stable. One of the problems i had at the time was trying to smooth the display so that it didn’t bounce around so much. I eventually moved on to other projects but it looks like you got it running really smooth!
Very Nice!
Hi planeboy21,
nice to hear from you! Thanks for your kind words. Getting the timings right, required a few experiments, but it wasn’t so hard in the end. It actually looks better in real live than in the videos. Perhaps I need a better camera the next time 🙂
-ubiyubix
Can I use individual LED instead of that bar? I don’t know if the bar has another components to regulate it.
HI Quang, yes you can. The bars are just 10 individual LEDs in a neat package.
Good
Greetings Ubiyubix!
I also really liked your project but, like the “dtokez”, I also have great difficulties when it comes out of the Arduino IDE platform. If it’s not so much trouble, could you make your modified code available to open and write directly to the Arduino IDE? I thank you very much!
@Ubiyubix
Sorry, as are the connections to the pins of the Arduino Uno or Nano, because in the sketch I didn’t find the “defines”.