MSGEQ7-Based DIY Audio Spectrum Analyzer: Construction

Here's a step-by-step guide to constructing a simple 14-band (2 x 7) audio spectrum analyzer using two MSGEQ7s and a chipKIT or Arduino microcontroller development platform.

Creating the first-pass hardware
When I started this project, I knew I was going to construct my first incarnation on a breadboard. One thing I needed was a 3.5mm stereo jack socket. I performed a web search and found a printed circuit board (PCB) mountable socket, so I ordered it. I'd foolishly assumed that something that said "PCB mountable" would have a traditional 0.1" pin pitch, and that its leads would be long enough to be used with a solderless breadboard. I was wrong on both counts. Eventually, I purchased a different 3.5mm PCB audio jack and an associated breakout board from SparkFun.

You'll also need some 0.1" pitch standard male header pins, which -- as far as I recall -- don't come with the breakout board. Happily, I have loads of these lying around. Solder the jack on to the top of the breakout board, and solder a strip of five header pins on to the bottom of board (with the long ends pointing away from the board, so they can plug into the breadboard).

Let's move on to the breadboard itself. I'm using a full-sized solderless breadboard, similar to this Adafruit board. I say "similar" because there are myriad tiny differences between such boards from different suppliers, but most of these are superficial.

Just in case you are new to all this, one important thing to note is that all the holes in the horizontal row under the red "+" line at the top of the board are connected together. Similarly, all the holes in the horizontal row above the blue "-" line at the top of the board are connected together. The same applies for the corresponding rows at the bottom of the board. In the fullness of time, we will connect our power supply to the "+" rows and our ground (GND) to the '-' rows.

The really clever part is that the pins in each vertical column are connected together. If you look at the larger version of the above image, the A, B, C, D, and E pins in column 0 are connected together. Similarly, the F, G, H, I, and J pins in column 0 are connected together, and so forth for all the other columns.

As we previously noted, most of the differences between the boards from different manufactures are superficial -- the way they number the pins, for example. However, there can be the occasional gotcha. If you look at the large version of the first breadboard image above, you will see small gaps in the middle of the horizontal red (power) and blue (ground) lines. On some boards, this may indicate that the left and right sides are separate.

This is exactly the way my board looks. I should have used my multimeter to check whether the two sides were separate. However, I was happily cruising along on autopilot, so I simply assumed that the two halves of the board were separated, and I proceeded to connect them together without thinking.

This leads us to the question of color coding one's wires. Given a choice, I usually use red and black wires to indicate power and ground connections, respectively. I subsequently use different colored wires to indicate various functions and types of signals. Thus, you might wonder about my using blue and green wires above. The answer is very pragmatic. When I started building this project, I quickly realized that I had only dribs and drabs left in my various pre-formed jumper wire kits, so I ended up using whatever was to hand at the time.

The next step is to add the audio jack/breakout board combo to the breadboard, and then add the two MSGEQ7s, as shown below.

Now we add the capacitors and resistors, as illustrated below. These component names match the schematic we showed earlier; the only difference is that we now have two channels, so each component name includes an 'L' or 'R' postfix indicating "Left" or "Right," respectively.

Now it's time to add the wires. Observe the two red wires associated with the TIP and RNG ("Ring") pins on the audio-jack breakout board. These correspond to the left and right audio channels coming from the iPad. Don't worry about the TSH and RSH pins on the breakout board; we won't be using them.

Also observe the red wire on the left side of the board linking the two power rails and the black wire on the right side of the board linking the two ground rails. As you'll see in the photograph below, I started off by mounting these side by side, but I later moved the ground wire as shown in the graphic above purely for aesthetic reasons. Now, let's pause for a moment to take a sanity check and look at the real board.

Did you spot the errors in the above photograph? (For the sake of charity, let's pretend these errors were "intentional" to make an educational point.) The thing is that, if you look closely at this photograph (and also at the next photograph shown below), you will observe that the wire from the TIP pin on the audio jack breakout board is directly connected to pin 5 of the left-hand MSGEQ7 chip. Similarly, the wire from the RNG pin on the breakout board is connected to pin 5 of the right-hand MSGEQ7 chip. In reality, the TIP and RNG pins should be connected to the "input sides" of resistors R2L and R2R, respectively (this is shown correctly in the graphical versions of these images). I discovered these mistakes as part of my test procedures (see also my step-by-step test guide).

The next step is to hook the breadboard up to the microcontroller board -- the chipKIT MAX32, in this example. For this, we use flexible flying leads. We start by connecting one of the '+' power rails on the breadboard to the +3.3V power supply header pin on the chipKIT (or the +5V supply on an Arduino). We also connect one of the '-' ground rails on the breadboard to one of the two GND header pins on the chipKIT or Arduino. Personally, I don't think you can have a good enough ground connection, so I connected both GND header pins on the chipKIT, as shown below. I know there are additional power and ground connections on both chipKIT MAX32s and Arduino Megas. For the purposes of this guide, I'm just focusing on the ones on the main power header.

The DATA_OUT from pin 3 on the left (and left channel) MSGEQ7 is connected to analog input A0 on the chipKIT. Similarly, the DATA_OUT from pin 3 on the right MSGEQ7 is connected to analog input A0 on the chipKIT.

Digital output pin 23 from the chipKIT is connected to the RESET input (pin 7) on the right MSGEQ7. A second flying lead is used to connect pin 7 on the right MSGEQ7 to pin 7 on the left MSGEQ7. Similarly, digital output pin 22 from the chipKIT is connected to the STROBE input (pin 4) on the right MSGEQ7. A second flying lead is used to connect pin 4 on the right MSGEQ7 to pin 4 on the left MSGEQ7. Once again, let's take a quick sanity check and look at a photograph of the current setup.

MaxThanks for your quick response and all the info. I just watched your BADASS display and I have to say it discouraged me from building my own analyzer :(, I know I'll never get close to that (just kidding! Baby steps).About the function generator and the shield, I live in Mexico, so it's kind of hard for me to try to get any of those (I barely got the MSGEQ7, I envy you and the way you get everything practically from around the corner :( ) I'll take a deeper look at the posts when I get home.When it is done I'll share some photos or video on what you've helped to build :)Thanks a lot.jreza

@Jreza: What is the input level required by the MSGEQ7? Is it enough with just the output signal from a regular portable player? (from your tutorial it seems it does). Is it enough with the output level of a regular mic?

Hi there -- I think you're going to really enjoy playing with this chip. Take a look at This YouTube Video showing two of these chips driving my BADASS Display.

I'm using the output from the headphone jack from my iPod (sometimes my iPad) with no problems at all -- typically I set the iPad to about 3/4 full volume to drive this chip -- then I control the actual sound volume using the amplifier driving the speakers.

I started off by creating a prototype using a breadboard (see This YouTube Video), but later my chum Duane Benson took my circuit and generated a special printed circuit board (PCB) for an Arduino Shield (this uses two MSGEQ7 chips -- one for each channel).

You can buy one of these boards from Duane from his SteelPuppet.com website if you wish.

Are you using an Arduino? If so, one of the things I do when I've just built a new sound analyzer card (I've now constructed three using Duane's shield for different projects) is to use the Serial I/O to display the numerical values on the screen so I can see what's happening -- you could use this technique to see how your microphone was working.

If you want to see some example Arduino code for this, email me at max@clivemaxfield.com and I'll send it to you.

Hi there.I'm getting all the components to start this proyect. Thanks for the tutorial. I have a question though, What is the input level required by the MSGEQ7? Is it enough with just the output signal from a regular portable player? (from your tutorial it seems it does). Is it enough with the output level of a regular mic?Thanksjreza

Sorry about thedelay in my response -- I just saw this -- there is some noise on the signals -- so the best thing is to apply a simple filter -- so when you read the output from the MSGEQ7 chip into the Arduino's analog input -- if it's less than say 50, then set it to 0.

@Max....well you have proved that the above works and you have exceeded the minimum strobe to strobe time. Have you factored youre ADC conversion time into this? (Is it fixed or variable?) Without knowing the specs for the minimum strobe high time you may be wasting time that might be precious later when your design gets more advanced. I may be being pedantic here but I'm sure you could find any number of readers here who've come unstuck by NOT being pedantic about timings... :-)