Imagine a device smaller than your palm — mic, speaker, battery, OLED, and an ESP32 inside — that connects only to Wi‑Fi and talks back like a real AI assistant. No Bluetooth speaker. No phone tether. Just press a button, ask a question, and get a spoken answer.
That’s the idea behind this DIY AI Voice Assistant Device based on ESP32 and Xiaozhi cloud AI . You can keep it on your desk, carry it in a pocket, or show it at a school/college science exhibition.
This guide covers components, wiring, firmware flash, Wi‑Fi setup, Xiaozhi pairing, personality config, and first conversation.
What this device can do
- Answer general knowledge questions (people, places, science, tech)
- Speak replies out loud through a small speaker
- Show status / IP / pairing code on a 0.96" OLED
- Run on a 3.7V battery with charging module
- Wake with a BOOT / push button
- Control an LED with voice (“light on / light off”)
- Work in Hindi (or other languages you configure)
Demo questions that work well: Who is Elon Musk? Where is Chhattisgarh? What’s the temperature in Bilaspur today? Who first went to the Moon?
Components required
| Component | Qty | Purpose |
|---|---|---|
| ESP32 DevKit | 1 | Wi‑Fi brain of the device |
| INMP441 I2S microphone | 1 | Voice input |
| MAX98357A I2S amplifier | 1 | Audio output driver |
| 1.5" / small 4Ω 2W speaker | 1 | Spoken replies |
| 0.96" OLED (SSD1306, 4-pin I2C) | 1 | Status + pairing code |
| TP4056 charging module | 1 | Charge the Li‑Po safely |
| 3.7V Li‑Po battery (≈1500mAh) | 1 | Portable power |
| Push button | 1 | Wake / talk trigger |
| On/Off slide switch | 1 | Power control |
| 5mm LED + resistor | 1 | Voice-controlled indicator |
| Ribbon / jumper wire | as needed | Connections |
| Optional 3D-printed case | 1 | Pocket-friendly enclosure |
Tools: soldering iron, solder, cutter, glue gun (for case), USB data cable, Windows PC for Flash Download Tool.

Firmware + circuit files:
How it works
Press BOOT / wake button
↓
INMP441 captures your voice
↓
ESP32 sends audio over Wi‑Fi
↓
Xiaozhi cloud (ASR → AI → TTS)
↓
MAX98357A plays the reply
↓
OLED shows status / face / codes
The ESP32 is the ears, mouth, and network link. The “brain” lives in the cloud — so you need stable 2.4 GHz Wi‑Fi.
Circuit connections
Follow the circuit diagram from the Drive folder for your firmware. A practical breadboard pin map:

INMP441 microphone
| INMP441 Pin | ESP32 Pin |
|---|---|
| VDD | 3.3V |
| GND | GND |
| L/R | GND |
| SCK | GPIO 26 |
| WS | GPIO 25 |
| SD | GPIO 32 |
MAX98357A amplifier + speaker
| MAX98357A Pin | ESP32 Pin |
|---|---|
| Vin | VIN (5V) or 3.3V |
| GND | GND |
| BCLK | GPIO 14 |
| LRC | GPIO 12 |
| DIN | GPIO 27 |
| GAIN | GND (optional) |
Speaker + / − → amp speaker terminals.
OLED display
| OLED Pin | ESP32 Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| SCL | GPIO 22 |
| SDA | GPIO 21 |
LED, battery and extras
| Part | Connection |
|---|---|
| LED | GPIO 18 → resistor → LED → GND |
| Push / wake | BOOT button, or push button as per circuit diagram |
| On/Off switch | In series with battery positive |
| TP4056 | Battery to BAT±; module OUT to ESP32 power as per diagram |
| Common GND | Tie all grounds together |
Tips
- INMP441 is 3.3V only — never feed it 5V.
- Keep I2S wires short.
- Use a data USB cable for flashing.
- Recheck every pin before connecting the battery.
Step 1 — Assemble the hardware
- Wire mic, amp, OLED, LED, and speaker as above.
- Add TP4056 + battery + on/off switch for a portable build.
- Confirm common ground.
- Power from USB first for firmware flash (safer than battery while flashing).
Step 2 — Flash the firmware (Flash Download Tool)
This build uses Espressif Flash Download Tool (not Arduino Upload).
- Download the firmware pack from the Drive folder (
xiaozhi-ai-chatbot-esp32devkit-v1-main). - Extract the ZIP. Open Flash Download Tool (open the inner tool if nested).
- Select chip type and work mode → click OK.
- Browse and select the firmware binary.
- Set address to 0x0 and tick/enable that row.
- Match settings to the screenshots in the firmware folder.
- Select the correct COM port and baud rate.
- Click START and wait until it shows FINISH.
If the port doesn’t appear, hold BOOT while plugging USB, or install CH340 / CP2102 drivers.
Step 3 — Read the device IP (Arduino IDE Serial Monitor)
- Open Arduino IDE.
- Select board: ESP32 Dev Module.
- Select the same COM port.
- Open Serial Monitor.
- Set baud rate (commonly 115200).
- Press the ESP32 RESET button once.
Serial Monitor prints an IP address. The same IP usually appears on the OLED too. Copy that IP.
Step 4 — Connect Wi‑Fi from the web dashboard
- Open a browser and paste the device IP address.
- The local dashboard opens.
- Select your home Wi‑Fi or phone hotspot — 2.4 GHz only.
- Enter the password → Connect.
- Wait until ESP32 shows successfully connected.
Step 5 — Pair with Xiaozhi (xiaozhi.me)
- Open xiaozhi.me → Console.
- Sign in with Google.
- Click Add Device.
- Read the unique verification code on the OLED.
- Enter the code → Confirm.
- Choose Open Source → Start Using.
Step 6 — Configure role and personality
| Setting | What to do |
|---|---|
| Assistant name | Pick any name you like |
| Language | Hindi (or English / bilingual) |
| Role introduction | Paste the ready text from the firmware folder |
| Memory type | Long-term memory |
| Language model | Choose any available model |
| Save | Click Save, then press Reset on ESP32 |
Step 7 — Talk to your AI
- Press BOOT (or wake push button) to wake the device.
- Speak clearly near the INMP441.
- Wait for the reply on the speaker.
- Try LED control: say “light on” / “light off”.
If it sleeps after silence, press BOOT again to wake.
Optional — Fit it in a 3D-printed case
- Disconnect power.
- Neatly route wires / use ribbon cable.
- Mount ESP32, OLED, mic hole, speaker grille, switch, and charging port.
- Secure the battery safely (no pinched cells).
- Power on and retest wake + talk + charge.
Troubleshooting
| Problem | Fix |
|---|---|
| Flash tool doesn’t see COM | Use data cable, hold BOOT on plug-in, install USB drivers |
| Flash fails | Confirm firmware at 0x0, tick enabled, match folder screenshots |
| No IP on Serial/OLED | Correct baud rate, press Reset, confirm firmware flashed |
| Wi‑Fi won’t join | Use 2.4 GHz only; recheck password; retry dashboard |
| Pairing code missing | Wait after Wi‑Fi connect; reset once; check OLED wiring |
| No sound | Check amp Vin/GND/BCLK/LRC/DIN and speaker wires |
| Mic silent | Check SD/WS/SCK and L/R→GND; keep mic on 3.3V only |
| Wrong language | Re-set language + role text → Save → Reset |
Why this is a strong student project
- Clear AI + IoT + embedded mix
- Visible hardware (mic, amp, display, battery)
- Works without writing your own LLM code
- Easy to demo live questions
- Expandable: case, LED, more tools later
Final checklist
- ☐ Hardware wired and double-checked
- ☐ Firmware flashed with Flash Download Tool (0x0)
- ☐ IP visible on Serial Monitor / OLED
- ☐ Wi‑Fi connected via web dashboard
- ☐ Device paired on xiaozhi.me
- ☐ Name, language, role text, memory saved
- ☐ Reset → BOOT → first successful conversation
- ☐ (Optional) LED + battery + 3D case tested
Closing
That’s the full pocket AI voice assistant: ESP32 + INMP441 + MAX98357A + OLED + battery, flashed once, paired to Xiaozhi, and ready to chat. Wire carefully, don’t rush the flash settings, and give it a personality that feels like yours.
When it answers your first “hello” out loud — with no phone in the loop — it stops feeling like a circuit and starts feeling like a tiny companion on your desk.
Comments