MSGEQ7 weird Minimum values problem

Hi,
i got some weird behaviour with my MSGEQ7 Chip.
First i have to say, i wired it up correctly, i tried 2 chips and i tried different wirings, cause every website and datasheets tell you some different Values. I think the most correct info is the sparkfun datasheet and the sparkfun shield. But the shield has different values than the datasheet for the ic itself o.O I also tried different delays in the programm. nothing is working

Okay, so my MSGEQ7 is working quite okay, but i got sometimes very low values at a special reading sequence. Normally the values are between 45 and 1023. But if i do this and analyse the minum peak value for each array value i got the following output. (The value is NOT ALWAYS 0, but it can be unter the normal minimum of 45. as you can see the average (av) value is still as high as the others.) I should also notice, that this problem is only if i play musik. paused musik outputs minimums of 45-60

  digitalWrite(resetPin, HIGH); //resets the IC to start at 63Hz value
  digitalWrite(resetPin, LOW);
  delayMicroseconds(72); // to allow the reset to settle
  for (int i = 0; i < 7; i++){ 
      digitalWrite(strobePin, LOW); //Next value for the IC
      delayMicroseconds(36); // to allow the output to settle
      //63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25KHz, 16kHz
      spectrumValueRight[i] = analogRead(analogPinRight);
      spectrumValueLeft[i] = analogRead(analogPinLeft);
      digitalWrite(strobePin, HIGH); //Prepare for next value
          }

Output: (left is connected to gnd, thatswhy 0)

0: MaxL0 MaxR1015 MinL0 MinR0 AvL0 AVR205
1: MaxL0 MaxR1017 MinL0 MinR55 AvL0 AVR296
2: MaxL0 MaxR1018 MinL0 MinR51 AvL0 AVR257
3: MaxL0 MaxR1018 MinL0 MinR48 AvL0 AVR197
4: MaxL0 MaxR1015 MinL0 MinR57 AvL0 AVR147
5: MaxL0 MaxR995 MinL0 MinR41 AvL0 AVR105
6: MaxL0 MaxR1017 MinL0 MinR52 AvL0 AVR167

And now the weird things start (all values are ablosute minimums!):
1-6 reads: everything is fine
7 reads: the first [.0]value can get 0 (also for muliples like 14 reads, but only the very first reading cycle. reading #8 is clear!)
8 reads: the 2nd [.1] value can get 0 (15 reads)
9 reads: value can get ~20 (16 reads

if i write the for as a long code i have the same behaviour. The problem is not in the for, not the array itself, not the typ int, it is not the delay anywhere in my code. i seems the ic has some problems if i read it a 7th time and then it has to resett. seems like it cant handle this resett from the high number, or the reset is unclear, so i better dont use any resett.

ANY IDEA? It drives my crazy. I dont wanna deal with these abnormal bugs. this shouldnt happen.

some extra tests:
i counted how often i have to start the read function to get a zero value.
with the code above (i=0;i<7;i++) and no fake read it takes 37-600 times (just a few tries)
If i run it from 1 to 7 or from 0 to 6 is got 6 values and all 6 are okay. Why the hell is the last reading messing everything up? The weird thing is, that i just attach one more read after the code but it messes up the 1st reading.

Okay i tested some more things. Before i go on i need to ask this: Can anyone just test my programm for one minute and send me his Serial output? This would help me so much. So i can see if my cheap chips are bad quality or the code(or the ic in general) has some issus. If you know where you bought your ic, it would be nice to know where. Mine is this:
http://www.ebay.de/itm/NEW-GENUINE-MIXED-HYNIX-MSGEQ7-DIP-8-/171028013581?pt=LH_DefaultDomain_0&hash=item27d210620d

I used this datasheet with exact resisor values. Even the 22k next to the audio input.

Get the programm here (you dont need to understand my code, i just need the output. its a lot of other stuff in it)


Okay found something very important: If i attach an open wire at the audio input and more it around i get zero values (only at the first array and only for 7 reads.) with 6 reads its working fine. or if i dont reset i can also read 7 values with even an open wire. So it seems that the ic has some problems with the first readings after a reset. i dont really know how to fix this. it would be nice, if someone would test my programm now. seems like my ic is shit, or the ic in general...

Got your message on my blog (baldengineer.com). To answer the easy questions, I bought my chips from Sparkfun. The wiring used was posted on the same page you left a comment. I used the same values out of the MSGEQ7's datasheet.

It's been my experience it is pretty easy to blow the input to the chip. Especially if you forget the 22k resistors leading to the input. The chip really seems designed for line-level input and not for "headphone-level" input.

I'm not sure I understand the problem. You shouldn't expect the chip to read 0 when you have "no sound" going in, unless you purposely connect the input to ground. What seems like "no sound" to you, can still have noise that the MSGEQ7 picks up.

Thanks for your quick reply!

The problem is, that normally the chip values range from 40-1023, right?
But if I read out the minimum peak values, i sometimes get a zero at the first frequency. Okay shouldnt sound that weird, can happen. But if i only read 6 values, everything is fine. Or if i read 7 values without reset everything works fine too. No zero peaks at all. If i read 8 times the 2nd value can get 0.

Ive been trying a few things now to understand where the problem is. It seems like the ic cant handle the first value (or the 2nd, depending on the total reading before reset) if the total reading is 7, 8 or 9 (or 7², 7²+1 ,7²+2; 7³,7³+1,7³+2). But only the first value or the 2nd after reset. (as described in the 2nd post).

The conclusion is, that i need someone to just test the script with his ic and see if it is a general ic problem, or a cheap ebay quality problem. You said youve got the sparkfun one (so i guess its good quality). Would you please just try the programm, and post your results? This would be awesome!

I don't have my board setup anymore, so I can't test your code. You might try testing my code to see if there is a different. Your code and mine handle the reset slightly different. I delay after the HIGH transition, but not after the LOW transition.

You might try adding a small delay there.

void loop() {

digitalWrite(msg7RESET, HIGH);          // reset the MSGEQ7's counter
    delay(5);
    digitalWrite(msg7RESET, LOW);

for (int x = 0; x < 7; x++){

Nope this isnt working. The funny thing is, i found a solution. still weird, but its working. i just moved the problem "one up". So now 7 times reading is working. but 8 is messed up with the problem.

void readMSGEQ7(){
digitalWrite(resetPin, HIGH); //resets the IC
digitalWrite(resetPin, LOW);

for (int i = 0; i < 7; i++){
digitalWrite(strobePin, HIGH); //Prepare for next value <------- do this BEFORE and it will work.
digitalWrite(strobePin, LOW); //Next value for the IC
delayMicroseconds(35); // to allow the output to settle
//63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25KHz, 16kHz
spectrumValueRight = analogRead(analogPinRight);
_ spectrumValueLeft = analogRead(analogPinLeft);_
* //digitalWrite(strobePin, HIGH); //Prepare for next value <-- remove here*
* }*
}
[/quote]
But i still think it might be a hardware problem. I still need a 2nd tester :smiley:

Its been awhile since your last post, have you resolved the issue? If so, it's all good.

If not, I would suggest resetting the MSGEQ7 in setup() rather than in readMSGEQ7(). No need to reset the chip before the frequency bands are read.

Okay guys. I dont know what is with that weird input. I think it is caused by the reset and some other weird things. You have to order the LOW and HIGH stages correctly

I wrote a working! library for this ic. The good thing about this is, that you dont need the reset (if you do it right its working fine!) and it is very small and provides smoothed values. Let me look through this code again and i will publish it. I also wrote an Led Visualization which looks pretty nice, but i still want to add more and optimize this. At the moment it is killing my arduino uns memory with all other librarys.

Where should i post my code? Maybe i could publish it on github?

Test it, have fun and share it with others :slight_smile: Feedback appreciated