MSGEQ7 and Analog Input

I am using the MSGEQ7 to gather audio data from my computer to drive some LEDs using the ATMega328 microcontroller. The schematic I am using to connect the MSGEQ7 to the microcontroller is the one from the MSGEQ7 data sheet.

http://www.mix-sig.com/datasheets/MSGEQ7.pdf
http://skoba.no-ip.org/msgeq7/

The problem I am currently having are the appearance of random "spikes" when there is no audio data (i.e. the music is turned off). What I would like to do is eliminate these random spikes. I have tried some software solutions which have not fully worked. I am curious if anyone knows of a way I can eliminate some of the noise between the signal source and input to the MSGEQ7 and from the MSGEQ7 to the analog input using circuits/hardware.

If I said you could add a circuit to "clamp" the input to ground when there was no audio signal would that mean anything to you?

You could make it automatic, or just add a pin that floats high when the audio is incoming and grounds when the audio is not there.

Under program control you could use a digital pin... add the pull down (or even pull up) resistor when there is no signal remove it when there is....

I realize that might not make sense if you are not into electronics. It might also have other side effects -- but it shouldn't. (Famous last words)

When you say add a clamp, are you talking about a diode type? Wouldn't that effect the audio signal?

Can you provide an example?

Okay, so I did some testing. First I set up the serial monitor and began watching values of A0. Then I began by connecting the input of the MSGEQ7 to ground which resulted it little change in the values seen on the serial monitor. When I pulled A0 to ground the values went to zero. So it looks like the noise is coming from the MSGEQ7 or along the wire connecting the output of the MSGEQ7 to the analog input of the ATMega328. Then I enabled the internal pullup resistor on A0 which has has helped reduce the noise quite a bit. There are very few "spikes" when connected to the computer/iPod. However, the input to the MSGEQ7 is unplugged from the computer/iPod there is a ton of noise again. Shorting the input of the MSGEQ7 to ground reduces the "spikes" enough to barely show up. I am guessing all of this noise is just induced current in the wires from ambient EMI.

How can I further eliminated the noise?

I'm having the same problem as you. I've implemented a function to remove the ~60 input base input level, but that's not solving the random spikes.

I'll be interested in any solution you come up with!

Well, I found a solution to my problem.

I used some RG-58A/U cable for the analog signal wire and some shielded 18-6 wire for the audio signal wires. Grounded the shield at one end and problem solved.

Not sure why I didn't think of all this sooner.

After looking at the msgeq7 datasheet I modified the code listed above in an attempt to get the timing closer to

tr - Reset Pulse Width 100 nS min
trs - Reset to Strobe Delay 72 uS min
ts - Strobe Pulse Width 18 uS min
tss - Strobe to Strobe Delay 72 uS min
to - Output Settling Time 36 uS min
int analogPin = 0; // read from multiplexer using analog input 0
int strobePin = 2; // strobe is attached to digital pin 2
int resetPin = 3; // reset is attached to digital pin 3
int spectrumValue[7]; // to hold a2d values

void setup()
{
  Serial.begin(9600);
  pinMode(analogPin, INPUT);
  pinMode(strobePin, OUTPUT);
  pinMode(resetPin, OUTPUT);
  analogReference(DEFAULT);

  digitalWrite(resetPin, LOW);
  digitalWrite(strobePin, HIGH);

}

bufferEQ();

void loop()
{
 	bufferEQ();
}
 
void bufferEQ() {
  digitalWrite(resetPin, HIGH);
  digitalWrite(resetPin, LOW);
  
  delayMicroseconds(72);

  long strobePulseStart = 0;

  for (int i = 0; i < 7; i++)
  {
    delayMicroseconds(36); // to allow the output to settle
    digitalWrite(strobePin, LOW);
    strobePulseStart = micros();
    spectrumValue[i] = analogRead(analogPin);
    delayMicros(constrain(18 - (micros()  - strobePulseStart), 0, 18));  // finish strobe pulse width
    digitalWrite(strobePin, HIGH);
    
    delayMicros(constrain(72 - ((micros()-strobePulseStart) -18), 0 ,72)); // adjust for if the strobe pulse width went long
  }
}

Please let me know this looks about right or if I am way off.

BTW: I had the same experience with the 0 signal with noise. I'll check out the

RG-58A/U cable for the analog signal wire and some shielded 18-6 wire for the audio signal wires

to see if that helps me.

I spoke to John Ambrose (high up) at mix-sig and he reminded me that the device has a reasonable amount of amplification built in, so SOME noise at 0 is expected and should be compensated for in the code.

Did he say what a resonable amount is?

I noticed most freqs with between 5-10% noise floor.

I don't have it in front of me - on my phone- but the data sheet does list it