What it is: The MAX9814 is an electret microphone amplifier with automatic gain control (AGC) — it boosts quiet sounds and tames loud ones so the output stays in a usable range. It's a big step up from the KY-038 for sound-reactive projects.
How it works: It outputs a clean analog audio signal centred near half its supply. Like any mic, you sample fast and measure peak-to-peak to get loudness. This sketch shows a 0–100 level with a bar.
Wiring:
MAX9814 OUT -> GPIO0 (analog)
MAX9814 VDD -> 3V3
MAX9814 GND -> GND
(leave GAIN and A/R pins unconnected for default behaviour)
OLED VCC=3V3, GND=GND, SDA=GPIO4, SCL=GPIO5
Libraries: only "Adafruit SSD1306" and "Adafruit GFX Library".
On screen / Serial: sound level 0–100 with a bar. Talk, clap, or play music near it.
Gotchas: The AGC means absolute loudness isn't linear — it's great for "how loud relative to now", not for SPL/decibel measurement. The GAIN pin can be tied to set 40/50/60 dB; floating gives the mid setting. Its output centres near VDD/2, which the peak-to-peak method handles.