Electronic – arduino – use a PNP Transistor with an Electret Microphone to get an non-inverting output for the Arduino

amplifierarduinoaudiomicrophonepnp

I'm looking to simply read the generic sound level from an Electret Microphone. I've seen a number of schematics with NPN transistors, that will provide an inverted output (~5V when quiet, ~0V when loud, linear operation in between).

Here's an example:

Simple Audio Preamp

However, I would like non-inverted output (linear operation, super quiet input gives ~0V, super loud input gives ~5V). I realize I could easily correct for this in software, but it just seems backward to me in a way and I cannot find any examples of a non-inverting output with a PNP transistor.

Is there a reason for this beyond being uncommon? If it's possible, could anyone provide a schematic of an electret microphone and PNP transistor that will give ~0V when quiet and ~5V when loud?

Further, is there some reason why this is so uncommon, or undesirable? NPNs seem to be used much more often than PNPs, why is this?

Edit

It seems I was rather confused in what I would get as output from the NPN preamp, which would be 0V for silence, and +/- Vin / 2. Here's what I want instead:

0V when silent, ~2.5V in medium sound levels, ~5V in maximum sound levels. This could be read by the ADC easily into 'sound level' without much work at all. However, I cannot feed voltages < 0V or > 5V to the analog comparator. It looks like I want the above with an envelope detector, however that would only get me from 0V to 2.5V. How do I make it vary the full 0V to 5V, 0V being 'quiet' and 5V being 'loud', with everything in between linear?

Best Answer

As far as I understood, you are trying to make some kind of a sound level detector, which will let you detect if there is a sound with a certain volume or not. You can do this with minor changes to the schematic you have. But before that, you should understand the circuit.

Let's break that circuit down. First of all the part with the microphone.

enter image description here

R1 is for supplying power that is needed by the microphone and this is called biasing the microphone. A microphone generates an AC voltage, which is sometimes negative and sometimes positive and it changes most of the time. Think of a sine wave. But remember, we had some biasing to it which is a DC voltage. We have to take that out and give only the AC voltage to the amplifier. And doing this is easy with a simple, single capacitor. A capacitor does not let the DC to pass, but lets AC pass easily. We have blocked the DC portion of the voltage on the electret microphone.

Now, let's look at the amplifier itself. Imagine that there is nothing else but the below schematic:

enter image description here

In this configuration, the transistor is biased to be in the linear region. It is in the edge of being turned ON or turned OFF, but it is neither of it. If it was fully ON, it would be saturated. If it was fully OFF, it would be not conducting at all. But it is in the middle, which is called the linear region.

When it is configured like that, if you touch (not literally) to the base of it, creating a small change, the output will be changing largely. This is what amplification called. You can beg Google for more detailed information.

What if we combine the two circuits mentioned above. A biased electret microphone with a capacitor will output small changes with respect to sound. The transistor will amplify these small changes so they can be viewed easily:

enter image description here

Notice that I have changed C1 to 1uF. You can use values up to 100uF. You will probably need electrolytic capacitors. Also, notice that there is no more an output capacitor. This means that you will have an output voltage somewhere between 0 and 5 V, depending on the sound level. If you have an oscilloscope, view the waveform on the output. If you do not, try lighting an LED if the analog read is higher than, for example, 750. Experiment with different values than 750, then report me the results.