I have been trying to get an electret mic interfaced with Arduino. I used this circuit here:
When I connect it to my Arduino, the reading fluctuates around 512~ and does not seem to be picking up any signal from the electret.
So I tried powering it with a 9V battery, I connected the output fom the op-amp to one of the analog input and the GND on the Arduino to the -ve of the battery as well, is that right?
In that case I am just getting a constant value of about 800 from the Arduino. Any help would be appreciated, I will try to post a picture as soon as I find a camera.
Don't use a 9 volt battery in that circuit. You can damage the Arduino inputs if you have more than 5 volts on the pins and all of the 9 volts from that battery could be applied through the opamp.
Double check you wiring, that is a likely cause for not getting the output you expect.
/*
* Monitor for sound sensor
*/
int potPin = 2; // select the input pin for sound sensor
int ledPin = 13; // select the pin for the LED
int val = 0;
int amp = 0;
void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin);
amp = (val >= 512) ? val - 512 : 512 - val;
Serial.println(val);
if (amp > 100) {
digitalWrite(ledPin, HIGH);
delay(20);
}
else {
digitalWrite(ledPin, LOW);
}
}
I would essentially like to see if anyone is around to make noise in a room, from testing so far, the electret is definitely not sensitive enough as a general noise level sensor, but maybe if the input noise (from the power supply) is a bit lower, it would be enough to tell if there are people clicking pens or walking around?
(I have also set up a PIR sensors for motion detection, I was hoping this would complement some of the data)
Thanks
(Edit: Maybe recording peak value will give me some information???)