Nov 092014

I found a small microphone unused in some old box.
I decided I could play with it by plugging it to my arduino.
Was rather easy using the analogread function but it was lacking sensitivity.

Googling around it appeared I needed an op-amp. For less than 2 euros, I could get a 10 pieces batch on ebay.

See below the schematic.
Notice the voltage divider (r3 to 5v, r2 to gnd) to get a 2.5v voltage (5v / 2) : this way, you should read about 512 (1024 / 2) on the analog port when the microphone is off.
Notice the gain as well (r5/r4) which should give me about x75 gain (r5/r4*vin).


The Arduino sketch is rather simple : it will trigger a led when the reading goes about a certain value (that will depend on your mic and r0).

const int analogInPin = A0;  
const int ledPin=13;
int sensorValue = 0;        

void setup() {
  pinMode(ledPin, OUTPUT); 

void loop() {
  digitalWrite(ledPin, LOW);
  sensorValue = analogRead(analogInPin);            
  if (sensorValue>640 || sensorValue<580) {
  Serial.print("sensor = " );                       
  digitalWrite(ledPin, HIGH);  
 Posted by at 16 h 56 min  Tagged with: