Go Down

Topic: MSGEQ7 chip problems (Spectrum Analyzer Help) (Read 799 times) previous topic - next topic

32ovy32

Jul 27, 2014, 12:21 am Last Edit: Jul 31, 2014, 07:28 am by 32ovy32 Reason: 1
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:
http://www.adafruit.com/products/1713

Circuit is powered from the board (Uno).

I have used verified working code from a number of different posts on the forum to test the chip:
http://forum.arduino.cc/index.php?topic=255869.msg1810517#msg1810517
All code returns similar values.

I keep getting data that looks like this (columns are different frequency bands, rows are sample data):

   150   153   0   0   0   0   0
   112   115   0   0   0   0   0
   81   81   84   0   0   0   0
   55   54   57   57   0   0   0
   145   144   148   0   0   0   0
   106   109   0   0   0   0   0
   369   372   0   0   0   0   0
   292   296   296   0   0   0   0
   227   230   0   0   0   0   0
   173   176   0   0   0   0   0
   130   133   0   0   0   0   0
   94   96   96   0   0   0   0
   92   92   96   0   0   0   0
   64   64   68   67   0   0   0
   150   150   153   0   0   0   0
   112   115   0   0   0   0   0
   79   82   81   0   0   0   0
   171   171   174   0   0   0   0
   127   130   0   0   0   0   0
   92   95   95   0   0   0   0

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.

Any ideas?

Thank you for your help!

32ovy32

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:

Code: [Select]
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.

v6gn

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.

Go Up