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);
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();
}
See pics for breadboarding and setup. I'm using my iPhone for audio input, and I've verified that I am using the ground and the left channel.
I don't remember the wiring offhand to see if thaats right, but I remember when I first starting playing around with the msgeq7 the biggest problem was miswiring, aalso I couldn't tell from the pic but make sure the audio source ground is connected properly
do you have an a small speaker you can connect to the audio source using the same connections? Idk how you connected to it but sometimes if you just cut the cord off eearphones that wire is enameled and maybe its not connected well enough, if you have an oscilloscope take a look at the audio while its connected as well as the output of the msgeq7 and see if it doesn't match the arduinos serial output
Also idk how much experience you have with breadboards or the specs on that one but make sure the rails are connected all the way across, I notice to get a ground from the middle of the rail and usually the rails are actually separated in groups
Input of the audio or input of the 5V?
I want to do a similar project using following scematic, but there's no 22k before audio input too there and I don't want to blow my chip up:
Audio out from an iPhone is at least 1 V pk to pk. The chip input should be 100 mV. Your audio input should be AC coupled with a 10: 1 voltage divider to reduce the input to 100 mV. As noted, you're missing both of the 22k ohm resistors on the input. (one for the L , one for the R)
raschemmel:
Audio out from an iPhone is at least 1 V pk to pk. The chip input should be 100 mV. Your audio input should be AC coupled with a 10: 1 voltage divider to reduce the input to 100 mV. As noted, you're missing both of the 22k ohm resistors on the input. (one for the L , one for the R)
Tanks for your answer, but I'm still not following completely, sorry :-[
I had already taken a look at most of the four tutorials you gave, but can't find anywhere a voltage divider on the 'audio in'.
So is that 22k ohm resistor part of the voltage divider? Or is the 10:1 voltage divider something apart from that 22k resistor?
And when I split up the sound with a Y-splitter first (between my speakers and my Arduino input), would that make me in need of a 5:1 divider instead of a 10:1?
EDIT: I found following scmatic of the 2 22k ohm resistors:
Guess that's exactly what you were talking about. So do I still need to add a voltage divider now?
And I only have 20k and 2350 ohm(2x 47k parallel) . I guess that can't be a problem?
I would add a potentiometer with the signal input at one end, ground at the other and the wiper connected to the 22 k ohm resistors . This allows you to control the amplitude. If the pot is unnecessary, you'll find out if you have to turn it all the way up to get the chip to work and you
will not risk blowing the chip. The pot would replace the 10:1 voltage divider. You can try a pot
on one input only to test it. More than likely the 22 k ohm resistors are "dropping resistors" to
limit the input current and the chip schematic assumes a standard LINE LEVEL signal, and the pots are not necessary. (all cell phones have headphone volume controls anyway)