Go Down

Topic: MSGEQ7 graphic equalizer IC output is always "0" (Read 5599 times) previous topic - next topic

darylbeattie

Inspired by this project, I've decided to tweak it to work with a programmable WS2812b LED strip. However, before I can even get to the LED strip, I'm having issues with the MSGEQ7 graphic equalizer IC.

No matter what I do I am always getting "0" values from the MSGEQ7.

I am on my second MSGEQ7 chip; I still haven't ruled out the chip itself as I've heard people have had issues with them.

My circuit looks like this:



I've tried various alterations like independent power, separating grounding, using resistors or not for the stereo input, 10k resistor between pin1 and ground for stereo input, slightly different capacitors, removing the 1000uF capacitor, etc. I've tried many code changes such as messing with the reset and strobe pin highs/lows, not resetting the EQ7 every time, changing/adding microsecond delays in various places, etc.

That purple wire-connection I add/remove as needed to test the input to the EQ7.

Here's a photo of my setup:  (sorry for the long wires, colors don't match diagram)



The input is a stereo plug connected to either an android phone or iphone, tested at various volume levels.

You can completely ignore the LED strip part; most of the time I don't have it hooked up. Though in the picture above it is hooked up.

Here's my code:

Code: [Select]
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

#define PIN 6

int analogPin = 0; // MSGEQ7 OUT
int analogPin2 = 5; // MSGEQ7 IN for debugging.
int strobePin = 2; // MSGEQ7 STROBE
int resetPin = 4; // MSGEQ7 RESET
int spectrumValue[7];
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
 
void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

  Serial.begin(9600);

  // Write to MSGEQ7 STROBE and RESET
  pinMode(strobePin, OUTPUT);
  pinMode(resetPin, OUTPUT);
 
  // Set analogPin's reference voltage
  analogReference(DEFAULT); // 5V
}
 
void loop() {
  // Set reset pin low to enable strobe
  digitalWrite(resetPin, HIGH);
  digitalWrite(resetPin, LOW); // HIGH to LOW resets the MSGEQ7.
 
  // Get all 7 spectrum values from the MSGEQ7
  for (int i = 0; i < 7; i++) {
    digitalWrite(strobePin, HIGH);
    digitalWrite(strobePin, LOW); // HIGH to LOW enables EQ7 output.
    delayMicroseconds(30); // Allow output to settle
 
    spectrumValue[i] = analogRead(analogPin);

    Serial.print(spectrumValue[i]);
    Serial.print(" ");
  }

  Serial.print(" - ");
  Serial.print(analogRead(analogPin2)); // Debug the input value to the EQ7.
  Serial.println();
 
  // Write the PWM values to the LEDs
  /* // Entirely commented out for now.
  uint32_t c = strip.Color(255, 0, 0, 0); // Just red for now...
  for (uint16_t i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
  }
  strip.show();
  */
}


And my output always looks like this:

Code: [Select]
0 0 0 0 0 0 0  - 163
0 0 0 0 0 0 0  - 162
0 0 0 0 0 0 0  - 173
0 0 0 0 0 0 0  - 165
0 0 0 0 0 0 0  - 162
0 0 0 0 0 0 0  - 164
0 0 0 0 0 0 0  - 164
0 0 0 0 0 0 0  - 160
0 0 0 0 0 0 0  - 157
0 0 0 0 0 0 0  - 151
0 0 0 0 0 0 0  - 182
0 0 0 0 0 0 0  - 106


And that just goes on forever...

Does anyone have any idea what could be going wrong here? I've tried so many things, and now I'm out of ideas!

GypsumFantastic

#1
Feb 11, 2017, 01:21 pm Last Edit: Feb 11, 2017, 01:36 pm by GypsumFantastic
Are you putting 5V into the barrel jack? That needs 7-12V I think.

EDIT: Also, disconnect the LED strip altogether until you have the MSGEQ7 working - those things can draw quite a bit of current.

Grumpy_Mike

Quote
My circuit looks like this:
It might well look like that, but that is useless for us to see if it will work. What is needed is a schematic, not a poxy layout diagram.

darylbeattie

@GypsumFantastic:
I tried using the USB power supply or the 5V barrel-jack, or both. Ok, I'll look into getting a 7-12V jack. I bet that'll help more later on when I also have to power the LED strip.

And yes; I disconnect the LED strip altogether when testing the MSGEQ7. Just in the pic I have the data wired up (but not power).

wilson3682

#4
Feb 12, 2017, 06:44 pm Last Edit: Feb 12, 2017, 10:21 pm by wilson3682
Looking at the circuit, I don't see the 200k resistor on pin 8 msgeq7.


Grumpy_Mike

Well it won't work without that. Changing the value of that resistor slightly shifts the absolute frequency of the bands. I found that a 220K was closer to what they should be, but it all depends on the actual value of the 33pF capacitor, and capacitors do not have a very tight tolerance unless you spend a lot of money on them.

darylbeattie

Looking at the circuit, I don't see the 200k resistor on pin 8 msgeq7.
Wow! Good catch!!!

That was it. It's because the original project I referenced had an error in it and I ended up copying that error into my project. :(

Even though I checked the same manufacturer's datasheet I totally missed the "200" versus "22" difference. I must have read it half a dozen times and just didn't see it.

Thanks!!

Grumpy_Mike

Quote
It's because the original project I referenced had an error in it
Yes but the original project carried a warning, it had the words instructables in the URL. What this means is that the page it leads to has a 99% chance of being crap. Never use this site for trying to learn something unless you know a hell of a lot more than the writer.

polymorph

Instructables needs technical editors so badly... more so even than Make: Magazine.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

Grumpy_Mike

As does "Hackster.io", too many simple errors getting through.

Go Up