The circuit is okay (not ideal for quality but it will work), but there's one small issue if you want to feed the output to your Arduino. As shown, the output will swing below ground (i.e. it will be biased at 0V) and your Arduinos analog input will only accept positive voltages.
The output with the above circuit will be something like this:
If your supply is 5V, you need to bias the output to 2.5V to get the maximum swing from your input signal.
Adding a voltage divider after the capacitor will do this:
The voltage divider is made from R2 and R4, and it biases (read "holds") the TO_ADC
node at 2.5V so the ADC pin sees the full swing of the signal. Without it the ADC would only see the positive half of the signal, because we have no negative power supply present.
The formula for a voltage divider is:
So for the voltage divider formed from R2 and R4, with the 5V supply we get:
5V * (R4 / (R2 + R4) which equals:
5V * (100kΩ / (100kΩ + 100kΩ) = 5V / 0.5 = 2.5V at the middle (Vout in the above example diagram, which is the TO_ADC
node in our circuit)
Then the output will be more like this (depending on your ADCs input impedance it may not work well though - this is the bit that is simulated by Radc and Cadc, I'll check this shortly):
There are other options also, I will try and post an improved circuit shortly.
Okay, here's an option which controls the transistor gain properly (using the emitter resistor with AC bypass) and outputs a lower impedance signal that swings around ~2.5V (V+ is 5V - the capacitors do not have to be as large as 10uF, you can still use 100nF if you wish for your input capacitor):
Radc and Cadc
Radc and Cadc are not components you need to add (so you can ignore them if/when you make the circuit), they represent your microcontrollers analogue input pin characteristics. Some microcontroller ADCs can have quite low input impedances which can load your signal and attenuate it (so basically you end up with a lower reading than you expected)
So when we simulate, it's good to add this simulated loading to make sure the signal will not be affected too badly.
Simulation (note simulated ADC loading also):
We can see this handles a 20mV input pretty well, if we input 20mV to the original circuit (even without any loading), we get some distortion due to the uneven gain (note flattened edges on negative swing):
There are still better options and variations (the above may need the values tweaking a little) A simple opamp circuit would be one, but it depends on how concerned you are about the sound quality whether you would want to bother. If you're happy with a bit of distortion, then the first circuit with a suitable method of biasing will be fine.
Although you could do this whole thing with just an amplifier and a microcontroller (Arduino), as far as I can see, you want the analog option. I have tried to create a circuit that outputs the voice level on the microphone. The range is from 0V to 4V. However, you can upgrade it easily to 0V to 5V by just changing the OP-AMP. Now, let's go into it;
First of all, I have replaced the transistor amplifier with the OP-AMP. Here is what I came up with;
This is a simple inverting amplifier with a gain of 100. Here is the formula to calculate the gain;
$$ V_{out}=-\dfrac{R_f}{R_{in}}*V_{in} = -\dfrac{100k}{R_{in}}*V_{in} = -100*Vin $$
As you can see, U1 takes the input signal, inverts it and then multiplies it with 100. You can change R2 or R3 and you will see that the gain of U1 changes. Inversion of the input signal does not matter here, as you will understand later on. Let's look at the output of this amplifier, and you will see that there is a big growth on the input signal.
In the above graphic, you will see that output has a DC offset voltage of 2.5 volts. That is because of the virtual ground we have used. If we create a virtual ground, that means we carry the ground to an another voltage level. In this case we have moved it to 2.5 V. With the new configuration, we have created something that looks like -2.5 V, 0 V, and 2.5 V to the circuit. In order to achieve this, I had to create a new voltage rail of 2.5 volts. Since that voltage rail will not supply much power, (less than 1 mA), it is easy to create;
Notice the negative feedback on the above circuit. That will give the OP-AMP the order to make \$V+=V-\$. OP-AMP will do its best to achieve this equation. Thus, the output will be 2.5 V, or in other words, half the supply voltage. And that is our new ground point.
After the amplification, we should put the signal on to an "envelope detector" or in other words, "envelope follower". This will get the level of the signal, as you wish and as you showed in the picture in your question. Here is what a basic envelope follower looks like:
It looks all great, however, notice that here, D3 is a diode and it drops about 0.6 V on itself. So, you loose the voltage. In order to overcome this, we are going to use what is called the "super-diode". It is super, since the voltage drop is almost 0V! In order to achieve that, we include an OP-AMP with a diode, and that is all! The OP-AMP will compensate the voltage drop of the diode, and you will have an almost ideal diode;
Since there is negative feedback in this configuration, U5 will try its best to make \$V+=V-\$. So, whenever the input is say 3V, it will make its output 3.6V to compensate with the 0.6V voltage drop on D3. So, the output of this super-diode, hence the \$V-\$ input will be equal to its input voltage \$V-\$. However, when the \$V+\$ input is negative, D3 will not allow U5 to make the output negative. Also note that the negative rail for U5 is GND, which is 0 V. It will not be able to go below 0 V in any case, already. It works just like an ideal diode!
Now, change D3 in the above envelope follower circuit with a super-diode, and you have a better envelope follower! Let's look at our result;
We are getting close. As you can see, the output of the envelope follower, which is the red line, can go from 2.5 V to 4 V. 2.5 V is no-sound, 4 V is loud-sound and 3.25 V for medium-sound. To scale that to what you have wanted, we can subtract 2.5 V offset voltage and scale it. So, when you subtract 2.5 V, it becomes; 0 V for no-sound, 1.5 V is loud-sound and 0.75 V for medium-sound and so on. After that, if you multiply this with about 3, you will get what you exactly want. 0 V for no sound, 2.5 V for medium-sound and 5 V for loud-sound. To recap, what we want is this;
\$V_{out}=(V_{in} - 2.5V) * 3 \$
In order to achieve this, we will use a differential amplifier or in other words a "subtractor".
When resistors, R1 = R2 and R3 = R4 the transfer function for the differential amplifier can be simplified to the following expression:
$$V_{out}=\dfrac{R_3}{R_1}*(V2-V1)$$
If you make V1= 2.5V and R3/R1 ratio 3, then you will get the output you wish.
Here is the complete schematic that will do what you want:
I have used LM324 OP-AMP here for simulation purposes. That will limit the maximum output voltage to 4V. In order to have full range output, you should use a rail-to-rail output OP-AMP. I would suggest MCP6004. Change R1 and R2 until you have the desired result. Here is what I got with the simulation:
Now, when measuring these values in ADC, you will not get a linear sense, instead sound is better understood logarithmic, since our ears hear that way. So, you should use decibels. If you are not familiar with decibels, here is a great video tutorial about it.
A quiet room, for example is measured to be around 40 dB. A party in a room will make the room's level go up to 100 dB, or maybe 110 dB. In this website, you can find great info about it, from where I also have embedded below image. Think about the decibel levels and experiment with the voltage output of the circuit. Then, calculate the ADC resolution that you will need. Probably, you will be fine with an 12-bit ADC.
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.
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:
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:
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.