Hey Community,
Ich hab mir ein MSGEQ7 IC gekauft und wollte diesen nun ausprobiern. Nur leider funktioniert es nich ganz so wie ich das möchte....
Die Werte für die Frequenzen bleiben bei 0 und verändern sich nicht wirklich....
Ich denke, dass ich alles richtig angeschlossen habe:
#define strobe 12 // strobe pins on digital 12
#define res 11 // reset pins on digital 11
int left[7]; // store band values in these arrays
int right[7];
int band;
void setup()
{
Serial.begin(115200);
pinMode(res, OUTPUT); // reset
pinMode(strobe, OUTPUT); // strobe
digitalWrite(res,LOW); // reset low
digitalWrite(strobe,HIGH); //pin 5 is RESET on the shield
}
void readMSGEQ7()
// Function to read 7 band equalizers
{
digitalWrite(res, HIGH);
digitalWrite(res, LOW);
for(band=0; band <7; band++)
{
digitalWrite(strobe,LOW); // strobe pin on the shield - kicks the IC up to the next band
delayMicroseconds(30); //
left[band] = analogRead(0); // store left band reading
//right[band] = analogRead(1); // ... and the right
digitalWrite(strobe,HIGH);
}
}
void loop(){
readMSGEQ7();
// display values of left channel on serial monitor
for (band = 0; band < 7; band++)
{
Serial.print(left[band]);
Serial.print(" ");
}
Serial.println();
}
Was meinst du? A1, A2?
Der schaltplan ist genau so, wie auf dem Datenplatt (ja, ich hatte es davor schon...)
Das Modul hab ich von ebay gekauft. Kann den Link vllt. später noch schreiben...
Die Schaltung ist wirklich so, wie auf dem Datenplatt. Das Bild oben hab ich nur schnell danach zur anschauung fürs Forum gemacht.
Hallo,
probiere den einmal, der läuft- wenn nicht, ist es Verdrahtung:
/*
MSGEQ7 Demo app
Look for the breakout board on www.whizoo.com
This code runs on an Arduino Duemilanove, but will run on other Arduino models.
Connections:
- GND to GND on MSGEQ7 breakout board, and LED's
- 5V to VDD on MSGEQ7 breakout board
- A0 to OUT on MSGEQ7 breakout board
- D7 to STROBE on MSGEQ7 breakout board
- D8 to RESET on MSGEQ7 breakout board
- D3 to LED 0 (indicator for frequency band 0)
- D5 to LED 1 (indicator for frequency band 1)
- D6 to LED 2 (indicator for frequency band 2)
- D9 to LED 3 (indicator for frequency band 3)
- D10 to LED 4 (indicator for frequency band 4)
- D11 to LED 5 (indicator for frequency band 5)
*/
// Hardware-specific defines
#define MSGEQ7_STROBE_PIN 7
#define MSGEQ7_RESET_PIN 8
#define MSGEQ7_ANALOG_PIN A0
#define NUM_FREQUENCY_BANDS 7
// Duemilanove only has 6 PWM outputs, so the last LED won't respond properly. Your
// board may have more PWM outputs. Typically you only want to monitor the lowest
// frequency bands because that is where the beat is.
int led[NUM_FREQUENCY_BANDS] = {3, 5, 6, 9, 10, 11, 0};
// There is a concept of "persistence of vision" with LED's. The LED has to be on long enough
// for the eye to recognise that it is on. When a high volume is received on a frequency band,
// The LED is turned on (at a high PWM value) and then gradually faded until the next beat in
// that frequency.
int ledPWMValue[NUM_FREQUENCY_BANDS] = {0, 0, 0, 0, 0, 0, 0};
void setup() {
// Set the LED pins as outputs
for (int i=0; i<NUM_FREQUENCY_BANDS; i++)
pinMode(led[i], OUTPUT);
// Set up the MSGEQ7 IC
pinMode(MSGEQ7_ANALOG_PIN, INPUT);
pinMode(MSGEQ7_STROBE_PIN, OUTPUT);
pinMode(MSGEQ7_RESET_PIN, OUTPUT);
digitalWrite(MSGEQ7_RESET_PIN, LOW);
digitalWrite(MSGEQ7_STROBE_PIN, HIGH);
}
// This loop executes around 100 times per second
void loop() {
int frequencyBandVolume;
// Toggle the RESET pin of the MSGEQ7 to start reading from the lowest frequency band
digitalWrite(MSGEQ7_RESET_PIN, HIGH);
digitalWrite(MSGEQ7_RESET_PIN, LOW);
// Read the volume in every frequency band from the MSGEQ7
for (int i=0; i<NUM_FREQUENCY_BANDS; i++) {
digitalWrite(MSGEQ7_STROBE_PIN, LOW);
// delayMicroseconds(20); // Allow the output to settle
frequencyBandVolume = analogRead(MSGEQ7_ANALOG_PIN);
digitalWrite(MSGEQ7_STROBE_PIN, HIGH);
// The read value is 10-bit (0 to 1024). PWM needs a value from 0 to 255, so divide by 4
frequencyBandVolume = frequencyBandVolume >> 2;
// Fade the current LED value for this band
ledPWMValue[i] = ledPWMValue[i] > 7? ledPWMValue[i] - 7 : 0;
// Don't show the lower values
if ((frequencyBandVolume > 70) && (frequencyBandVolume < 100)){
// If the new volume is greater than that currently being showed then show the higher volume
if (frequencyBandVolume > ledPWMValue[i])
ledPWMValue[i] = frequencyBandVolume;
}
if (frequencyBandVolume > 220) {
// If the new volume is greater than that currently being showed then show the higher volume
if (frequencyBandVolume > ledPWMValue[i])
ledPWMValue[i] = frequencyBandVolume;
}
// Set the LED PWM value to the frequency band's volume
analogWrite(led[i], ledPWMValue[i]);
}
// Wait before executing this loop again
//delay(2);
}
Habs getestet und funtkioniert nicht ._.
Weiß wirklich nicht, wie ich es falsch vertratet haben soll.
Am Aux-Kabel vllt.? Dort ist doch Rot - Rechts, Weiß - Links (vllt. auch andersrum) und Draht ohne Farbe/Isolierung GND?
Der AudioEingang vom Chip ist mit meinem SMartphone verbunden. Ich hab es aber auch schon mit meinem Notebook versucht, ging auch nciht.
Habe beides mit normaler Musik (z.b. Fade) getestet. Am notebook zusätzlich ncoh mit einem NCH Tone Generator der die Frequenz wiedergeben sollte...
Nach wie vor, passiert nichts.... :c
Habe aber mal das AudioSignal überprüft, indem ich n LAutsprecher noch mit angehängt habe.
Musik wird auf jedenFAll mal übertragen.
Müsste also doch irgendwie an der Schaltung liegen ._.