Electret Ear

Views: 20001 Difficulty: 2 Status: Complete

A breakout board for an electret condenser microphone shaped like an ear.

To get the sound values from an electret microphone into an arduino you have to amplify them. We use these mics in a ton of our projects. This ear-shaped board uses the LM386 amplifier (and a couple resistors and capacitors) to give a nice arduino-detectable signal. See the code below on how to detect volume from the analog waveform. You can get your own ear-shaped board at our store. Sparkfun also offers a condenser microphone breakout board similar to ours in terms of the schematic, but theirs doesn't look like an ear! Adafruit also offers a breakout board and theirs has adjustable gain.

Silkscreen Ear

Onomatopoetic electronics look like what they do. This electret condenser microphone breakout board looks like an ear because it can listen!

Printing Sound Level to the Serial Port Electret Breakout Board Video

Our electret ear hooked up to an arduino via an analog in pin, hooked up to a laptop via USB printing out the sound values to the serial port.

Arduino Code to Detect Volume from Sound Buffer

This program uses an array to keep track of the raw input from the electret microphone. Looking at the variance within this array we can determine the current volume. The array is global and declared at the top of the program:
  const int buffer_size = 15;
  int noises[buffer_size];
The audio waveform is detected by keeping a buffer of sound values from the electret microphone. Every 300 milliseconds we print out the current volume and sound input. The volume or amplitude is detected by finding how much the noise buffer varies. The minimum and maximum variances are kept track of in the lines:
     max_var = max(var, max_var);
     min_var = min(var, min_var);
See the entire code below:
/* LucidTronix Electret Condenser Microphone 
 * Prints out the range of the noise buffer
 * The range of the buffer roughly represents
 * the amplitude of the sound- wave, 
 * So you can use this code to detect sound volume.
const int buffer_size = 10;
int noises[buffer_size];
int cur_index = 0;
int microphone_pin = 3;
unsigned long last_shift = 0;
unsigned long max_var = 0;
unsigned long min_var = 99999999;
void setup() {
  for (int i = 0 ; i < buffer_size; i++) noises[i] = 512;

void loop() {
  // read the value from the sensor:
  noises[cur_index] = analogRead(microphone_pin);
  cur_index = (cur_index + 1) % buffer_size;
  if (millis() - last_shift > 300){
     last_shift = millis();
     unsigned int avg = average(noises, buffer_size);
     unsigned long var = variance(noises, buffer_size);
     max_var = max(var, max_var);
     min_var = min(var, min_var);
     Serial.print("   ~    Raw input:");

int average(int* array, int length){
  int sum = 0;
  int i;
  for(i = 0; i < length ; i++){
    sum += array[i];
  int avg = sum / length ;
  return avg;

unsigned long variance(int* array, int length){
  long sum = 0;
  long avg = average(array, length);
  for(int i = 0; i < length ; i++){
    sum += (array[i] - avg)*(array[i] - avg);
  unsigned long var = sum / length;
  return var;	

Download Arduino Code for Volume using Electret Microphone

Download the Arduino code from above.
Click Here to Download: Download Arduino Code for Volume using Electret Microphone

Download EAGLE files and code

Click on the button below to download a zipped archive of the EAGLE files and some arduino code to get sound into you projects.
Click Here to Download: Download EAGLE files and code


Title Description # Cost Link Picture
Electret Ear PCB Ear shaped electret condenser mic breakout board. 1 $4.0 Link Screen_shot_2013-02-15_at_6.34.37_pm
Electret Condenser Microphone MIC COND ANALOG OMNI -44DB Value: -44dB ±2dB 20Hz ~ 20kHz 1 $0.96 Link Screen_shot_2012-12-28_at_7.35.36_pm
LM386M IC AMP AUDIO PWR .325W AB 8SOIC Value: 4 V ~ 12 V 1 $0.91 Link 8-soic_751
Capacitor CAP CER 10UF 10V Y5V 0805. Ceramic Capacitor. Value: 10µF 3 $0.16 Link 0805(12_5mm_thickness)
Resistor Chip Resistor - Surface Mount RES 10K OHM 1/8W 5% 0805 SMD Value: 10k 1 $0.1 Link Screen_shot_2012-12-28_at_7.29.44_pm
Combine an electret microphone, Arduino and a heart matrix for a sound-sensitive wearable device....
Standalone programmable Heart-Shaped LED display....
The heartduino is a heart-shaped arduino clone complete with onboard sensors and a 70 pixel LED matri...
The MCP79410 breakout board gives easy access to this cute little timekeeper....
This L293D Stepper motor controller lets you precisely control a stepper motor with just two signal l...
Control a 120v outlet with a 5V arduino....
4 Daisy chained CD4021 shift registers gives us 32 inputs....
32 buttons for a fully-functioning hand-held USB keyboard....