Skip to content

Latest commit

ย 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

DAZI-AI Logo

๐Ÿค– DAZI-AI

Arduino License Platform

Serverless AI Voice Assistant | ESP32 Platform | Pure Arduino Development

English | ็ฎ€ไฝ“ไธญๆ–‡

๐Ÿ“ท Hardware & Tutorials

Breadboard Version M5CoreS3 Version
Breadboard Version M5CoreS3 Version
๐Ÿ“บ YouTube Tutorial ๐Ÿ“บ YouTube Tutorial

โœจ Table of Contents

๐Ÿ“ Project Introduction

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.

๐Ÿš€ Key Features

โœ… 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
One-Click Voice Cloning

Voice cloning configuration at steb2.com

๐Ÿ”ง System Architecture

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

Two Conversation Modes

  1. Push-to-Talk Mode (examples/chat): Hold button to record, release to process
  2. Continuous Conversation Mode (examples/chat_asr): Automatic ASR with VAD, seamless conversation loop

๐Ÿ’ป Code Description

DAZI-AI Library

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)

Code Structure

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

๐Ÿ”Œ Hardware Requirements

Recommended Hardware

  • 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 Connections

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

MAX98357A I2S Audio Output Pin Connections

Function ESP32 Pin Description
I2S_DOUT GPIO 47 Audio data output
I2S_BCLK GPIO 48 Bit clock
I2S_LRC GPIO 45 Left/Right clock

๐Ÿš€ Quick Start

  1. 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"
  2. Library Installation via ZIP

    Method 1: Direct ZIP Installation (Recommended)

    • Download or create a ZIP file of the entire DAZI-AI folder
    • Ensure the ZIP file structure has library.properties at the root level
    • Open Arduino IDE
    • Go to Sketch โ†’ Include Library โ†’ Add .ZIP Library...
    • Select the DAZI-AI.zip file
    • Wait for installation to complete

    Method 2: Manual Installation

    • Copy the entire DAZI-AI folder to your Arduino libraries directory:
      • Windows: Documents\Arduino\libraries\
      • macOS: ~/Documents/Arduino/libraries/
      • Linux: ~/Arduino/libraries/
    • Restart Arduino IDE
  3. 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)
  4. 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_MEMORY to 1 to enable memory or 0 to disable (line 7)
    • Optionally modify the system prompt to customize AI personality (lines 81-104)
  5. Hardware Wiring

    • Connect INMP441 microphone according to pin table above
    • Connect MAX98357A I2S audio amplifier for speaker output
  6. 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
  7. 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
  8. 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

๐Ÿ“š Example Projects

Main Programs (Recommended)

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!

Legacy Version

Example Description
examples/chat_asr Original version requiring manual API key configuration in code

๐Ÿ’ฌ Community

Join our Discord community to share development experiences, ask questions, and collaborate with other developers:

Discord

Discord Server: https://discord.com/invite/GefSMJzwQ3


Open source collaboration for shared progress!
If you find this project helpful, please give it a โญ๏ธ

About

No description, website, or topics provided.

Resources

Stars

121 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages