-
Notifications
You must be signed in to change notification settings - Fork 130
Analog Audio Input Options
Generally we recommend using a digital I2S microphone, like INMP441, SPH0645, ICS-43434, or PDM I2S microphones.
Below are a number of popular Arduino compatible analog microphones that have been tested.
| Model | Compatibility | Notes |
|---|---|---|
| INMP401 | Good | Some Chinese ones are not reliable. |
| MAX4466 | Fair | Is very sensitive to 3.3V noise and voltage dropout due to Wifi activity. Avoid powering your LED stripe from ESP32, as the stripe causes a lot of noise on the 3.3V/5V power lines. |
| MAX9812 | Good | Only 20dB gain, but worked OK. |
| MAX9814 | Good | Best to set the gain to 40dB. |
If you are using the MAX9814, you need to connect gain to vdd to set the gain to 40dB as the default 60db has far too much background noise. The inexpensive sound sensors you can buy from Aliexpress or elsewhere (such as LM393 or KY-038) typically have an on/off output only (detecting "sound" or "silence") and may or may not work adequately. For more information on our microphone test results, see our Arduino Compatible Microphones document.
If the LED's are active when the ambient volume is low while running volume only effects beginning with a single '*', you can increase the background noise filtering (or squelch) by navigating to the 'Config | LED Preferences | Sound' and increase the Squelch value. You can also make it more sensitive by lowering that Squelch value. In addition, there is a gain setting, which is required especially for the much lower signal level provided by the line-in configuration. Gain, Squelch and AGC are affecting all soundreactive, volumereactive and frequency (FFT) reactive effects.
Note 1: Do NOT connect input devices to 5V (or Vin). The power should be connected to the 3.3V pin.
Note 2: A piezo vibration sensor (from aliexpress) was successfully hooked up and tested.
Note 3: On the ESP32, the default ADC pin is GPI36 (also known as VP), while the ESP8266 uses A0. On ESP32, any GPIO related to ADC1 can be used - see next note.
Note 4: If your ESP32 doesn't have pin 36, any of the other ADC1 (and not ADC2) pins should work.
Note 5: On the ESP32, the ADC and I2S pins are defined in audio_reactive.h. You can also select them in the sound settings UI.
The following schematics are provided as an example only. There are many ways to achieve the same results. These are only a few of those ways.
| Microphone Wiring Example (MAX9814) | Line In Wiring Example |
|---|---|
![]() |
![]() |
Some folks have mentioned that they don't need this line-in circuit, which is fine. Here's an explanation of that circuit.
The 680 ohm resistors provide termination so that you don't get reflection on the incoming signals. The 100nf capacitors remove any DC offset from the incoming signal. Remember that the ESP goes from 0V to 3.3V. Beyond that lay dragons. Finally, the 1M resistors provide DC centering of the incoming (now) AC only signal halfway between 0 and 3.3V.
Note 1: If you are just using a single L or R channel for the line-in, disconnect the capacitor for the other channel, or the resultant sample will be significantly reduced in amplitude.
Note 2: Providing a 'T' connector so that you can hear the music as it goes into the circuit is highly recommended. In the author's case, there was considerable static when the ESP32 was powered by the computer's USB port, but was fine when the ESP32 was powered by a USB powerbank.
The following diagram shows one way of connecting a 3.5mm jack and an analog microphone to the ESP8266/32 while being able to change your desired input with a simple SPDT switch.
The left and right channels of the TRS Jack are connected together to sample both channels simultaneously as one channel.
Connect the output of the capacitor to the ADC pin for your board.

On the ESP32, the ADC pin used is pin 36 (also known as VP), while the ESP8266 uses A0. Power is connected to the 3.3V pin. These pins are defined in wled00/audio_reactive.h.
The volume reactive routines (starting with a single *), support a squelch or background noise suppression. This can be configured near the bottom of the LED Settings page.
Line-in signals are typically much lower than that of some of the microphones. Rather than use an auto gain function, you can manually adjust the gain from 0 to 255, which translate to a gain from 0.1 up to 5.0 gain.
We've often seen spikes when using an analog microphone in conjunction with WLED. There's an article that should shed light on the issue at ESP32 microcontroller generates noise on microphone.
Introduction
Installing and Compiling
First Time Setup
Running Sound Reactive WLED
2D Support
Sound Settings
2D LED Preferences
ARTI-FX
UDP Sound Sync
Sound Reactive Animations
Non-Reactive Animations
Digital Microphone Hookup
Analog Audio Input Options
Using my PC for the Sound
News
It's Not Working
Noise and Spikes
Connectivity Issues
WLED Programming Notes
Modifying Sound Reactive WLED
Future Directions
Adding a new Settings Page
On Lossy Colours
Sliders in WLED
Testing

