FastLED 3.9.15
Loading...
Searching...
No Matches
ESP32AudioInput.h
Go to the documentation of this file.
1// ESP32 I2S Audio Input Implementation
2// This example uses the INMP441 I2S MEMS microphone (popular as of 2025)
3
4#pragma once
5
7
8// ============================================================================
9// WIRING FOR INMP441 MICROPHONE → ESP32
10// ============================================================================
11// INMP441 Pin → ESP32 Pin
12// SCK (BCLK) → GPIO 4 (I2S Bit Clock)
13// WS (LRCLK) → GPIO 7 (I2S Word Select)
14// SD (Data) → GPIO 8 (I2S Data In)
15// L/R Select → 3.3V (Right channel - recommended)
16// VDD → 3.3V
17// GND → GND
18//
19// Notes:
20// - Connect L/R to 3.3V so it's recognized as a right channel microphone
21// - Adjust pin assignments below if needed for your board
22//
23// ============================================================================
24
25// I2S Configuration for INMP441 microphone
26#define I2S_WS_PIN 7 // Word Select (LRCLK)
27#define I2S_SD_PIN 8 // Serial Data (DIN)
28#define I2S_CLK_PIN 4 // Serial Clock (BCLK)
29#define I2S_CHANNEL fl::audio::AudioChannel::Right
30
31// Platform-specific initialization delay (ESP32 needs longer startup time)
32#define PLATFORM_INIT_DELAY_MS 5000
33
34// Platform name for serial output
35#define PLATFORM_NAME "ESP32 I2S Audio FastLED Example"
36
37// Create platform-specific Config
41
42// Print platform-specific setup information
43inline void printPlatformInfo() {
44 Serial.println("ESP32 Configuration:");
45 Serial.print(" BCLK Pin: ");
46 Serial.println(I2S_CLK_PIN);
47 Serial.print(" LRCLK Pin: ");
48 Serial.println(I2S_WS_PIN);
49 Serial.print(" Data Pin: ");
50 Serial.println(I2S_SD_PIN);
51 Serial.print(" Channel: ");
52 Serial.println(I2S_CHANNEL == fl::audio::AudioChannel::Right ? "Right" : "Left");
53}
fl::audio::Config createAudioConfig()
void printPlatformInfo()
#define I2S_SD_PIN
#define I2S_CHANNEL
#define I2S_CLK_PIN
#define I2S_WS_PIN
static Config CreateInmp441(int pin_ws, int pin_sd, int pin_clk, AudioChannel channel, u16 sample_rate=44100ul, int i2s_num=0) FL_NOEXCEPT
Definition input.h:153
#define Serial
Definition serial.h:304