Electret microphone amplifier

 

This project shows how to set up an electret microphone amplifier and let it control RGB LEDs.

The RGB Lamp

The built of the RGB lamp can be found on the corresponding electromaker page.

Amplification

The circuit used in this project uses the dual op amp chip LM358 and a cheap electret capsule. Both op amp are utilized along two potentiometers and a few other passive components.

The signal is received from the microphone capsule using a 10kΩ resistor between the collector pin (+) and Vcc (3.3V/5V). The pin can be identified since the emitter pin (-) is connected to the outer shell of the capsule.

The Vcc voltage between the resistor and the capsule is affected by the sound. The voltage amplitude is very low (~20mV) and has a DC offset of around 0.8V.  Since the voltage and current is very low a buffer stage is used to amplify the current and avoid noise.

After that we get rid of the uncontrolled DC offset using a 100nF capacitor resulting in a AC voltage that is centered around 0V.

A high Ohms value (100kΩ and higher) trimmer or potientiometer is used a voltage divider to shift the AC signal to a level where the complete signal ends up in the positive voltage range.

This controlled DC signal is then amplified using a simple non inverting voltage amplifier using the second op amp and a potentiometer. The poti is used to divide the output voltage and use it as feed back. The op amp tries to equalize the feedback signal to the input signal to the resulting voltage will be amplified.

Code

The output of the amplifier is connected to the A0 pin of the microcontroller. A simple test sketch can be used to display the values read from the microphone in the Arduino plotter.

void setup() 
{
 Serial.begin(115200);
}

void loop() 
{
 delayMicroseconds(1000);
 Serial.println(analogRead(A0));
}

The baud rate has to be set to 115200 in the plotter.

The complete project code can be found in the repository
https://github.com/bitluni/MQTTLights

To be continued…