Unable to read sound from Adafruit MAX4465

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nargzul
 
Posts: 4
Joined: Tue Apr 23, 2013 12:27 pm

Unable to read sound from Adafruit MAX4465

Post by nargzul »

Hi,

I'm trying to detect if the sound goes above a given level of noise to trigger some relay.

I've setup an Arduino Mini Metro.
Currently, it is only powered by USB.

I've connected it as following:

Code: Select all

MAX4465 <---->   Arduino
Out                    A0(=PIN 14)
GND                   GND
VCC                    3V
And I'm trying the following code:

Code: Select all

int mic = 14;
const int sampleWindow = 50;  // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;

void setup() {
  pinMode(mic, INPUT);
  Serial.begin(9600);
}

void loop() {
  unsigned long startMillis = millis();  // Start of sample window

  // collect data for 50 mS
  Serial.println("------ New round -----");
  while (millis() - startMillis < sampleWindow) {
    sample = analogRead(mic);
    Serial.println(sample);
  }
  delay(5000);
}
I get some output, but no matter the noise I make, it's quite stable around 30.

Code: Select all

17:11:13.999 -> ------ New round -----
17:11:14.030 -> 30
17:11:14.030 -> 30
17:11:14.030 -> 30
17:11:14.030 -> 30
17:11:14.030 -> 29
17:11:14.030 -> 30
17:11:14.062 -> 30
17:11:14.062 -> 30
17:11:14.062 -> 30
17:11:14.062 -> 30
17:11:14.062 -> 29
17:11:14.062 -> 29
17:11:14.062 -> 30
17:11:14.094 -> 30
17:11:14.094 -> 30
17:11:14.094 -> 30
17:11:14.094 -> 30
17:11:14.094 -> 30
17:11:14.094 -> 30
17:11:14.094 -> 30
17:11:14.094 -> 29
17:11:14.135 -> 30
17:11:14.135 -> 30
I tried to screw/unscrew the screw behind the MAX4465, it just moves a bit this value, ~12 when totally unscrewed, ~60 when totally screwed.

Any idea what I messed up?

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Unable to read sound from Adafruit MAX4465

Post by adafruit_support_carter »

Please post a photo of your setup showing how everything is connected.

User avatar
nargzul
 
Posts: 4
Joined: Tue Apr 23, 2013 12:27 pm

Re: Unable to read sound from Adafruit MAX4465

Post by nargzul »

Actually, I just replaced my MAX4465, and now it's working with values betwee 0 and 1024. Not sure what happened I received the two together.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”