This is the latest and most stable firmware for the Brutally Honest AI project, featuring working audio recording, LED animations, and comprehensive I2C diagnostics.
- PDM Microphone Support - Properly configured ESP32-I2S library
- High-Quality Audio Recording - 16kHz sample rate, 16-bit depth
- Automatic Gain Control - Optimized audio levels
- SD Card Storage - WAV file format with timestamps
- Real-time Audio Processing - Efficient buffer management
- Recording Status - Visual feedback during audio capture
- Connection Status - BLE connection indicators
- System Status - Boot, ready, and error states
- Customizable Animations - Smooth LED transitions
- Device Discovery - Advertises as "Brutal Honest Query"
- Audio Streaming - Real-time audio transmission
- Status Updates - Recording state and file count
- Connection Management - Automatic reconnection
- I2C Scanner - Comprehensive device detection
- Hardware Testing - Multiple pin configurations and speeds
- Serial Commands - Interactive diagnostic interface
- Error Reporting - Detailed troubleshooting information
- XIAO ESP32S3 microcontroller
- XIAO Expansion Board (optional, for OLED display)
- MicroSD Card (for audio storage)
- PDM Microphone (built-in or external)
- Install Arduino IDE with ESP32 support
- Install Required Libraries:
- ESP_I2S (included with ESP32 core) - U8g2 (for OLED display) - SD (included with ESP32 core) - BLE (included with ESP32 core) - Upload Firmware:
arduino-cli compile --fqbn esp32:esp32:XIAO_ESP32S3 esp32s3_pdm_fixed.ino arduino-cli upload --fqbn esp32:esp32:XIAO_ESP32S3 --port /dev/cu.usbmodem101 esp32s3_pdm_fixed.ino
Board: "XIAO_ESP32S3"
USB CDC On Boot: "Enabled"
CPU Frequency: "240MHz (WiFi)"
Flash Mode: "QIO 80MHz"
Flash Size: "8MB (64Mb)"
Partition Scheme: "8M with spiffs (3MB APP/1.5MB SPIFFS)"
PSRAM: "OPI PSRAM"
Upload Mode: "UART0 / Hardware CDC"
Upload Speed: "921600"
- Power on the device
- Press the button to start recording
- LED indicates recording status (solid/blinking)
- Press again to stop recording
- Files saved to SD card as
recording_YYYYMMDD_HHMMSS.wav
- Enable Bluetooth on your device
- Scan for "Brutal Honest Query"
- Connect to start receiving audio stream
- LED shows connection status
Connect via serial monitor (115200 baud) and use these commands:
scanori2c- Perform I2C device scantest- Test different I2C configurationshelp- Show available commands
- Sample Rate: 16,000 Hz
- Bit Depth: 16-bit
- Channels: Mono
- Format: WAV (PCM)
- Buffer Size: 1024 samples
- Microphone: PDM interface
// Audio
#define I2S_WS_PIN 42 // PDM Clock
#define I2S_SD_PIN 41 // PDM Data
// LED
#define LED_PIN 21 // Status LED
// Button
#define BUTTON_PIN 1 // Record button
// SD Card (SPI)
#define SD_CS_PIN D2 // Chip Select
// MOSI: D10, MISO: D9, SCK: D8
// I2C (for OLED - if expansion board used)
#define OLED_SDA 5 // I2C Data
#define OLED_SCL 4 // I2C Clock- Program Storage: ~22% (737KB / 3.3MB)
- Dynamic Memory: ~10% (36KB / 327KB)
- PSRAM: 8MB available for audio buffers
- No recording: Check microphone connection and SD card
- Poor quality: Verify sample rate and gain settings
- File corruption: Ensure stable power supply
- Connection fails: Reset device and clear Bluetooth cache
- Audio dropouts: Check distance and interference
- OLED not working: Run I2C diagnostic (
scancommand) - SD card errors: Format card as FAT32, check connections
- LED not working: Verify LED_PIN connection
scan - Scan I2C bus for devices
test - Test I2C configurations
help - Show available commands
- Solid ON: Recording in progress
- Slow Blink: Ready to record
- Fast Blink: BLE connected
- Off: Standby/Error
- ๐ Status: Normal operation messages
- ๐ Scan: I2C diagnostic results
- ๐ค Audio: Recording status updates
- ๐ก BLE: Connection status
- โ Fixed PDM microphone - Proper ESP32-I2S integration
- โ Enhanced audio quality - Optimized buffer management
- โ Improved LED feedback - Clear status indicators
- โ I2C diagnostics - Comprehensive hardware testing
- โ Better error handling - Graceful failure recovery
- โ Serial commands - Interactive debugging interface
- OLED Display: May not work on some expansion boards (I2C hardware issue)
- Workaround: Use serial monitor for status instead of OLED
esp32s3_pdm_fixed/
โโโ esp32s3_pdm_fixed.ino # Main firmware file
โโโ README.md # This documentation
This firmware is part of the Brutally Honest AI project. For issues or improvements:
- Test thoroughly with the diagnostic commands
- Document any hardware-specific issues
- Include serial output in bug reports
This project is part of the Brutally Honest AI system. See main project documentation for licensing details.
๐ฏ This is the recommended firmware version for production use with working microphone and LED features!