Go Down

Topic: Electret Microphone (Read 3284 times) previous topic - next topic


I'm kind of new to audio with arduino and I wanted to get data from my electret microphone. I tried using a basic circuit (picture posted below) that I found online. However, when I use this, all I get as an output is 1023. There is no fluctuation what so ever. I'm also using this code to test it.

int sensorPin = A0;    //Microphone Sensor 'ANALOG' pin on Arduino
int aLED = 13;   

int sensorValue = 0;

void setup() {
  pinMode(aLED, OUTPUT);

void loop() {

  sensorValue = analogRead(sensorPin);   

  if (sensorValue<869){
    digitalWrite(aLED, HIGH);

} else {
    digitalWrite(aLED, LOW);


Can someone help me?


Can you put more details on hardware, what kind of transistor, cap and resistors ?


Transistor is a 2N3906
Cpacitor is a .1 uF
2 of the resistors that have the same color bands are each 10 K ohm resistor
the final resistor is a 100 K ohm resistor.


2N3906 is PNP, but wiring looks for NPN,
Option: change to 2N3904 or 2N2222.
   change wiring, you can get it works with reverse polarity and switching E - C compare what you have now


Thanks alot that's what did it! Also another question. on all forums i've read, when an input is given to the electret microphone, the value on the serial reader should go down (usually around 860 and the 750-800 when blown on) how ever with this set up, im getting about 136 when its in a silent room and it actually spikes up to about 900 when blown on lightly. When its receiving input, is it increasing it's impedance?


It's can go ether way, up or down. Analog input reading AC voltage (with DC offset).
Read at wiki how to calculate :


Alright thanks alot. One last thing. When i do get readings its not very consistent. If i blow into the mike it spike really high but if you look at the serial read it rapidly shifts from 900 to bewteen 30 and 40 so when i test it with the LED, it flickers. Any idea how to fix this? Also 130-900 is a huge jump for blowing on it lightly, how to i make it a little less sensitive so i can really control something with sound?


arduino IDE has an File / Example / 03 Analog / Smoothing. study how it works.
Than find this line:
Code: [Select]
  // read from the sensor: 
  readings[index] = analogRead(inputPin);
and change it to:
Code: [Select]
  // read from the sensor: 
  readings[index] =  (analogRead(inputPin) - 136);
  readings[index] = readings[index] * readings[index];
136 - is a value you are reading in silence

Go Up