LM386 + Electret Mic

Hey all,

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.

I seem to have got it working now (maybe) it was working before, I just have a speaker connected and it seems to be amplifier sound.

The problem is the output seems to be noisy and reading doesn't seem to be meaningful. Any ideas?

Good to hear you are making progress.

What meaning are you hoping to see?

Perhaps if you say more about what you want your project to do and the code you are using to test, it would be easier to give assistance.

I used the same code on that page atm:

/*
 * 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???)

The line that sets the variable amp to a positive or negative value does not seem appropriate for what you want to do.

I would think that you just want to check if the value from analog read is above a threshold.

What kind of values do you get when its quiet and when someone makes noise?

I would put a peak detector (resistors and diode) between the op amp and the arduino input as that is what you want to measure.

I would put a peak detector (resistors and diode) between the op amp and the arduino input as that is what you want to measure.

mike, did you intend to say: diode and capacitor

Yep I did, sorry :wink: