| Breadboard Version | M5CoreS3 Version |
|---|---|
| ๐บ YouTube Tutorial | ๐บ YouTube Tutorial |
- Project Introduction
- Key Features
- System Architecture
- Code Description
- Hardware Requirements
- Quick Start
- Example Projects
- Community
DAZI-AI is a serverless AI voice assistant developed entirely on the ESP32 platform using the Arduino environment. It allows you to run AI voice interactions directly on ESP32 devices without the need for additional server support. The system provides complete voice interaction capabilities including speech recognition, AI processing, and text-to-speech output.
โ Serverless Design:
- More flexible secondary development
- Higher degree of freedom (customize prompts or models)
- Simpler deployment (no additional server required)
โ Complete Voice Interaction:
- Voice input via INMP441 microphone
- Real-time speech recognition using ByteDance ASR API
- AI processing through OpenAI API
- Voice output via MAX98357A I2S audio amplifier
โ Continuous Conversation Mode:
- Automatic speech recognition with VAD (Voice Activity Detection)
- Seamless ASR โ LLM โ TTS conversation loop
- Configurable conversation memory to maintain context
- One-button control to start/stop continuous mode
โ One-Click Voice Cloning & Custom Voice Design:
- Web-based one-click voice cloning at steb2.com
- Create and customize unique AI voice personas
- Easy configuration through web interface
Voice cloning configuration at steb2.com
The system uses a modular design with the following key components:
- Voice Input: INMP441 microphone with I2S interface
- Speech Recognition: ByteDance ASR API for real-time transcription
- AI Processing: OpenAI ChatGPT API for conversation with memory support
- Voice Output: MAX98357A I2S audio amplifier for TTS playback
- Connectivity: WiFi for API communication
- Push-to-Talk Mode (examples/chat): Hold button to record, release to process
- Continuous Conversation Mode (examples/chat_asr): Automatic ASR with VAD, seamless conversation loop
A unified Arduino library that integrates all necessary components for AI voice assistant development.
| Feature | Description |
|---|---|
| ChatGPT Communication | Communicates with OpenAI API, handles requests and responses |
| Conversation Memory | Maintains conversation history for context-aware responses |
| TTS | Text-to-Speech functionality, converts AI replies to voice |
| STT | Speech-to-Text functionality, converts user input to text |
| Real-time ASR | ByteDance ASR integration with WebSocket protocol for streaming recognition |
| VAD | Voice Activity Detection for automatic speech detection and silence handling |
| Audio Processing | Processes and converts audio data formats (modified ESP32-audioI2S) |
| Audio Playback | I2S audio output with support for multiple codecs (MP3, AAC, FLAC, Opus, Vorbis) |
DAZI-AI/
โโโ library.properties # Arduino library configuration
โโโ keywords.txt # Syntax highlighting keywords
โโโ README.md # Documentation
โโโ src/ # All source code
โ โโโ ArduinoGPTChat.cpp # ChatGPT & TTS implementation
โ โโโ ArduinoGPTChat.h # ChatGPT & TTS header
โ โโโ ArduinoASRChat.cpp # Real-time ASR implementation
โ โโโ ArduinoASRChat.h # Real-time ASR header
โ โโโ Audio.cpp # Modified ESP32-audioI2S library
โ โโโ Audio.h # Audio library header
โ โโโ aac_decoder/ # AAC audio decoder
โ โโโ flac_decoder/ # FLAC audio decoder
โ โโโ mp3_decoder/ # MP3 audio decoder
โ โโโ opus_decoder/ # Opus audio decoder
โ โโโ vorbis_decoder/ # Vorbis audio decoder
โโโ examples/ # Example projects
โโโ chat/ # Push-to-talk voice chat example
โ โโโ chat.ino # Push-to-talk mode with INMP441
โโโ chat_asr/ # Continuous conversation example
โโโ chat_asr.ino # ASR-based continuous mode with memory
- Controller: ESP32 development board (ESP32-S3 recommended)
- Audio Amplifier: MAX98357A or similar I2S amplifier
- Microphone: INMP441 I2S MEMS microphone
- Speaker: 4ฮฉ 3W speaker or headphones
| INMP441 Pin | ESP32 Pin | Description |
|---|---|---|
| VDD | 3.3V | Power (DO NOT use 5V!) |
| GND | GND | Ground |
| L/R | GND | Left channel select |
| WS | GPIO 4 | Left/Right clock |
| SCK | GPIO 5 | Serial clock |
| SD | GPIO 6 | Serial data |
| Function | ESP32 Pin | Description |
|---|---|---|
| I2S_DOUT | GPIO 47 | Audio data output |
| I2S_BCLK | GPIO 48 | Bit clock |
| I2S_LRC | GPIO 45 | Left/Right clock |
-
Environment Setup
- Install Arduino IDE (version 2.0+ recommended)
- Install ESP32 board support in Arduino IDE:
- Go to
FileโPreferences - Add ESP32 board manager URL:
https://espressif.github.io/arduino-esp32/package_esp32_index.json - Go to
ToolsโBoardโBoards Manager - Search for "ESP32" and install "esp32 by Espressif Systems"
- Go to
-
Library Installation via ZIP
Method 1: Direct ZIP Installation (Recommended)
- Download or create a ZIP file of the entire
DAZI-AIfolder - Ensure the ZIP file structure has
library.propertiesat the root level - Open Arduino IDE
- Go to
SketchโInclude LibraryโAdd .ZIP Library... - Select the
DAZI-AI.zipfile - Wait for installation to complete
Method 2: Manual Installation
- Copy the entire
DAZI-AIfolder to your Arduino libraries directory:- Windows:
Documents\Arduino\libraries\ - macOS:
~/Documents/Arduino/libraries/ - Linux:
~/Arduino/libraries/
- Windows:
- Restart Arduino IDE
- Download or create a ZIP file of the entire
-
Install Required Dependencies
- Open Arduino IDE Library Manager (
ToolsโManage Libraries...) - Search and install the following libraries:
- ArduinoWebsocket (v0.5.4)
- ArduinoJson (v7.4.1)
- Seeed_Arduino_mbedtls (v3.0.2)
- Open Arduino IDE Library Manager (
-
API Key Configuration
For Push-to-Talk Mode (
examples/chat/chat.ino):- Replace
"your-api-key"with your actual OpenAI API key - Replace
"your-wifi-ssid"and"your-wifi-password"with your WiFi credentials - Optionally modify the system prompt to customize AI behavior
For Continuous Conversation Mode (
examples/chat_asr/chat_asr.ino):- Replace
"your-bytedance-asr-api-key"with your ByteDance ASR API key (line 37) - Replace
"your-openai-api-key"with your OpenAI API key (line 41) - Replace WiFi credentials (lines 33-34)
- Set
ENABLE_CONVERSATION_MEMORYto 1 to enable memory or 0 to disable (line 7) - Optionally modify the system prompt to customize AI personality (lines 81-104)
- Replace
-
Hardware Wiring
- Connect INMP441 microphone according to pin table above
- Connect MAX98357A I2S audio amplifier for speaker output
-
Open Example Projects
- After installing the library, examples will be available in Arduino IDE
- Go to
FileโExamplesโDAZI-AI - Choose either:
- chat: Push-to-talk mode example
- chat_asr: Continuous conversation mode example
-
Compile and Upload
- Select the appropriate ESP32 development board
- This project has been tested on ESP32S3 Dev Module and XIAO ESP32S3
- Requirements: Flash Size >8M and PSRAM >4Mb
- In Arduino IDE, configure board settings:
- Partition Scheme: Select "8M with spiffs"
- PSRAM: Select "OPI PSRAM"
- Compile and upload the code to your device
- Select the appropriate ESP32 development board
-
Testing
- Open the serial monitor (115200 baud)
- Wait for WiFi connection
- Hold the BOOT button on your ESP32 to start recording
- Speak your question or command while holding the button
- Release the button to send the recording to ChatGPT
- Listen to the AI response through your connected speaker
| Version | Example | Description |
|---|---|---|
| Breadboard | examples/chat_configurable |
Breadboard version with website one-click API configuration |
| M5CoreS3 | examples/chat_configurable_m5cores3 |
M5CoreS3 version with website one-click API configuration |
These main programs support easy configuration through a web interface - no need to modify code for API keys!
| Example | Description |
|---|---|
examples/chat_asr |
Original version requiring manual API key configuration in code |
Join our Discord community to share development experiences, ask questions, and collaborate with other developers:
Discord Server: https://discord.com/invite/GefSMJzwQ3
If you find this project helpful, please give it a โญ๏ธ