SparkFun Forums 

Where electronics enthusiasts find answers.

#202128
Hello All,

I'm working on a project that my dad left on the bench when he passed away recently. He wanted to control a group of LEDs and have them change colours when the guitar was plugged in and playing. He designed a custom board using the Atmega328-20PU and the MSGEQ7. I have the wiring diagram here. I've had no problem writing the code to get the LEDs to fire and work properly, but I'm having a problem with getting the code to read the proper frequency output of the guitar. I've attached the wiring schematic and have pasted the code below. My guess is that the MSGEQ7's pins are not reading the frequencies properly in the code. Any ideas?

CODE

#include <AudioAnalyzer.h>
//Version 1.3 for Spectrum analyzer
//Please download the latest library from the Product page!

Analyzer Audio = Analyzer(4,7,3);//Strobe pin ->4 RST pin ->5 Analog Pin ->5
//Analyzer Audio = Analyzer();//Strobe->4 RST->5 Analog->5

int FreqVal[7];//

void setup()
{
Serial.begin(57600); //Init the baudrate
Audio.Init();//Init module
}

void loop()
{
Audio.ReadFreq(FreqVal);//return 7 value of 7 bands pass filiter
//Frequency(Hz):63 160 400 1K 2.5K 6.25K 16K
//FreqVal[]: 0 1 2 3 4 5 6
for(int i=0;i<7;i++)
{
Serial.print(max((FreqVal-100),0));//Transimit the DC value of the seven bands
if(i<6) Serial.print(",");
else Serial.println();
}
delay(20);
}

Image
#202144
Thanks for the feedback, paulvha! The link that you've shared is most helpful and I'll be diving more into the examples tomorrow.

I do have to say that the original program does have the #include <AudioAnalyzer.h> at the beginning of the code. I'm going to check the loop with the Serial.prin(max((FreqVal-100) to better understand the FreqVal[x] array.

At the moment, the biggest question that I'm having is how to properly designate the MSGEQ7 pins in the code. From the documentation I've been able to find for MSGEQ7, the pin designations are the following: 1 VDDA, 2 VSSA, 3 Analog Out, 4 Strobe, 5 Analog In, 6 Ground, 7 Reset, and 8 CKIN. Where I'm having some confusion is what pins to reference, the MSGEQ7 pins or the Arduino equivalents? The test code I believe was written by someone who was using the Arduino Uno board and so I'm not sure that the same pins that are referenced int he commented code are the same.

Additionally, I am able to get some signals coming into the circuit that measure the DC output of the bands. However, they form a continuous sine wave and therefore I think that my pin references in the code are incorrect.
#202162
The hardware / schematics look to be correct
1 vdd connect to 5V
2 VSS connect to GND
3 OUT connect to A0
4 Strobe connect to D11
5 Adio-in connect to guitar
6 internal GND connect to condensator
7 reset connect to D10
8 connect to resistor and condensator

The software needs adjustments..
The MSGEQ7 detect the peak for level for 7 different frequencies and provides those levels (one after each other) when the strobe signal is raised.