Upgrade your audio-reactive projects with the MAX9814 Electret Microphone Amplifier Module, featuring Automatic Gain Control (AGC) for clean, stable sound detection. Whether you're building WLED music-reactive LEDs, Arduino sound sensors, or ESP32 audio visualization, this module delivers professional audio performance in a compact form.
With automatic gain, the MAX9814 adjusts its sensitivity on-the-fly — perfect for environments where sound levels constantly change.
Typical wiring:
MAX9814 VCC -> ESP32 3.3V
MAX9814 GND -> ESP32 GND
MAX9814 OUT -> ESP32 ADC1 (GPIO34 recommended)
MAX9814, electret microphone module, AGC microphone, audio reactive, WLED microphone, ESP32 audio input, analog microphone sensor, Arduino sound sensor, music reactive LED, microphone amplifier board.
/*
ESP32 + MAX9814 -> compute RMS audio level -> send to WLED (HTTP)
Connect: MAX9814 OUT -> GPIO34 (ADC1_CH6), VCC->3.3V, GND->GND
*/
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "YOUR_WIFI";
const char* pass = "YOUR_PASS";
const char* WLED_IP = "192.168.1.50"; // replace with your WLED device IP
const int MIC_PIN = 34; // ADC1 (GPIO34) recommended
const int ADC_SAMPLES = 250; // tune for responsiveness
const int SAMPLE_DELAY_US = 200;
const float RMS_MIN = 6.0; // noise floor (tune)
const float RMS_MAX = 150.0; // loud signal (tune)
float readRMS() {
const int MID = 2048;
unsigned long sum = 0;
for (int i = 0; i < ADC_SAMPLES; i++) {
int raw = analogRead(MIC_PIN);
int centered = raw - MID;
sum += (unsigned long)centered * (unsigned long)centered;
delayMicroseconds(SAMPLE_DELAY_US);
}
float mean = (float)sum / ADC_SAMPLES;
return sqrt(mean);
}
uint8_t rmsToBrightness(float rms) {
float norm = (rms - RMS_MIN) / (RMS_MAX - RMS_MIN);
norm = constrain(norm, 0.0, 1.0);
return (uint8_t)(norm * 255.0);
}
void sendWledHTTP(uint8_t bri) {
if (WiFi.status() != WL_CONNECTED) return;
HTTPClient http;
String url = String("http://") + WLED_IP + "/json/state";
http.begin(url);
http.addHeader("Content-Type", "application/json");
String payload = "{\"on\":true,\"bri\":";
payload += String(bri);
payload += "}";
http.POST(payload);
http.end();
}
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, pass);
Serial.print("Connecting WiFi");
while (WiFi.status() != WL_CONNECTED) { delay(300); Serial.print("."); }
Serial.println(" connected");
}
void loop() {
float rms = readRMS();
uint8_t bri = rmsToBrightness(rms);
Serial.printf("RMS: %.1f -> bri: %d\n", rms, bri);
sendWledHTTP(bri);
delay(60);
}
esphome:
name: audio_to_wled
platform: ESP32
board: esp32dev
wifi:
ssid: "YOUR_WIFI"
password: "YOUR_PASS"
logger:
api:
ota:
http_request:
sensor:
- platform: adc
pin: GPIO34
name: "Mic Raw ADC"
id: mic_raw
update_interval: 50ms
attenuation: 11db
filters:
- sliding_window_moving_average:
window_size: 8
send_every: 1
- platform: template
name: "Audio Brightness"
id: audio_bri
update_interval: 100ms
lambda: |-
float raw = id(mic_raw).state;
const float in_min = 20.0; // tune empirically
const float in_max = 500.0; // tune empirically
float v = (raw - in_min) / (in_max - in_min);
if (v < 0) v = 0;
if (v > 1) v = 1;
return (int)(v * 255.0);
interval:
- interval: 100ms
then:
- lambda: |-
int b = (int) id(audio_bri).state;
char payload[64];
snprintf(payload, sizeof(payload), "{\"on\":true,\"bri\":%d}", b);
id(http_request).post("http://WLED_IP/json/state", "application/json", payload);
Important notes: For reliable ADC sampling use an ESP32 "classic" (ADC1 pins) and power the MAX9814 from 3.3V. Tune RMS_MIN/RMS_MAX or ESPHome mapping after observing raw ADC readings in your environment.
Fast shipping