Skip to content

Latest commit

Β 

History

History
306 lines (229 loc) Β· 9.79 KB

File metadata and controls

306 lines (229 loc) Β· 9.79 KB
Dasai Mochi animated face cycling through idle, listening, thinking and talking
Dasai Mochi Bot

A tiny ESP32-C3 AI companion. It listens, thinks, and chats using your AI key β€”
then pulls goofy faces when you leave it alone. Flash it from your browser. No IDE. No drivers.

⚑  Flash your Mochi Β Β·Β  πŸ”ŒΒ Wiring Β Β·Β  🧠 How it works Β Β·Β  πŸš€Β Start


🍑 Meet Mochi

Mochi is a palm-sized robot built around a Waveshare ESP32-C3-Zero. Hold the touch button, ask it anything β€” the time, the weather, the news, a random question β€” and it answers out loud through a little speaker. The OLED is its face: it watches you while listening, gets a thoughtful look while it thinks, and its mouth moves while it talks.

Leave it alone and it just... blinks, glances around, and cycles through silly expressions to keep you company. There's even a pure face-toy mode if you just want the cuteness without the chatter.

The face above is the real animation logic from the firmware β€” idle β†’ listening β†’ thinking β†’ talking.

😊 idle πŸ‘€ listening πŸ’­ thinking πŸ—£οΈ talking
blinks & looks around wide eyes, alert eyes up, dots mouth lip-syncs audio

✨ Features

πŸ—£οΈ Talk & listen

Push-to-talk to ask anything. Speech in, speech out β€” a real little voice assistant.

πŸ”‘ Your key, your model

Bring OpenAI, Groq, OpenRouter, Together, or Gemini. Paste your key, switch any time.

😜 Silly idle faces

Blinks, gazes, and goofy moods when idle. Toggle a pure face-toy mode.

πŸ“‘ App-free setup

The bot hosts its own WiFi page to enter credentials β€” like setting up a smart bulb.

πŸ”‹ Truly portable

LiPo + TP4056 charger + slide switch. A pocket companion that runs off a battery.

πŸ› οΈ Hackable

One clean Arduino sketch, parameterised faces, swappable pins. Fork it, make it yours.


🧠 How it works

flowchart LR
    A([πŸŽ™οΈ You speak]) --> B[INMP441 mic<br/>I2S]
    B --> C{{ESP32-C3}}
    C -->|stream audio| D[Speech-to-Text]
    D --> E[Your AI provider<br/>LLM reply]
    E --> F[Text-to-Speech]
    F -->|stream audio| C
    C --> G[MAX98357A amp<br/>I2S]
    G --> H([πŸ”Š Mochi talks])
    C -.drives.-> I[(😊 OLED face<br/>listen-think-talk)]

    style C fill:#3a3f4b,color:#fff
    style E fill:#e89a8b,color:#fff
    style I fill:#f3c9a8,color:#2b2622
Loading

Because the ESP32-C3 is a small single-core chip, the heavy lifting β€” speech-to-text, the language model, and text-to-speech β€” runs on your chosen provider's servers. The C3 captures your voice, streams it up, plays the reply back, and animates the face locally. Setup happens over a captive-portal WiFi page the bot serves itself, so there's no app to install.


🧩 Hardware

PartRoleInterface
Waveshare ESP32-C3-Zerobrain + WiFiβ€”
SSD1306 0.96" OLEDthe face & statusI2C
INMP441 michears youI2S in
MAX98357A + 2W speakertalks backI2S out
3Γ— TTP223 touch buttonstalk / next-face / modedigital
LiPo + TP4056portable power3.7V
slide switchon / offβ€”

πŸ”Œ Wiring

Everything runs at 3.3V. Default pins live in config.h β€” easy to change.

OLED (I2C)

signal GPIO
SDA 4
SCL 5

Mic β€” INMP441 (I2S)

signal GPIO
SCK 0
WS 1
SD 2
L/R GND

Speaker β€” MAX98357A (I2S)

signal GPIO
BCLK 6
LRC 7
DIN 8
SD 3V3

Touch buttons (TTP223)

button GPIO job
TALK 3 push-to-talk
NEXT 18 next face
MODE 19 mode toggle

⚠️ Reserved on the C3-Zero β€” don't use: GPIO9 (BOOT), GPIO10 (onboard RGB LED), GPIO12–17 (onboard flash). The pins above already avoid all of them. πŸ‘‰ Interactive pin diagram on the project site β†’

Full step-by-step: hardware/WIRING.md


πŸš€ Getting started

πŸ™‚ For users β€” no coding

  1. Open the flash page in Chrome / Edge / Opera.
  2. Hold BOOT while plugging in USB-C (flash mode).
  3. Click Connect & Flash, pick the port, confirm.
  4. The bot makes a WiFi network: DasaiMochi-Setup.
  5. Join it β†’ a setup page opens β†’ enter WiFi + your AI key. 🍑

πŸ§‘β€πŸ’» For developers

git clone https://github.com/YOUR-USERNAME/dasai-mochi-bot
cd dasai-mochi-bot

# PlatformIO
pio run            # compile
pio run -t upload  # flash over USB

…or open the sketch in Arduino IDE (board: ESP32C3 Dev Module).


πŸ”‘ Getting an API key

ProviderGet a keyNotes
Groq ⭐console.groq.com/keysfast, generous free tier, Llama 3.x β€” best default
OpenAIplatform.openai.com/api-keysGPT models, paid
OpenRouteropenrouter.ai/keysone key, many models
Togetherapi.together.xyzopen models, free tier
Geminiaistudio.google.com/apikeyGoogle, free tier

πŸ” Your key is entered on the device's own setup page and stored only in the ESP32's flash. It's sent only to the provider you chose, over HTTPS. It never touches this repo.


πŸ“ Project layout

dasai-mochi-bot/
β”œβ”€ firmware/dasai_mochi_bot/    πŸ”§ the Arduino sketch
β”‚  β”œβ”€ dasai_mochi_bot.ino       main loop Β· provisioning Β· conversation
β”‚  β”œβ”€ config.h                  pins & tunables  (edit to rewire)
β”‚  β”œβ”€ providers.h               multi-provider LLM table
β”‚  β”œβ”€ faces.{h,cpp}             😊 the silly-face engine
β”‚  β”œβ”€ llm_client.{h,cpp}        chat + speech-to-text over HTTPS
β”‚  β”œβ”€ audio_io.{h,cpp}          I2S mic capture + speaker playback
β”‚  └─ portal_page.h             on-device WiFi/key setup page
β”œβ”€ docs/                        🌐 GitHub Pages site (flasher + diagram)
β”‚  β”œβ”€ index.html                landing Β· browser flasher Β· pin diagram
β”‚  β”œβ”€ assets/mochi-face.svg     the animated face (also used above)
β”‚  └─ firmware/manifest.json    ESP Web Tools manifest
β”œβ”€ hardware/WIRING.md           πŸ”Œ full wiring guide
β”œβ”€ platformio.ini
└─ README.md

πŸ—ΊοΈ Roadmap

  • Commit the prebuilt merged.bin so the web flasher goes live
  • Wake-word ("Hey Mochi") instead of push-to-talk
  • More face moods + per-mood sound effects
  • Battery level shown on the RGB LED
  • 3D-printable shell in /hardware

πŸ™ Credits

Browser flashing by ESP Web Tools (ESPHome / Nabu Casa) Β· animated banner by readme-typing-svg Β· inspired by the open-source XiaoZhi AI ESP32 chatbot community.

πŸ“„ License

MIT β€” see LICENSE. Build one, fork it, make it weirder.


Mochi
Built with 🍑 for makers.