Condenser mic as a sound sensor

hi every one,
in the last couple of days i've been searching the web about info about Mic's & Arduino. but i couldn't find somthing simple as i need.
i want to have a sound sensor that give the arduino an input - could be low range = i need to recognize an explosion, shattering... etc.
i found this circuit:
http://www.josepino.com/circuits/index?mini_amplifier_lm386.jpc

it uses LM386 as a preAmplifier, But can i use the exact same circuit for my purpose? instead of connecting to a speaker i'll connect to an Arduino analog input pin.
Thanx :slight_smile:

I assume you want to use an electret mic and not a condenser mic.

The LM386 is to drive a speaker.
Since you want to recognize loud sounds, a single transistor would do.

The Arduino is not good with sounds, it is not a DSP chip.
You could do some FFT analysis, but it will be limited.

I assume you want to use an electret mic and not a condenser mic.

I already have the condenser Mic
the only thing i need from the sensor is to give me input if there is loud sound (explosion like i mentioned), i'll be happy for explanation to how can i use a transistor for it (i'v NPN & PNP)
AND I FORGOT TO MENTION THAT I'M NEWBIE :slight_smile: SO BE EASY WITH ME
THANX

i stumbled upon this circuit before:

will this be good for my purpose ?
And if it does:

  1. can i connect it straight to the arduino 5V? instead of 9V

  2. how do iknow which "leg" of the mic goes to ground/5V? they are the same

You could take a look at the ABC Guide, pighixxx.com - pighixxx Resources and Information.
Card 7 is how to use an electret mic and a transistor.

I prefer a circuit like the first one on this page, audio - Can I use a PNP Transistor with an Electret Microphone to get an non-inverting output for my Arduino? - Electrical Engineering Stack Exchange
Use it without C2, connect it to an analog input of the Arduino without C2.

Are you sure you have a condenser microphone ?
One that costs more than 100 dollars ?
With an XLR plug and one that requires 48V ?

Or do you have an electret mic that costs about 1 dollar ?

ADDED: While I was typing this post, you found the same schematic (use it without C2). Yes, you can use the Arduino 5V pin to power it. I don't know how to connect the mic, can you upload a photo of it ?

i've a mic that costs less than 1$ :slight_smile: but says condenser:
http://www.taydaelectronics.com/condenser-microphone-2-2k-ohm-1-5v.html

and if i dont need potentiometer, should i use the schematic we both posted? what's the differences between it and "Card 7" ?

It is an electret mic.
One pin has connections (under green paint) to the outside metal. That is the GND.

The schematic we found uses a resistor from the collector to the base of the transistor. That results in a more or less automatic adjustment of the base current. There is almost no disadvantages with it, so that's why I like that schematic.

so y do they write "condenser"? (not that it's matter to me..)

One pin has connections (under green paint) to the outside metal. That is the GND.

So you mean the right leg is GND?

How did you know? the Datasheet is not very clear..
AND does it have to be 100K resistor? because the highest i'v is 10K. so i need to buy.

A condenser mic can be the very expensive mics in a studio and it can be an electret mic. To avoid the confusion, the electret mic was called "electret condenser mic". However, that is not completely true.
Wikipedia writes: "An electret microphone is a type of condenser microphone...", but that is also not completely true.

Some people like the confusion and call them condenser mics.

10k is too low. The best resistor could be 47k to 1M.

Yes, the right pin is connected to the metal outside. That is GND.

Edrin you are Great. but i'm having problems.
i connected everything like here:

and when i'm connecting to 3V i get the range of 697-702. while connecting to 5V i get 1023. it seems like there is no change if there is noise or not. i also tried changing the 100k to 47k - but same results. i tried at first without C2 (the second capacitor) and then with - still no change.
this is the code i wrote:

void setup(){

Serial.begin(9600);
}
void loop(){
  int mic = analogRead(A0);
Serial.println(mic);
delay(65);
}

It seems as if the transistor is doing nothing.
The voltage without C2 should be somewhere in the middle, but anything between 1 and 4V is okay.
If you read 1023, you are reading 5V.

Did you connect the transistor properly ?
If you use a breadboard, it might have bad connections.

You can use "analogRead(0);", with a "0" (a zero).
The term "A0" is used if the analog pin is used as a digital pin.

Can you measure the voltages of the circuit ?
You could also use the analog input to measure the voltages.

The base of the transistor should be between 0.4 and 0.8 Volt.
The voltage on the electret mic is perhaps between 1.5 and 2.5 volt.

i did connect the transistor properly. i'm using breadboard, and i just moved it to another bread board-SAME results :
i've changed the code to: "analogRead(0);"
yes i can measure, but i'm not sure where should i plug the probs to measure what u said....

Measure every point in the circuit.
Beside the GND and the 5V, there are only 3 points (at the electret mic, transistor base, transistor collector).

ok so, i'm sure if i did it good but here are the measurement:

  1. Mic/Gnd = 2.56v
  2. Base/Gnd = 3.07v
  3. Collector/Gnd = 3.37v
    (the black prob always in Gnd, and then 1. mic's positive leg 2. transistor Base leg 3. transistor Collector leg)

Base/gnd cannot be 3V when emitter is on gnd
Check your transistor wiring..
For best setting change the R2 such you get Collector/gnd the half of the battery voltage (when silent)..

I checked the wiring again - reconnect everything - and still the same.
and i'm getting stable result = doesnt matter if the is silent or sound

The voltage of Base/Gnd should be about 0.7V.
If you don't have that, detecting sound is not possible.

Perhaps the transistor is blown, or perhaps you have the Base, Emitter and Collector are mixed up.
Could you try another NPN transistor ?

i just tried another NPN - still the same.
AND Emitter/Gnd is 2.55. Shouldnt it be 0??

**edit-and i also tried to connect the NPN in different way but not much of a change in voltage

What transistor do you use - type, package?

and i also tried to connect the NPN in different way but not much of a change in voltage

There is only one way how to connect the transistor - exactly according to the schematics..

AND Emitter/Gnd is 2.55. Shouldnt it be 0??

Yes it should so if there is a voltage between emitter and ground you have not connected it up like your diagram. This is because the emitter and ground are connected up together so there can not possibly be any voltage between them. If there is a voltage then they are not connected together.
The emitter is the one with the arrow on it.