Applications engineer Sree Harsha Angara has used a programmable SoC to create an exact replica of a MSGEQ7 audio spectrum analyzer IC.
Over the last few weeks, I have been having a lot of fun implementing a simple audio spectrum analyzer using a pair of MSGEQ7 chips (designed by Mixed Signal Integration and purchased from SparkFun). For the digital processing and control portion of the system, I'm using a chipKIT MAX32 microcontroller platform featuring a 32-bit MIPS-based processor from Microchip Technology running at 80 MHz.
The columns on my project have received quite a few comments, including one from Sree Harsha Angara (a.k.a. Mithrandir), a senior applications engineer in Bangalore, India, for Cypress Semiconductor. "My interest is piqued now," he wrote. "I'll see if I can get the front-end filtering running on my PSoC 4 Pioneer kit. Weekend project, here I come :)"
Over the last few years, several of my friends have told me I should start playing with programmable SoC (PSoC) devices from Cypress. In particular, the PSoC 4 looks rather interesting, with its mixture of programmable analog fabric (opamps, 12-bit 1Msps SAR ADC, etc.), programmable digital fabric (four PLD-based logic blocks), and a 32-bit ARM Cortex-M0 processor running at up to 48 MHz. I particularly like the 1.7-5.5V operation.
Anyway, Sree and I ended up exchanging several emails. I learned that he "works mostly on power supervision designs and almost any other customer designs that come my way." He takes "a personal interest in control theory, digital filters, and power electronics." He's currently writing a series of columns on PID controllers on EEWeb. He's "always crawling around EE Times," and he reads my blogs in particular "because of the fun projects." Ooh, he knows how to get my attention (LOL).
Eventually, Sree sent me an email saying, "Hurray, I finally got my hands on an audio splitter. I also got some time to get to the filter design and I'm pretty satisfied with it. A quick peek of the characteristic curves is as shown below:"
When I asked Sree whether these curves were theoretical or empirically measured, he explained: "I create these curves the old-fashioned way using Excel. The curves I show here are theoretical, but I generally make it a habit to perform a simple Excel simulation in the digital domain once all the nasty transforms and fixed-point bit shifts are done."
A few days later, Sree sent me another email saying, "It's Alive!" It seems that he used his PSoC 4 to create "an exact replica of the MSGEQ7 chip with its seven band-pass filters and peak detectors." He also sent me a link to link to this video showing his PSoC 4 accepting an audio stream, emulating a MSGEQ7, and driving seven LEDs.
Do you recall my blog from a couple of months ago about the 32-bit PSoC 4 dev board? Since then, I've ended up with 41xx and 42xx versions of these PSoC 4 Prototyping Kits, along with a PSoC 4 Pioneer Kit, so I asked Sree if I could implement his design on these boards. He replied: "This implementation just uses one SAR ADC and the whole filter runs through a single interrupt routine. That being said, you need seven PWMs to drive the LEDs -- I basically use four fixed-function PWMs and the other three are implemented using UDBs (Universal Digital Blocks)." He also provided the following block diagrams.
Block diagram showing the analog functions used in this PSoC 4 design (click here for a larger image).
Block diagram showing the digital functions used in this PSoC 4 design (click here for a larger image).
If you want to play with this design yourself, Sree has kindly provided these main.c and adc-sar-int.c files, along with this ZIP file with all the source code and the entire PSoC Creator project.
Sree says we still have about 50-55% of the processing power free. Also, it seems that he's run across another really interesting method called the Goertzel algorithm for frequency detection. In his last message to me, he said: "I'm still chugging along with the Goertzel algorithm, but on first sight it's a lot more complicated than simple band-passes and I'm having some difficulty wrapping my head around it."
I, for one, have every faith in Sree, and I look forward to reporting on his progress with the Goertzel algorithm in a future blog. In the meantime, what do you think about the PSoC 4 devices?
— Max Maxfield, Editor of All Things Fun & Interesting