Pages: [1]   Go Down
Author Topic: MSGEQ7 and Analog Input  (Read 1448 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 45
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Georgina Ontario
Offline Offline
Sr. Member
****
Karma: 5
Posts: 437
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
« Last Edit: March 22, 2011, 10:17:23 pm by WillR » Logged

Just another Hacker

0
Offline Offline
Newbie
*
Karma: 0
Posts: 45
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 45
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 199
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 45
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Lynnwood, WA
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

After looking at the msgeq7 datasheet I modified the code listed above in an attempt to get the timing closer to
tr - Reset Pulse Width100 nS min
trs - Reset to StrobeDelay72 uS min
ts - Strobe Pulse Width18 uS min
tss - Strobe to StrobeDelay72 uS min
to - Output Settling Time36 uS min
                                     
             
Code:
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
Quote
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.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 199
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Lynnwood, WA
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Did he say what a resonable amount is?

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

Offline Offline
Full Member
***
Karma: 0
Posts: 199
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: