Hello,
I have recently tried to create an Audio Visualizer with MSGEQ7. First i tried to understand how the chip works in order to put it in my project. I connected the chip as they say in datasheet [first attachment] , but the readings are always the same and equal to 800 +- 10. I tried other connections from projects in this site, however the results are always the same. I checked the connections and the audio output they seemed to work as they should. Can anyone help me with this, because i don't have any idea what is wrong with it.
The code
/*
Test Sketch for the MSGEQ7
from Mixed Signal Integration
the IOs in this Sketch are
compatible with the Shield
from Sparkfun:
Author: Simon Waldherr
License: MIT
*/
int AnalogIn = 0; // read from multiplexer using analog input 0
int NextBand = 2; // strobe (next band) is attached to digital pin 4
int ResetPin = 3; // reset is attached to digital pin 5
int Spectrum[7]; // array to store analog values
int filter = 80; // *** added min level above noise
void setup()
{
// init IO
// delay(250); // *** not necessary
// pinMode(AnalogIn, INPUT); // *** not necessary
pinMode(NextBand, OUTPUT);
pinMode(ResetPin, OUTPUT);
analogReference(DEFAULT);
digitalWrite(ResetPin, HIGH);
digitalWrite(ResetPin, LOW); // *** added
// digitalWrite(NextBand, HIGH); //*** removed
// init Serial
// delay(250); // *** not necessary
Serial.begin(9600); //*** chg'd from 115200 to 9600
//*** make sure Monitor is 9600
Serial.println("|______________________________|");
Serial.println("| MSGEQ7 |");
Serial.println("|------------------------------|");
Serial.println("| Seven Band Graphic Equalizer |");
Serial.println("|------------------------------|");
Serial.println("| on an Arduino Shield |");
Serial.println("|------------------------------|");
Serial.println("| with Serial output |");
Serial.println("|------------------------------|");
// wait
delay(5000);
}
void loop()
{
// *** Reset here works but slighly better response without it
// digitalWrite(ResetPin, HIGH); // reset band to 63 Hz
// digitalWrite(ResetPin, LOW);
for (int i = 0; i < 7; i++) // for loop to save values to array
{
// HIGH to LOW transition works best here
digitalWrite(NextBand, HIGH); //*** added
digitalWrite(NextBand, LOW);
delayMicroseconds(22); // to allow the output to settle
// Spectrum = doMath(analogRead(AnalogIn)); // read actual value to array
- // read spectrum level and filter noise*
Spectrum = constrain(analogRead(AnalogIn), filter, 1023); //*** added
// digitalWrite(NextBand, HIGH); //*** moved up // select next band (160Hz, 400Hz, 1000Hz, 2500Hz, 6250Hz, 16kHz)
_ delayMicroseconds(3); //*** probably not necessary_
* }*
* for (int i = 0; i < 7; i++) // for loop to print array to Serial*
* {*
if (Spectrum == filter ) //*** chg'd // ignore values lower than 100 (you also can use doMath())
* {*
* Serial.print("\t");*
* Serial.print("0");*
* }*
* else*
* {*
* Serial.print("\t");*
_ Serial.print(Spectrum*);
}
}
Serial.println(); // Serial new line*
* //delay(500); // this sketch prints really much data, you can slow down if you have to.
}[/td]
[/tr]
[/table]
_
*