Sunday, September 18, 2011

Sound/noise sensor for Arduino

For quite some time I’ve been looking for some sort of sound or noise sensor. I had some electrolytic microphones lying around, so the only problem was amplifier. 



Well you can choose either some IC or some simple transistor ones. At first I’ve tried LM386, but I found out that it’s not very good. The reason is that this IC is not meant to be used as a pre-amp. I’ve decided to use this single transistor setup with 2N3904. I’ve also bought big white board and drawn the circuit. It’s really cheap sound/noise detecting sensor and it work’s good.

Arduino code :

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

void loop()
{
 int minimum = 1024;
 int maximum = 0;
 for(int i=0;i<1000;i++)
 {
  int value = analogRead(A0); 
  minimum = min(minimum, value);
  maximum = max(maximum, value);
 }
 Serial.print("noise=");
 Serial.print(maximum-minimum);
 Serial.println(); 
}



2 comments:

  1. Cool, I am going to build exactly this as well. Ia there any feedback on precision / linearity / frequency range / temperature distortion?
    Would be highly appreciated if shared.
    Jaroslav

    ReplyDelete
    Replies
    1. Hi :) Well it's not very precise, so it could be used ideally for something like clap sensor.

      Delete