Skip to content
Projects

About

SKY — pocket voice note for ESP32-S3 e-paper

AI & Machine Learning

How these counts are measured

Measured star growth

in 24h
Collecting history
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

SKY — pocket voice note

Hold BOOT, speak, release. The audio goes to Alibaba Bailian, comes back as a transcript, gets classified into a calendar entry, a todo or a plain note, and all of it lands on the SD card. A local web page shows everything collected. Ask the device what it remembers — fixed gestures or hold-to-talk — and it answers from the notes on the card, then reads the reply aloud.

BOOT held  ->  /fieldnote/pending/pendingNNN.wav
                 |
                 +-> qwen3-asr-flash   ->  .txt        transcript
                 +-> qwen3.7-plus      ->  .meta.json  structured fields
                 |
                 +-> filed as  calendarNNN / todoNNN / noteNNN

Nothing is lost if the upload fails: the recording is staged under a stable pending name the moment the button is released, and the queue drains it later.

Keys

Two keys only — BOOT (GPIO0) and PWR (GPIO18):

Gesture Action
BOOT short Move cursor / next item / next Ask page
BOOT long Home: record a note; elsewhere: go up
BOOT double Ask: what is due today
PWR short Enter / play / back / Settings AP toggle
PWR double (Home) Ask: what is coming in the next 7 days
PWR long Voice Ask: hold to speak a free-form question
BOOT + PWR hold (~1.6 s) Power off

Ask answers are grounded in on-device memory (catalog + matching note meta / transcripts), not a general web search. TTS synthesises the reply, caches the WAV on the card, then plays locally so Wi-Fi jitter does not interrupt speech.

Files on the card

/fieldnote/
  pending/    pending001.wav        staged, waiting for a connection
  calendar/   calendar001.{wav,txt,json,asr.json,meta.json,done}
  todos/      todo001.{...}
  notes/      note001.{...}
File Contents
.wav 16 kHz / 16-bit mono PCM
.txt transcript, UTF-8
.json raw LLM completion, verbatim
.asr.json raw ASR response, kept for debugging
.meta.json parsed fields, this is what the UI reads
.done Open/Done keys per occurrence (YYYY-MM-DD or with clock), one per line

meta.json is written by the device after the LLM answers. The filing schema’s schedule authority is tasks[] (dtstart, rrule_set, time_meta, …). The device projects those into a catalog rrule pool plus RAM due / taskTitles for Today, Ask, and the web UI. Card meta does not store top-level due / dues / actions / repeat; only tasks[] is authoritative.

{"title":"观看灯光秀","kind":"note","someday":false,
 "summary":"记录即将前往观看灯光秀的活动。","topics":["娱乐","活动"],
 "facts":[],"created":"2026-11-14T18:52","tasks":[]}
  • kind is calendar when a day or time was named, todo when there is something to do but no time, note otherwise.
  • Task dtstart is YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss when a clock was spoken. The model must not invent clock times.
  • created is when the recording was made, not when it was uploaded, so an offline note keeps its real timestamp.
  • topics / facts are JSON arrays in meta; UI buffers may join them.

Offline queue

A recording made with no connection stays in pending/. Every 30 s the queue tries again, one note per pass:

  • Success: the note is renamed into the box the LLM chose.
  • Failure: a .tries counter is bumped. After three attempts the note becomes failedNNN so it stops consuming the queue; the audio is never deleted.

While a drain runs the panel shows a progress screen: item counter, current stage (UPLOADING, TRANSCRIBING, ORGANIZING, SAVING, SAVED) and a bar for the note in hand. The normal page returns when the queue is empty.

Power

Sleep is decided by idleness, not by network state. After three minutes with no key press and no page view the device deep-sleeps; the e-paper keeps its image because the panel rail is cut rather than left energised.

  • A key wake restores the page that was open, kept in RTC memory.
  • Short PWR while awake does not sleep — the idle timer is the only trigger, so a device sitting on a desk stays reachable.
  • BOOT + PWR together powers off on purpose: it clears the saved page so the next boot starts at the home screen.

Wi-Fi

Up to five profiles are kept in NVS. At boot the device scans once and connects to whichever saved network is present, rather than waiting out a timeout on each in turn; the active slot is preferred.

While awake the station is rechecked on an interval, so a hotspot that comes back is picked up without touching the device. If the driver returns from sleep with a zeroed MAC — which happens — the stack is torn down and rebuilt automatically.

To add a network with no working connection, short-press PWR on the Settings page to start the FieldNote access point (password fieldnote), join it, and open http://192.168.4.1. The AP retires itself after five idle minutes.

The local web page

Everything on the card, at http://<device-ip>/?t=<token> (token on Settings):

Route Purpose
/ card view: due chips, tappable actions, audio, downloads
/audio?f= inline playback
/download?f= attachment download
/tick toggle one action's checkbox
/forget delete a note and its files
/wifi, /use, /clear manage the network pool
/apikey replace the API key at runtime

The server is pumped during long blocking work — panel refresh, Wi-Fi scan, upload — so a page load does not wait out a repaint or a long upload. During Ask TTS playback the web pump is paused so speech stays steady.

Configure

include/config.h holds the defaults; include/secrets.h (git-ignored) overrides them:

  • SKY_API_KEY — Bailian / DashScope key (sk-...)
  • SKY_API_BASE — OpenAI-compatible base URL, or a workspace-scoped host
  • SKY_ASR_URL — multimodal host used by TTS (ASR itself uses SKY_API_BASE + /chat/completions)
  • kNoteLang — "zh", "en", or "" to auto-detect
  • kMaxNoteSeconds — recording cap, 120 s
  • kAsrChunkSeconds — sync ASR slice length, 30 s (longer notes are chunked)
  • kTtsModel / kTtsVoice — Ask speech (qwen3-tts-flash / Cherry)

The key is compiled into the firmware and can also be replaced at runtime from the web page, which stores it in NVS. Anyone who can read the flash image can recover it, so use a key with a spending limit.

Endpoints and limits

ASR and LLM both use the OpenAI-compatible /chat/completions path:

POST {SKY_API_BASE}/chat/completions
  ASR model: qwen3-asr-flash
  LLM model: qwen3.7-plus

TTS uses DashScope multimodal-generation (qwen3-tts-flash): the API returns an OSS WAV URL; the device downloads that file to the card, then plays from SD.

LLM filing uses a strict JSON schema. enable_thinking is explicitly false: leaving it on measured 14.4 s for a short note against 4.3 s with it off.

A 120 s note is 3.8 MB of PCM. The ESP32-S3 has limited SRAM, so the body is streamed: Base64WavBody in src/upload.cpp reads the WAV from the card and encodes it a block at a time. Notes longer than kAsrChunkSeconds (30 s) are sliced on the card and transcribed one chunk at a time so each HTTP call stays under the ~65 s HTTPClient read timeout.

Build

cp include/secrets.h.example include/secrets.h   # fill SKY_API_KEY, etc.
pio run -e epaper154
pio run -e epaper154 -t upload --upload-port /dev/cu.usbmodem21401
pio device monitor

Serial console

Line-oriented, mostly for inspecting the card without reflashing:

l   list files              c <file>  dump a text file
q   pending queue           r <base>  re-run ASR + LLM
A   Ask today (console)     i         net info
?   scan Wi-Fi              k         probe password
j   reset Wi-Fi credentials t         display self-test
w / wr  clock / reset RTC   z         idle sleep timeout
R   repaint

Tests

The test/ directory holds host-side checks, each with its own main():

for t in test/test_*.cpp; do
  g++ -std=c++17 -I include -o /tmp/$(basename $t .cpp) $t && /tmp/$(basename $t .cpp)
done

They cover the JSON parser, base64 encoder, CJK font table, file naming, date relativisation, action bitmask, queue ordering, Wi-Fi pool bookkeeping, layout geometry, ASR chunking, and rrule expansion. tools/check_*_layout.py computes pixel bands without flashing; tools/test_filing_cases.py and the device_filing_*.py helpers exercise filing against a live device.

Hardware

Waveshare ESP32-S3-ePaper-1.54 (ESP32-S3-PICO-1-N8R8): ES8311 codec over I2S, three-wire SD_MMC, 200×200 e-paper, PCF85063 RTC on I2C, battery latch on GPIO17. Two keys only — BOOT (GPIO0) and PWR (GPIO18). Pin map in include/board.h.

Display notes

Normal page flips use differential (mode 2) updates (~460 ms) plus a selective settle pass so whites firm up without a full-panel flash. A full refresh is reserved for rare cleanup after many differentials, or when the controller has no valid baseline (cold boot). See the comment block in src/epd.cpp.

License and third parties

Copyright (c) 2026 孙凯意 (Kaiyi Sun). Released under the MIT License.

Build dependencies (Adafruit GFX / BusIO, Espressif ESP32 Arduino / ESP-IDF, etc.) keep their own licenses; required notices are collected in NOTICE. Keep API keys out of git (include/secrets.h is ignored; use include/secrets.h.example).

Chinese docs: docs/软件说明书.md (merged design + usage · keys · UI · LLM), docs/使用说明书.md (short setup), docs/归档测试用例.md, docs/测试用例设计.md, docs/回归测试用例.md. UI mockups: design/README.md.

Explore related projects

Loading…