Tuesday, March 6, 2012

Using Condenser Mics with Arduino + OPAMP

Whether for a DIY clapper or an autonomous robot, condenser mics are great for use with a Arduino. But, they don't output high enough voltage for the Arduino to detect (the loudness of the sound the mix picks up varies the voltage it outputs). So, i used use a LM386 OPAMP to boost the output. Just for fun i used it to trigger an LED, which could be replaced with something fancier, say a MOC/TRIAC and a lamp etc.

 * Monitor for sound sensor

int micPin = 2;    // select the input pin
int ledPin = 13;   // select the pin for the LED
int val = 0;
int amp = 0;

void setup() {
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT

void loop() {
  val = analogRead(micPin);
  amp = (val >= 512) ? val - 512 : 512 - val; //it is a ternary operator. X = A ? B : C; if A is true X = B, otherwise C
  if (amp > 100)
    digitalWrite(ledPin, HIGH);
    digitalWrite(ledPin, LOW);


  1. If you want your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you got to watch this video
    right away...

    (VIDEO) Win your ex back with TEXT messages?

  2. There is shocking news in the sports betting world.

    It's been said that every bettor must watch this,

    Watch this now or stop placing bets on sports...

    Sports Cash System - SPORTS CASINO ROBOT