Esp32-S3 Based AI Vice Assistant

by dsnmechanic in Circuits > Arduino

84 Views, 2 Favorites, 0 Comments

Esp32-S3 Based AI Vice Assistant

123.jpg

🤖 Your Free DIY AI Voice Assistant (ESP32-S3 & HuggingFace)

  1. This project guides you through building your very own AI Voice Assistant using completely free tools and AI models. The ESP32-S3 development board handles voice recording and audio playback, while all the complex AI processing runs on a HuggingFace Space server.

  2. 100% Free: No paid APIs, services, or subscriptions are required.
  3. HuggingFace Integration: Utilizes a custom server setup on HuggingFace to combine Speech-to-Text (STT), a Large Language Model (LLM), and Text-to-Speech (TTS).
  4. Hardware: Built around the powerful ESP32-S3 development board.
  5. Current Language: Currently supports English only. (Multi-language support is a future goal).


Supplies

⚙️ Hardware Requirements

The use of PSRAM is critical for voice recording and processing tasks, so make sure your board has it!

ComponentDetailsNote

Development Board

ESP32-S3 (16MB Flash, 8MB PSRAM)

⚠️ PSRAM is mandatory for the code to function correctly.

Display

ST7789 TFT Display

Check the separate display tutorial link in the video description for configuration.

Microphone

INMP441 I2S MEMS Microphone

Crucial: Add a capacitor between Ground and VCC on the microphone.

Audio Amp

MAX98357A I2S Audio Amplifier

Connected to a half-watt, 8-ohm speaker.

Trigger

Tactile Button

Used to start and stop the voice recording.

Wiring

Separate I2S Lines

Dedicated I2S GPIO pins are used for the microphone and the amplifier to simplify control and avoid noise.

All Milestone

DIY Voice Assistant on ESP32 S3: Free Hugging Face AI Server & Arduino Tutorial

☁️ Server Setup (HuggingFace Space)

The AI magic happens on a free HuggingFace Space.

  1. Create a HuggingFace Account and go to "New Space".
  2. Space Configuration:
  3. Space SDK: Choose Docker.
  4. Template: Select Blank.
  5. Space Hardware: Use CPU Basic.
  6. Upload Server Files: Copy the following files from this repository and create them in your new HuggingFace Space (Files tab -> Contribute -> Create new file):
  7. Dockerfile
  8. app.py
  9. docker-compose.yml
  10. requirements.txt
  11. Create an Access Token: Go to your profile's Access Tokens, create a "Write" token, and copy it.
  12. Set a Secret: In your Space's Settings tab, scroll down to Secrets and create a new secret:
  13. Name (Must be exact): HF_TOKEN
  14. Value: Paste your copied token here.
  15. Wait for the server state to go from "Building" to "Running". Check the Logs if any error occurs.

💻 Arduino Firmware Setup

  1. Install Libraries: Download and install all required libraries (links in the video description). Note: The ESP8266 audio library works fine with ESP32.
  2. Code Configuration:
  3. Enter your WiFi SSID and Password.
  4. Update the Server URL with your specific HuggingFace Space URL (Pay attention to case sensitivity).
  5. ESP32 Board Settings:
  6. Ensure PSRAM is enabled in the Tools menu.
  7. Select a Partition Scheme that includes SPIFFS.
  8. Upload the code to your ESP32-S3 board.

▶️ How to Use

  1. Once the display shows "Assistant Ready", the system is operational.
  2. Press and hold the tactile button to start recording your voice into PSRAM.
  3. Release the button to stop recording and automatically send the audio to the server.
  4. The AI server processes the request (STT -> LLM -> TTS), and sends the response audio back to the ESP32.
  5. The ESP32 downloads the audio to the LittleFS and automatically plays the answer on the speaker.

Enjoy building your AI Assistant! See you in the next episode!

Project Links