Electret Microphone PreAmp

Hi ! :slight_smile:

I'm trying to do a LED volum meter with an electret microphone. I have this preamplifier circuit shown in the tutorial: LED Sound Meter - Make:

My question is that if there is a better circuit amplifier out there OR if i can make any changes on the current one, for better analog reads. I'm not quite satisfied with the current one. I speak loud, it senses like 2-3 values bigger than 500. If i don't say anything and let the Serial Monitor cascade with it's values, it keeps rising...from 25 to....300-400-500...not good... .

And most of all, explain me how this type of circuit works! How can i refine it as i wish?

UPDATE: I USE Intel Galileo Gen2
and source 5V



Microphone \ Learning \ Wiring may this one be better?

It would be easier for you to get mic with preamp, adafruit and sparkfun sell them.

What are you trying to achieve?
That processor will not sample analogue fast enough to see a waveform which is what that circuit will produce.
You have not biased he audio at half way on the analogue input.

A reading of 512 is to be expected for no audio input. Then speaking will send that up or down.

I managed to get rid of the rising values when doing nothing. Now it's staying constant at values around 50-60. And when speaking, close to the microphone, i have an interval of 90 - 300. I've done a code for this interval, but wondering if i could make it more sensible after 400.
It would be easier for me to buy a done and plug module, but i don't want that. Doing my way is more practical and i learn more.
Explain me pls the bias part, Grumpy. What should i add to the circuit? What should i do. I'll watch further tutorials, but a response would be helpful as well from you.

Any additinal information? Tell me and i post!

i think this is my case

But i see he's requesting for a dynamic microphone, not electret one...

UPDATE: i tried the first biased circuit in the link above! This one:

The practical part:

Serial Monitor is now biased i assume, BUT doesn' t change when i make a sound !!!!

Added a 10k resistor from the left pin of the input capacitor, to the 5V source. Now my values change slightly. But, it's very strange...only 3-4 values in range of 600-800, and i shouted for 2 seconds ( delay(1) ).

The circuit in reply #5 is correct providing the +v is set to the working voltage of the inputs. I am not sure if this is 5V or 3V3. Then the two 100K resistors are too high, change them to 10K.
Without any input you will get a reading of 512 or there a outs. If you don't then fix that problem first.

Then the lack of any change is down to the gain of the amplifier, you will probably need an other transistor stage.
Do not use any delay between reading the poor thing is slow enough.

What are you trying to achieve with this project?

I'm trying to build a volume meter displayed by leds. For this, i use this electret microphone to read my voice sound intensity. The bigger the sound intensity (bigger analog reads), the more leds opened. . My wish was that i could read a wider range of analog values and have a clear sound captation. I hope you understand :slight_smile: sorry for my english

UPDATE: and, of course, to understand the preamplifier circuit. I don't want to buy an already built one, but to make one myself !

I'll leave a message when i change the 100k's in 10k's !

My project looks like this:

There are changes in this circuit at the moment: it reads some bigger values than 521. When there is no input signal, no sound: i have 520-521 constantly.

But still...can't really see major changes...these are values i read when i'm sending a beep sound. Why sometimes it drops below 500 even when it's loud?

Why sometimes it drops below 500 even when it's loud?

Because sound consists of positive and negative going signals. Yes that is what you will see.

I'm trying to build a volume meter displayed by leds

Then you are not using the right circuit, you need a peak detector.

So, i need a Peak Detector Circuit for this kind of projects: Vúmetro de leds + Mic Electret / Led Vumeter with Electret Microphone - YouTube

...cool, looking on the wrong direction :frowning: ...

So, i need a Peak Detector Circuit for this kind of projects:

If you are going to use an Arduino then yes.
There is no Arduino in that circuit though.
You could use a LM3916, or LM3915 then there is no need for a peak detector as it is built into the chip.

i found this:

  1. LM358 microphone amplifier | Low voltage. Mostly harmless...
  2. Electret microphone amplifier – Arduino, ESP8266, ESP32 & Raspberry Pi stuff

not you're regulators, but it's a start i think...when i buy all the necesarry components and make the adjustments i'll let you know ! thank you very much !!!

but it's a start i think

I am not impressed with those.

  1. has no peak detector or biasing.
  2. the same except the 741 circuit, that looks OK apart from the 741, that can't work off a single 5V rail so use a better op amp. Maybe use the first circuit on the page and add, D2, C3 & R5 from the 741 circuit.

But still...can't really see major changes...these are values i read when i'm sending a beep sound. Why sometimes it drops below 500 even when it's loud?

Your readings look good. Assuming it's biased at 512, quiet sounds should go slightly above AND below 512. Louder sounds will give you greater variation, and if you go loud enough the readings might cover the full ADC range from zero to 1023.

You have several options - You can ignore any readings below 512, and/or you can subtract 512 from the reading, or you can subtract 512 and then take the absolute value (making all of the values positive).

The [u]Audacity website[/u] has a little introduction to digital audio. Notice how once per cycle you hit a positive peak and an negative peak. Twice per cycle you cross through zero, and most of the samples fall in-between. A loud sound will also read zero twice per cycle (or it will read 512 twice per cycle if it's biased at 512). And, that's assuming you happen to sample exactly at the zero-crossing.

The Audacity tutorial shows a "normal" (unbiased) audio signal that goes positive and negative.

thanks for the info ! :smiley:

Been gone for a while. In time i've managed to wire a lm386 and i'm happy to say i'm pleased with my results. Peaks: 128-902 (with a default gain of x20). Silence: 485-540.
Now the code ! I've done something and it works pretty well. But some upgrades? How can i obtain more sensibility through the code? And i say that because, sometimes, led's 5-9 don't reach their intervals even when it's quite loud. Here it is:

  • one led stays on when it's silence, in other case when it's not silence, it's OFF
  • next 9 leds are the sensible ones, depending on the microphone output
  • last led when has reached its peaks, turns all leds ON, without the silence one

EDIT: my current void loop, can i bring any upgrades to the code?

void loop(){

  
  semnal=analogRead(A0); 
  Serial.println(semnal);
  if(semnal> 465 && semnal<540){
    stingeLed(1);
    aprindeLed(1);
  }
  else  
  if(semnal>446&&semnal<579){
    stingeLed(2);
    aprindeLed(2);
  }
  else if(semnal>407&&semnal<618){
    stingeLed(3);
    aprindeLed(3);
  }
  else if(semnal>368&&semnal<657){
    stingeLed(4);
    aprindeLed(4);
  }
  else if(semnal>339&&semnal<690){
    stingeLed(5);
    aprindeLed(5);
  }
  else if(semnal>298&&semnal<732){
    stingeLed(6);
    aprindeLed(6);
  }
  else if(semnal>265&&semnal<765){
    stingeLed(7);
    aprindeLed(7);
  }
  else if(semnal>235&&semnal<795){
    stingeLed(8);
    aprindeLed(8);
  }
  else if(semnal>170&&semnal<835){
    stingeLed(9);
    aprindeLed(9);
  }
  aprindeTot(130,890);  // pragul de zgomot
  
}

void aprindeLed(int nr){
    for(int i=1;i<=nr;i++){
      digitalWrite(i,HIGH);
    }
    delay(10);
}

void stingeLed(int deUnde){
  for(int i=deUnde;i>=1;i--)
    digitalWrite(i,LOW);
}


void aprindeTot(int minim, int maxim){
  if(minim>semnal || maxim<semnal){
    for(int i=1; i<11; i++)
      digitalWrite(i,HIGH);
    //counter++;  
    //LcdXY(17,2);
    //LcdWriteString(dtostrf(counter,5,0,string));
  }
  else{
    for(int i=10;i>=1;i--)
      digitalWrite(i,LOW);    
  }
}

Or can someone give me his model of code and explain it to me how it works? In mine i divided my peak results equally, almost.

How can i obtain more sensibility through the code?

Just a friendly note, the word you are looking for is sensitivity, not sensibility.

There is nothing you can do with the code to increase the sensitivity because that would imply you can get something from nothing. The sensitivity is fixed by your hardware.

You could increase the gain of your amplifier, that would increase the sensitive but you would still have the same dynamic range, that is 10 bits, so you will overload on loud sounds.

The only real way is to use an external A/D with more bits.

Got it ! thanks for everything. Sorry for the misspelling ! I found out how to set the gain on my lm386, but i think it's okay on default, that is 20 (+i have all the components for this, for the others i need various resistors to put in series with a couplying capacitor at pin 1-8). Too much gain i understand it could increase noise as well.