msgeq7 low values

Hello!
I’m about to make an LED strip for my speaker blink to different frequencies, but i’m having a slight problem: The values I get are waayyyy too low in comparison to what they should be if it was set up correctly. I get values like these:

 0 0 0 14 24 0 0
 0 9 1 0 14 0 0
 0 2 0 3 0 5 0
 0 3 0 0 3 0 2
 0 0 0 0 0 0 11
 5 0 0 0 0 3 0
 0 0 0 0 0 3 0
 5 6 0 25 27 0 3
 0 1 10 0 1 1 0
 0 0 0 0 9 2 0
 0 0 17 0 0 0 0
 1 0 0 0 0 0 17
 11 0 3 0 0 0 1
 0 0 3 0 0 0 0
 2 5 0 7 1 6 0
 0 0 0 0 8 19 6
 0 4 0 0 0 18 0
 3 0 0 0 0 0 0
 9 1 0 0 0 0 0
 4 10 0 0 0 0 0
 0 9 0 0 0 0 6
 0 0 0 0 0 1 1
 0 2 0 6 8 6 0
 7 7 0 9 2 1 0
 0 0 0 1 0 0 0
 0 0 0 4 0 6 5
 5 3 16 0 0 0 0
 3 0 5 0 0 5 16
 0 0 5 3 3 3 0
 1 0 8 0 0 6 1
 10 0 0 1 0 0 18
 0 0 5 0 4 8 5
 0 15 3 0 0 1 0
 0 3 0 0 2 0 0
 14 0 13 0 0 0 0
 10 1 0 0 1 0 0
 0 0 6 6 0 10 0
 0 0 4 0 2 5 9
 5 0 3 0 2 0 0
 0 11 0 5 0 0 0
 0 0 18 0 0 12 1
 12 0 0 0 4 0 25
 0 0 0 0 0 0 0
 0 0 18 6 0 0 0
 6 0 0 3 0 0 9
 2 0 0 0 5 0 10
 1 0 5 8 0 7 0
 0 0 3 0 23 0 0

It seems that my chip is analyzing the sound to some extend as these “spikes” comes when the kick for example plays. I am using my computer for sound and I am using this setup:

I have tried using different programs for the Arduino but this is the one i’m testing with:

int analogPin = 0; // read from multiplexer using analog input 0
int strobePin = 12; // strobe is attached to digital pin 2
int resetPin = 4; // reset is attached to digital pin 3
int spectrumValue[7]; // to hold a2d values
 //led
 int ledPinR = 7;
int ledPinG = 5;
int ledPinB = 6;

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

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

 Serial.println("MSGEQ7 test by J Skoba");
}

void loop()
{

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

 for (int i = 0; i < 7; i++)
 {
 digitalWrite(strobePin, LOW);
 delayMicroseconds(30); // to allow the output to settle
 spectrumValue[i] = analogRead(analogPin);

 // comment out/remove the serial stuff to go faster
 // - its just here for show
 if (spectrumValue[i] < 10)
 {
 Serial.print(" ");
 Serial.print(spectrumValue[i]);
 }
 else if (spectrumValue[i] < 100 )
 {
 Serial.print(" ");
 Serial.print(spectrumValue[i]);
 }
 else
 {
 Serial.print(" ");
 Serial.print(spectrumValue[i]);
 }

 digitalWrite(strobePin, HIGH);
 }
 Serial.println();
}

I can send an image of my wiring, but I think it will be hard to tell anything from it as my circuit is quite a mess :stuck_out_tongue: I am using a jack plug with 3 pins, and i’m just using the one that is giving output ^^

Does anybody have an idea about what I could have done wrong? Thank you very much :slight_smile:

if (spectrumValue[i] < 10)
 {
 Serial.print(" ");
 Serial.print(spectrumValue[i]);
 }
 else if (spectrumValue[i] < 100 )
 {
 Serial.print(" ");
 Serial.print(spectrumValue[i]);
 }
 else
 {
 Serial.print(" ");
 Serial.print(spectrumValue[i]);
 }

Why all the if statements? This will print your value no matter what,.

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

What’s this for?

Most probably the volume is lower than you expect. For testing purposes you can increase the delay before analogRead.

Thank you for the answers ^^ Firstly, i have removed the if statements as they, as you said, were completely useless and just took up space. The reset HIGH and LOW is for the reset pin on the msgeq7 and i'm not really sure what it's doing, but it dosen't have any effect removing it.

I have tried increasing the delay before the analogRead, but it didn't change anything. I have also tried using my phone and my tablet instead, but i simply only got 0's when doing that. I think it's because my desktop has a sound card with a quite powerful amp.

I am following this guide btw

I'm uploading some pictures of my circuit and aux connector, maybe that'll help ^^

You need an audio signal of about 0.7V peak to peak to get the full output from the chip. If there is not enough signal you will get nothing. I have found that it takes an iPad on full volume output to get a full output reading.

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

 for (int i = 0; i < 7; i++)

is not right for preparing the chip to send the data. I use:-

    digitalWrite(pinReset,HIGH);
    digitalWrite(pinClock,HIGH);
    delayMicroseconds(1000);
    digitalWrite(pinClock,LOW);
    delayMicroseconds(1000);
    digitalWrite(pinReset,LOW);
    digitalWrite(pinClock,HIGH);
    delayMicroseconds(1000);

 for (int i = 0; i < 7; i++)

This gives you the waveform shown in the chip’s data sheet.

Also a 30mS delay between the clock and the audio is way too long, try a 5mS one.

Edit :- I would also put a 22K resistor in series with the audio input like it suggests in the data sheet.

dorvakta: digitalWrite(resetPin, HIGH); digitalWrite(resetPin, LOW);

What's this for?

It is a botched attempt to prepare the chip to send the data out. See the data sheet.

Allright, so I've changed the preparation phase in the code to what you were using, I've set the delay to 5mS, I've added the 22k resistor, and there Is still no change :/ I've also tried an ipad at full volume, and still just 00000000000. Thank you very much for the suggestions though, I really appreciate it! i'll upload a couple of pictures in five minutes when i'm allowed to post again ^^

The images aren't working for some reason, but if you right click them and click view in new tap it should work ^^

Use the Reply box not the Quick reply. Then in the lower left click the Addition operations triangle, and there you will be able to attach files to your post.

but if you right click them and click view in new tap it should work ^^

1) Right click on what? 2) What is "new tap" ?

I tried that, but my internet is too slow so it ended up timing out all the times i tried to do it. I just uploaded them to google drive so that i didn't have to upload them directly which would cause the timeout, But i'll just post the links if you don't mind ^^:

https://drive.google.com/open?id=0B6M1NEEpPxJwX1RMRFBZWGJ5UzRMZGV0NGhEQlJ4S29nRmln https://drive.google.com/open?id=0B6M1NEEpPxJwamNnSUN3MXpEdm1ER0Uwd3lWREl3elFfUTNJ https://drive.google.com/open?id=0B6M1NEEpPxJwYlNDV0lNay1LeUlOZmFuQnBZRkhISlkydGgw https://drive.google.com/open?id=0B6M1NEEpPxJwRmVPQlFDWmY0M09lYl9jdS1NSWdIMGpkMlJj https://drive.google.com/open?id=0B6M1NEEpPxJwS2tORnh1YnQtWmQ1cFdFS1d6b044cW9BTlpr

Edit: I'm using a 56pf capacitor as my 33 pf capacitor got lost in my carpet (It was a really small plate capacitor that had to be soldered)

Your audio connections are wrong. The connector closest to the hole in the 3.5mm connector is the ground, left is the next closest and finally there is the right. You seem to have connected the left channel to ground and the ground to the input of the chip. I can't see where the right channel is going, but it appears to be going to the processor board..

There may be other errors as well, it is a bit of a mess.

Edit:- further looking shows that the resistor going into pin 8 is only 4K7 and not the 200K it should be.

I just checked, and the resistor is actually 220k ohms (Red, Red, Yellow, Silver), But it is kind of hard to see in the picture. I had actually searched for the right setup of pins for the aux, but When i connected it the right way i just got 0's for some reason, and when i connected it the other way around i actually got some output from the chip (Though very low), nevertheless i tried to connect left and right to the input pin and the ground to the gnd on the arduino, but with no sucess. I am using a 56pf resistor instead of the 33pf, but could that be related to my problem of low values? Thanks for the help!

Forget what you did, that input as you wired it is wrong and you will never get anything out of it the way it is wired. Why is the right channel going into the processor board?

Sorry but that resistor does not have two red bands on it they are very different colours. That resistor and capacitor form the basic clock that runs the whole shooting match and the 56pF value is way out. Are you sure it is 56pF anyway it looks way to big to be that small a value. What markings does it have on it?

Yeah ive Still hooked it up the way it is on the datasheet. Ive found another 33 pf capacitor, and ill try not to screw the soldering up. Ill send some close ups of the components ^^

ive Still hooked it up the way it is on the datasheet.

Not sure what that means, but the audio input is not right.

I find it hard to believe that that last photo was the same resistor as on the earlier photos.

Resistor from construction photo
resistor.png

Resistor from last post
Resistor2.jpg