Hi all.
Im currently working on a final year project at University that requires LED's to be driven by audio input.
I am new to Arduino and fairly new to electronics, and have been following multiple tutorials online.
The issue I am having at the moment is microphone sensitivity, as the mic only picks up audio which is very close to it. I have been using headphones pushed up against the mic to monitor the reaction of the LED's. See video: Dropbox - Error - Simplify your life
I have replaced the breakout board with an Electret Mic and LM358N Op-amp, to avoid the use of pre-made circuits as much as possible and with the hopes that the microphone would be more sensitive and work without the use of headphones in close proximity.
Here is the current setup on breadboards:
Here is the code I am using, which is taken from: http://www.baldengineer.com/projects/msgeq7-simple-spectrum-analyzer/ and adjusted slightly:
#define msg7RESET 13
#define msg7Strobe 12
#define msg7DCout 0
#define pushButton 2
const int LEDpins[7] = {3,5,6,9,9,10,11}; // there are 5 LEDs and 7 freq bands. So, repeat LEDs
void setup() {
Serial.begin(9600);
for (int x=0; x<7; x++) {
pinMode(LEDpins[x], OUTPUT);
}
pinMode(msg7RESET, OUTPUT);
pinMode(msg7Strobe, OUTPUT);
pinMode(pushButton, INPUT); // never actually used in this example.
digitalWrite(pushButton, HIGH); // Enable internal pull-up
}
void loop() {
digitalWrite(msg7RESET, HIGH); // reset the MSGEQ7's counter
delay(5);
digitalWrite(msg7RESET, LOW);
for (int x = 0; x < 7; x++){
digitalWrite(msg7Strobe, LOW); // output each DC value for each freq band
delayMicroseconds(35); // to allow the output to settle
int spectrumRead = analogRead(msg7DCout);
int PWMvalue = map(spectrumRead, 0, 1024, 0, 255); // scale analogRead's value to Write's 255 max
if (PWMvalue < 50)
PWMvalue = PWMvalue / 2; // bit of a noise filter, so the LEDs turn off at low levels
analogWrite(LEDpins[x], PWMvalue);
Serial.print("x: ");
Serial.print(x, DEC);
Serial.print("eq_output: ");
Serial.print(spectrumRead, DEC);
Serial.print(" pwm: ");
Serial.println(PWMvalue, DEC);
digitalWrite(msg7Strobe, HIGH);
Serial.print(msg7Strobe);
}
}
If anyone could offer some advice as to why the microphone isn't picking up sound that well, I would be very thankful! This has been hurting my head for a few days now. Cheers.