Grumpy_Mike:
Well the standard way is to post the code and the schematic of what you are trying along with a focused photograph.
Hey Grumpy_Mike,
First of all, thanks for looking into my post, I really appreciate it. Unfortunately, I don't own a program that allows me to make a clean schematic, but I followed the schematic given by Sparkfun on their Spectrum Shield, in conjunction with the inputs and outputs given by the product's datasheet (Page #3). It seems as if the schematic given by Sparkfun didn't correlate with the actual pins on the datasheet. The end result looks like this (this is only 1 of the 2 chips, but both are wired exactly the same).
On the other hand, I am almost certain that my code is written correctly, because it's picking up the output of the MSGEQ7s, but since they are constantly maxed out, the LEDs are only outputting the max color scheme. Here is the code:
#include <Adafruit_NeoPixel.h>
String colorPick = "GreenYellowRed";
const byte analogL = 0; // - - - - - - - - - - - - - - - - - left channel analog data from shield
const byte analogR = 1; // - - - - - - - - - - - - - - - - - right channel analog data from shield
const byte strobePin = 4; // - - - - - - - - - - - - - - - - - data strobe for shield
const byte resetPin = 7; // - - - - - - - - - - - - - - - - - reset strobe for shield
const byte dataPin = 8; // - - - - - - - - - - - - - - - - - data pin for Neopixels
const byte numband = 10; // - - - - - - - - - - - - - - - - - number of LEDs for each freq band
const byte numTop = 0; // - - - - - - - - - - - - - - - - - number of LEDs to have top color
const int noise[] = {900, 900, 900, 900, 900, 900, 900}; // - - - - - - - - set this to magnitude of noise from shield
const float gain[] = {5, 5, 5, 5, 5, 5, 5}; // - gain for each band
Adafruit_NeoPixel strip = Adafruit_NeoPixel(150, dataPin, NEO_GRB + NEO_KHZ800);
enum audio {
MONO,
RIGHT,
LEFT };
int spectrumReadR; //R magnitude from shield
int spectrumReadL; //L magnitude from shield
int magL = 0; //the magnitude of a freq band
int magR = 0; //the magnitude of a freq band
int numONL = 0; //the number of LEDs on in a freq band
int numONR = 0; //the number of LEDs on in a freq band
float fl_magL = 0.0; //floating point mag after noise removal and scaling
float fl_magR = 0.0; //floating point mag after noise removal and scaling
int peakArray[7];
byte
peak = 0,
dotCount = 0;
void setup() {
Serial.begin(9600);
pinMode(resetPin, OUTPUT);
pinMode(strobePin, OUTPUT);
pinMode(dataPin, OUTPUT);
strip.begin(); //begin strip communication
strip.show(); //set strip blank
//Init spectrum analyzer
digitalWrite(resetPin,HIGH);
delayMicroseconds(5);
digitalWrite(strobePin,HIGH);
delayMicroseconds(50); // strobe PW > 18 usec min
digitalWrite(strobePin,LOW);
delayMicroseconds(50); //reset PW > 100 usec min
digitalWrite(resetPin,LOW);
delayMicroseconds(5);
digitalWrite(strobePin,HIGH);
delayMicroseconds(100); // allow reset to strobe falling > 72 usec min
}
void loop() {
for(byte band = 0; band < 7; band++) {
digitalWrite(strobePin, LOW); //set analyzer to low to read
delayMicroseconds(40);
spectrumReadR = analogRead(analogR); //read right audio
spectrumReadL = analogRead(analogL); //read left audio
digitalWrite(strobePin, HIGH); //set analyzer back to high
magL = max(0, (spectrumReadL - noise[band])); //creates magnitude of frequency
magR = max(0, (spectrumReadR - noise[band])); //creates magnitude of frequency
fl_magL = gain[band] * float(magL); //adjusts magnitude for gain
fl_magR = gain[band] * float(magR); //adjusts magnitude for gain
numONL = map(fl_magL, 0, 1024, 0, numband+1); //maps magnitude to number of active pixels
numONR = map(fl_magR, 0, 1024, 0, numband+1); //maps magnitude to number of active pixels
anyBand(band);
Serial.print(fl_magL);
Serial.println();
//Serial.print(band);
//Serial.println(peakArray[band]);
if(peakArray[band]==0) strip.setPixelColor(peakArray[band] + numband*(band), strip.Color(0,0,0));
else strip.setPixelColor(peakArray[band] + numband*(band), strip.Color(255,0,0));
}
strip.setBrightness(20);
strip.show();
}
void readBand(byte band) {
for(byte band = 0; band < 7; band++) {
digitalWrite(strobePin, LOW); //set analyzer to low to read
delayMicroseconds(40);
spectrumReadR = analogRead(analogR); //read right audio
spectrumReadL = analogRead(analogL); //read left audio
digitalWrite(strobePin, HIGH); //set analyzer back to high
magL = max(0, (spectrumReadL - noise[band])); //creates magnitude of frequency
magR = max(0, (spectrumReadR - noise[band])); //creates magnitude of frequency
fl_magL = gain[band] * float(magL); //adjusts magnitude for gain
fl_magR = gain[band] * float(magR); //adjusts magnitude for gain
numONL = map(fl_magL, 0, 1024, 0, numband+1); //maps magnitude to number of active pixels
numONR = map(fl_magR, 0, 1024, 0, numband+1); //maps magnitude to number of active pixels
anyBand(band);
}
}
void anyBand(byte band) {
for(byte i = 0; i < numband; i++){
if(i < (numONL - numTop)){
strip.setPixelColor(i + numband*(band), Wheel(map(i,0,numband,20,83))); //main wheel colors
}
else if(i >= numONL){
strip.setPixelColor(i + numband*(band), strip.Color(0,0,0)); //unused colors on wheel
}
}
for(byte i = 0; i < numband; i++){
if(i < (numONR - numTop - 1)){
strip.setPixelColor(149 - i - numband*(band), Wheel(map(i,0,numband-1,20,83))); //main wheel colors
}
else if(i >= numONR){
strip.setPixelColor(149 - i - numband*(band), strip.Color(0,0,0)); //unused colors on wheel
}
}
}
uint32_t Wheel(byte WheelPos) {
if(colorPick == "GreenYellowRed") {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
else if(colorPick == "PinkPurpleBlue") {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
else if(colorPick == "GreenTealBlue") {
return strip.Color(0, 255 - WheelPos * 3, WheelPos * 3);
}
}
Personally, I don't own any equipment such as an oscilloscope at my house, but I can get access to one in the coming week. I am not sure how to use it in this specific situation, however. Same deal with a DMM. While I have taken an intro to circuit design course at my university, I am not personally an EE. I'm reaching the edge of my knowledge with this project and this last issue has run me into a wall. If you need any more information to help me solve this problem, I will be right on it.