best/cheapest sound amplitude sensor and/or code?

hi all

whats the easiest, cheapest sound amplitude sensor out there?

i just want something that detects sound amplitude and responds accordingly.

also if anyone knows nay good sound sensor code examples (not Knock - that seems more aimed at vibration), they'd be much appreciated :slight_smile:

cheers, auto

Check on Sparkfun: SparkFun Electret Microphone Breakout - BOB-12758 - SparkFun Electronics
Or you can build one using breadboard, electret mic and OPA, and just download code from them :slight_smile:

It rather depends on what you mean by amplitude - instanteous, averaged, and what bandwidth you are talking about… Best and cheapest are mutually exclusive I think.

Hi - thanks, I might take a look at that breakout board.

Can anyone recommend code for detecting sounds exceeding certain absolute values?

Something like if sound > 100db then the LED will light up....

Decibels for the purposes of human hearing are not the same as decibels in the electronic domain - for human hearing the ear's frequency response is compensated for. So if you want accurate measurement of sound volume from a human PoV you'll need to emulate this frequency response curve.

However if you are only interested in a rough level you only really need a peak level detector along the lines of:

  int value = analogRead (AUDIO) - zero_level ;
  if (abs(value) > threshold)
  {
    digitalWrite (LED, HIGH) ;
  }