In my previous column on this topic, we discussed the step-by-step construction of the first pass at a MSGEQ7-based DIY audio spectrum analyzer for use in my BADASS Display project. Of course, once you've built something, the first thing you have to do is test it to make sure it's functioning as expected (and to debug and fix it if it isn't).
Electrostatic discharge protection
This is something I should have mentioned in the construction article. Please, please, please don't neglect to use electrostatic discharge (ESD) protection. I cannot tell you how frustrating it is to blow an LED or disable one of the pins on your microcontroller because you forgot to take suitable precautions. Well, I could tell you, because I've certainly done it enough times, but I prefer not to talk about it.
You can pick up a cheap and cheerful ESD wrist strap from Best Buy. This will typically have a crocodile (alligator) clip on the end. I personally tend to clip this to a wire I plug into the ground rail of my breadboard. Given a choice, however, I'd really like to find something that would plug into the ground pin on a wall plug, so I could be 100% grounded before I touch anything. I'm open to suggestions on this point.
Checking the wiring
Before I power anything up on any project, the first thing I do is print a copy of the schematic. The one below shows components for the left audio channel, hence the "L" postscripts on the signal and component names. When I was performing my bringup, I also printed a copy of the schematic for the right audio channel.
Next, I go through the circuit component by component and wire by wire, comparing each element in the schematic to the corresponding element on the circuit board (or breadboard, in this case). I use a highlighter to mark things off in the schematic as I check them. Apart from anything else, if anything is not highlighted at the end, we know we've got a problem. As it turned out, I had made an error. If you don't recall this from my previous column, take a look at the breadboard below, and compare it to the schematic above.
If you look closely at the photograph, you will observe that the AUDIO_IN_L wire linking the TIP pin on the audio jack breakout board is directly connected to pin 5 of the left MSGEQ7 chip. Similarly, the AUIDIO_IN_R wire from the RNG pin on the breakout board is connected to pin 5 of the right MSGEQ7 chip. In reality, the TIP and RNG pins should be connected to the "input sides" of resistors R2L and R2R, respectively. The corrected version is shown below.
Applying power for the first time
The next thing I do is power everything up. This is where I keep a wary eye open and my nose aquiver for any components that start to leak acrid magic smoke. Also, I touch the tops of various components to check if they're unduly warm.
Next, I use my multimeter to check that I'm seeing power and ground values in the expected places, along with any other values I might reasonably expect to see, like Vdd/2 on the ground reference pins (pin 6) on the MSGEQ7s.
Rechecking the audio signal
As one final check before I plugged everything together, I decided to re-verify the audio signal. The image below shows my iPad-based Oscium iMSO-204 oscilloscope. The sine-wave signal on the bottom is coming from the Frequency Generator Kit I acquired a few weeks ago (on the bottom right of this picture). The audio signal on the top is coming from my iPod, which is also being used to drive an external amplifier and speaker system.
Quick and dirty test of the monitor and display
Before I actually plugged an audio source into the spectrum analyzer, I wanted to check that my display routine was giving me the sort of results I'd expect. As you may recall from the "Creating the first-pass software" section of my previous blog, we display the data we've read out of the MSGEQ7s on to our host computer's screen as numerical values.
Returning to the breadboard image above, do you remember the gray wires linking the DATA_OUT_L and DATA_OUT_R wires to the microcontroller's analog pins A0 and A1, respectively? Well, I unplugged the breadboard end of the wire connected to pin 3 of the left MSGEQ7 and connected it to the 3.3V power rail. Similarly, I unplugged the breadboard end of the wire connected to pin 3 of the right MSGEQ7 and connected it to the 0V ground rail. When I ran my program and looked at the display on the screen, it -- not surprisingly -- appeared as shown below.
I then swapped these wires so that the left input was connected to 0V and the right input was connected to 3.3V, and I observed this being reflected in the display. Finally, I returned these wires to their original positions on the breadboard. So far, so good.
To Page 2 >