I have been trying to get this chip to work with no luck.
Circuit diagram modified as shown below:
The capacitor and resistor for the clock are what I had laying around.
Clock frequency is should be 145kHz with this configuration which is within the data sheet characteristics.
The input is coming from an Electret Microphone with an Auto gain amplifier:
The data is sound responsive (i.e. louder = higher numbers) but there is no frequency response (and the first three bands shown above are the only ones that return data (except the seventh will receive something every once in a while).
I have used tone generators and even at the highest frequencies, the circuit only returns data for the lowest frequencies.
I have extended the strobe timing to accommodate for the lower clock speed and still get the same data.
The data returned in the first three columns is always closely correlated.
I'm not sure if the chip is bad or my clock RC network is screwing things for me.
I swapped out the 220k resistor with (2) 100k in series.
Tried to mess around with code that was reported to work and still no dice.
I bought (2) new chips and I get the same results (that rules out the chip).
I took a fairly long look at the spec sheet and tried to rewrite the timing from the code I was using.
I stripped everything down to just output serial data:
int msg7RESET = 5;
int msg7Strobe = 4;
int msg7DCout = 0;
int Spectrum[7]; // array to store analog values
void setup() {
Serial.begin(9600);
pinMode(msg7RESET, OUTPUT);
pinMode(msg7Strobe, OUTPUT);
}
void loop()
{
digitalWrite(msg7RESET, HIGH); // reset the MSGEQ7's counter
digitalWrite(msg7RESET, LOW);
delayMicroseconds(80);
for (int i = 0; i < 7; i++)
{
digitalWrite(msg7Strobe, HIGH); // output each DC value for each freq band
delayMicroseconds(40); // to allow the output to settle
Spectrum[i] = analogRead(msg7DCout);
digitalWrite(msg7Strobe, LOW);
delayMicroseconds(40);
}
Serial.println();
for (int i = 0; i < 7; i++)
{
Serial.print(Spectrum[i]);
Serial.print("\t");
}
Serial.println();
}
I have also eliminated the microphone breakout and am now taking the input from the headhone jack of my iPhone.
Still I'm getting nonsense for output for the seven bands:
76 80 84 85 87 79 77
49 49 52 51 58 59 61
68 66 66 65 65 65 64
101 101 108 112 113 114 115
77 79 79 79 0 0 0
44 41 39 39 39 39 38
29 33 0 0 0 0 0
The above output was in response to a 1000 Hz sound wave.
If music is played, the output looks more or less the same.
The all bands of the IC just react to volume and not frequency.
I have simplified the circuit as much as possible and can't understand why I can't get usable data from the chip.
I think that it may be something wrong with the timing of the code.
Could it possibly be my Arduino?
I could really use some help because I am incredibly stuck and frustrated.
I totally understand how these things can be frustrating but they eventually bring much satisfaction, you know when it is finally working. XD
Change your program where you read the levels of each frequency to:
for (int i = 0; i < 7; i++)
{
digitalWrite(msg7Strobe, HIGH);
digitalWrite(msg7Strobe, LOW); // HIGH to LOW enables EQ7 output
delayMicroseconds(40); // to allow the output to settle
Spectrum = analogRead(msg7DCout);
}* Two things I've learned about the MSGEQ7 chip: 1. It is the change on the Strobe pin that produces an output. The HIGH to LOW change. So, you want to make the change just prior to each analogRead. (as in the above code) 2. The chip doesn't have to be reset every time you want an audio sample. However, the Reset pin does have to be LOW before you transition the Strobe pin. So, put the reset code in setup() such as:
*void setup() { *
Serial.begin(9600);*
pinMode(msg7RESET, OUTPUT);*
pinMode(msg7Strobe, OUTPUT);*
digitalWrite(msg7RESET, HIGH); // reset the MSGEQ7's counter*
digitalWrite(msg7RESET, LOW); // enable the Strobe pin* } This resets the chip's multiplexor, which is a good thing to do on start-up, and it leaves the Reset pin LOW so you can take audio samples. Since you read (Strobe) the chip 7 times for each sample, the next sample output will again start with the lowest frequency's level.