Chat freely about anything...

User avatar
By macmagic
#83607 Hey there! i am new to this forum and already enjoying it. Actually i am trying to interface a "GY MAX4466" electret microphone module with NodeMCU 12E microcontroller but on the serial monitor i am getting a constant value of 956-958 on the monitor which doesn't change even if the surrounding is quiet or noisy. I am using the following code:
int val=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);

}

void loop() {
// put your main code here, to run repeatedly:
int val= analogRead(A0);
Serial.println(val);
}

Where am i going wrong?? Please help me out...
Thanks in advance.
User avatar
By rudy
#83621 Try using a different source for the input to the A0 pin. How about a variable pot connected to Vcc and gnd. Do you see the changes when the pot is adjusted?

Maybe your GY-MAX4466 is defective.
User avatar
By QuickFix
#83639 Things to know about the ADC on an ESP8266:
  • The quality of the ADC is very bad and not suited for audio applications (unless you're planning in creating a BPM counter or something similar).
    While it's a 10 bit ADC (with an integer range of 0..1023), the most practical use is coarse voltage measuring, e.g. determining battery voltage.
  • The ADC-pin on an NodeMCU has a 220k + 100k voltage divider before it connects to the A0-pin of the ESP-12, so you might have to take that in consideration in your sketch
You might want to simply test the ADC as well as the microphone PCB to rule things out.

If you do want to process audio, you might be want to use an external ADC or MEMS instead. :idea: