FREE + source-available (PolyForm Shield 1.0.0) host tools, a 6-part zero-screw 3D-printable MC-RB5320-R03 companion housing & 12-shot 3D product film, a 217.67 KB canonical Mochi-21 vector avatar pack, an autonomous self-evolving soul engine (EVO-01..03), and a no-reset health probe for ESP32-S3 voice robots.
Built for RoBot.5320 (xingzhi-cube-1.54tft-wifi v2.5.3 + 6-servo Otto quadruped) and compatible with any Xiaozhi ESP32-S3 board using a 240×320 ST7789 display and the esp_mmap_assets (0xAA0000) partition format.
Scope note. Physical housing assets under
hardware/mc-rb5320-r03/provide6watertight 3D-printable FDM STLs (0screws,6/6automated geometry & clearance gates PASS). Software and tooling in this repository run on a host computer (macOS / Linux, Python 3.11+). It generates 100% authentic canonical Mochi avatar packs to flash onto the robot, computes a 4D homeostatic state + self-evolving Personality Genome (EVO-01..03) in SQLite WAL, supervises USB-JTAG hardware health via a 12-state Watchdog Auto-Rescue FSM, and serves a local browser studio on port4390. The C++17 headermochi_face_60fps.hppis generated byreflex_60fps.pyfor custom firmware integration; the stockota_1binary on the robot reads the pre-rendered GIFs from0xAA0000and receivesnotify/alert/mcpJSON packets over its transport.
Stock Xiaozhi mmap_assets packs ship 21 video-ripped GIFs (2,560.27 KB) or repeat 6 animations across 21 emotion keys, and stock voice firmware sits completely idle until a wake word is spoken. Furthermore, opening /dev/cu.usbmodem* with default serial settings on an ESP32-S3 native USB-JTAG port toggles DTR/RTS and resets the robot mid-stride.
| Capability | Stock xiaozhi-esp32 (ota_1) |
Generic GIF Theme Packs | design-os-robotics (Mochi-Soul) |
|---|---|---|---|
| Physical companion enclosure & dock | Bare devkit stack or laser-cut acrylic sandwich with M2/M3 standoffs | None (software-only assets) | MC-RB5320-R03 6-part zero-screw snap-hinge FDM unibody (86.0 × 48.1 × 104.0 mm) — 11° twin crown hook-hinges, 0.25 mm elastic cantilever snaps, 132 parametric micro-apertures, 50 mm open-floor 3× USB-C pass-through dock (6/6 digital production gates PASS, spec) |
| 21 emotion animations | 21 video-ripped GIFs (2,560.27 KB total) |
Often 6 unique GIFs duplicated across 21 slots | 21 unique 100% authentic Mochi GIFs in 217.67 KB (222,892 bytes, -91.3%) reconstructed from 108,522 SoA scanline spans (report) |
| Palette & LZW density | Unconstrained 256-color palettes (min_code_size = 8) |
Mixed resolutions (128×128 to 320×240) |
8-color MOCHI_PALETTE_8 Global Color Table (LZW min_code_size = 3, 4.03 RLE spans/scanline, 122.3× vs raw RGB565) |
Wake-word + 21 GIFs fit in 0xAA0000 |
WakeNet9 only (1.07 MB srmodels.bin) |
Often overflows 5.25 MB when paired with MultiNet |
Fits ESP-SR MultiNet6 ("Mochi / Hey Mochi / Hi Mochi", 3.67 MB) + all 21 Mochi GIFs inside 0xAA0000 with +64.9 KB headroom |
| Idle behavior & self-evolution | Waits for wake word; stateless | Static loops | Host-side 4D homeostasis + EVO-01..03 Self-Evolution (Relative-Share Genome, Dual-Track Phenotype, SQLite WAL Dream Consolidation) |
| USB-JTAG serial health & WDT rescue | Manual esptool / serial monitor resets board |
None | Single-owner passive SerialSupervisor (DTR=False, RTS=False) + 12-state Watchdog Auto-Rescue FSM (serial_supervisor.py) |
| Local dev studio | Cloud console only | None | Local studio on 127.0.0.1:4390 with 60fps authentic Mochi vector canvas, /api/evolve, /api/dream, /api/wdt, /ota bypass, and /api/hud.png |
A 6-part tool-free 3D-printable unibody housing engineered for the RB5320XZ78AI companion platform (86.0 × 48.1 × 104.0 mm). Features continuous superellipse curvature, 11° twin crown hook-hinges with 0.25 mm elastic cantilever snaps, 3 living-hinge rear tactile buttons, 132 parametric Apple-style micro-apertures, and an open-floor 50 mm USB-C pass-through weighted desk dock. Modeled natively in Blender 5.2.0 LTS with automated digital production gates (6/6 PASS).
▶ Watch 12-shot 3D product film (EN, 1080p30 MP4) · ▶ Xem phim giới thiệu Tiếng Việt (VI, 1080p30 MP4) · Interactive Pages player
Music track: Edge of Motion by Aetheric — Source: https://freetouse.com/music
design:os by Jang · 12-beat metrology-to-assembly film storyboard |
design:os by Jang · Live 3D Mochi-Soul damped-spring expressions on flush stepped bezel |
- 100% Tool-Free Zero-Screw Snap-Hinge Architecture:
6pure FDM parts (0screws,0heat-set inserts,0glue,0acrylic panels) —11°twin top crown hook-hinges (Z = 99.6 mm), internalST7789slide-in snap-cradle rails, and0.25 mmside elastic cantilever snap-locks. - 132-Aperture Parametric Acoustic & Thermal Array:
7front upper mic ports (Ø1.40–2.00 mm),19front chin intake bores,61rear concentric speaker halo bores (Ø1.60–2.50 mm),31rear mid intake bores,1status pinhole, and13top-crown passive chimney exhaust vents. - 50.0 mm Open-Floor 3× USB-C Pass-Through Weighted Dock & Captive Tactile Controls:
35.0 mmelevated cable bay clears all3plugged-inUSB-Cconnectors (0BVH clashes across75part pairs);3×captive living-hinge rear buttons (Vol+,PTT,Vol-) actuateEL10tactile switches atΔY = -0.80 mm. - Automated Production Gate Verified (
6/6 PASS): Watertight closed manifold solids (0non-manifold edges,min_wall >= 1.82 mmacross shells,>= 2.30 mmon buttons,4.15 mmon dock). Digital geometry & fitPASS; physical manufacture remainsBLOCKEDpending physical PETG/PLA+ latch fatigue, fit, thermal soak, and acoustic trials.
design:os by Jang · MC-RB5320-R03 2×2 studio showcase (isometric docked, exploded stack, 6-part catalog, rear acoustic array)
| Part ID | STL File | Dimensions (mm) | Volume (mm³) | Min Wall (mm) | Print Up | Digital Gate |
|---|---|---|---|---|---|---|
shell_front |
shell_front.stl |
86.0 × 24.8 × 104.0 | 32,354.00 | 1.91 mm | +y |
PASS |
shell_rear |
shell_rear.stl |
86.0 × 28.0 × 103.97 | 34,744.80 | 1.82 mm | -y |
PASS |
btn_vol_up |
btn_vol_up.stl |
8.8 × 24.4 × 8.1 | 635.40 | 2.60 mm | +z |
PASS |
btn_ptt |
btn_ptt.stl |
11.0 × 24.7 × 8.1 | 738.20 | 2.30 mm | +z |
PASS |
btn_vol_dn |
btn_vol_dn.stl |
8.9 × 24.4 × 8.1 | 595.22 | 2.60 mm | +z |
PASS |
desk_stand |
desk_stand.stl |
96.0 × 64.0 × 45.0 | 160,770.28 | 4.15 mm | +z |
PASS |
All 6 parts passed automated digital production gates (6/6 PASS). Physical prototype trials are pending coupon testing and thermal validation. Authoritative engineering specifications, clearance checks, and validation receipts:
hardware/mc-rb5320-r03/README.md— Complete housing engineering documentation and assembly instructions.spec.json— Engineering parameters, tolerances, and gate criteria.gate-report.json— Automated geometry, manifold, and wall thickness validation report.coverage-audit.json— Full-coverage audit confirming all 6 parts verified without skips.integration-receipt.json— Zero-clash clearance and tactile switch actuation receipt.
tools/mochi_canonical_vectors.py and tools/cook-procedural-avatar.py reconstruct all 21 authentic Mochi emotions (neutral, happy, laughing, funny, sad, angry, crying, loving, embarrassed, surprised, shocked, thinking, winking, cool, relaxed, delicious, kissy, confident, sleepy, silly, confused) 100% faithfully from code at 240×240 px (10 frames per GIF at 12.5 fps).
- Structure-of-Arrays (SoA) Scanline Vector Table:
tools/mochi_canonical_vectors.pyencodes all210canonical frames (240×147active viewport centered aty_pad = 46inside240×240) as108,522horizontal scanline spans(y, x0, w, color)compressed withLZMAinto four parallel byte streams (dy,x0,w,color). - 8-Color Canonical Mochi Palette (
MOCHI_PALETTE_8): Pure Black#000000(OLED blend), Crisp Mochi White#EAFCFF, Ice-Blue#B8E6F8, Orchid-Pink#E080E4, Bee Gold#EEE46E, Bright Red#E6312E, Deep Violet#7644A8, and Dark Maroon#4C1A24. Because every frame uses at most 8 palette indices (0..7), GIF89a packs the stream withLZW min_code_size = 3and zero local color tables. - Measured size (single-run host measurement from
plans/reports/benchmark-avatar-perf.json):- Total across 21 GIFs:
222,892 bytes(217.67 KB), averaging10.37 KBper emotion (4.64 KBforconfused.gifup to19.97 KBforangry.gif). - Average horizontal RLE spans per scanline:
4.03, yielding a122.3×compression ratio against raw RGB565 frames. - Host LZW decode latency (Python/Pillow on Apple Silicon, single-run):
106.0 µs/frame. Estimated ESP32-S3 decode time (240 MHz, scaled from host span/pixel complexity, not on-device cycle-counter telemetry):3.25 ms/frame(4.1%of one core at12.5 fps).
- Total across 21 GIFs:
Project Mochi-Soul evolves each robot's personality and visual expression over weeks of developer companionship without overflowing the 0xAA0000 flash partition or corrupting SQLite state:
-
EVO-01— Relative-Share Personality Genome & Homeostatic Plasticity (engine.py):- Alongside the 4D homeostasis vector (
Energy,Hunger,Bond,Mood: Valence + Arousal),SoulStatepersists a 5-gene Personality Genome:curiosity,affection,playfulness,resilience($\in [0, 1]$ ), andchronotype_shift($\in [-2.0, +2.0]$ hours). -
Anti-Saturation Relative-Share Drift (
RS_k - 0.25): Instead of raw additive increments that push every trait to1.0after a week of heavy use,evolve_genome_from_window()computes each category's share$RS_k = c_k / \sum c_j$ relative to uniform balance ($0.25$ ). Dominant interaction styles grow toward$1.0$ while unexercised traits gently recede toward$0.5$ , creating a distinct archetype (Curious Scholar,Devoted Companion,Playful Trickster,Stoic Guardian, orBalanced Mochi). -
Homeostatic Set-Point Plasticity: The evolved genome shifts Mochi's biological physics (
energy_setpoint$\in [65, 92]$ ,hunger_drift_scale$\in [0.70, 1.15]$ ,bond_retention$\in [0.85, 0.995]$ , and adaptive quiet-hours shift).
- Alongside the 4D homeostasis vector (
-
EVO-02— Dual-Track Morphological Phenotype (engine.py,cook-procedural-avatar.py,studio.html):-
Track A (Live 60fps Studio / Canvas): Continuous morphological traits (
eye_scale$\in [0.92, 1.12]$ ,iris_Tint,blush_mode,crown_Sparkles,spring_omega0,spring_zeta) modulate the 60fps vector canvas in real time. -
Track B (On-Device
0xAA0000Flash Pack):tools/cook-procedural-avatar.pyaccepts--stage,--curiosity,--affection,--playfulness,--resilience, and--srmodelsand enforces a 5-step Flash Budget Degradation Ladder (step 0: full phenotype accents + sparkles ->step 4: canonical 21-GIF base pack) so the packed.binnever exceeds the0xAA0000partition limit (5,619,712bytes).
-
Track A (Live 60fps Studio / Canvas): Continuous morphological traits (
-
EVO-03&EVO-03b— Idempotent SQLite WAL Dream Consolidation & 12-State Watchdog Auto-Rescue FSM (engine.py,serial_supervisor.py):-
Dream Consolidation (
dream_journal): Once per quiet-hours window (date_key,UNIQUEindex withBEGIN IMMEDIATEtransaction lock), Mochi replays the past 24 hours of episodic memories, evolves its genome (delta_json), and composes a bilingual morning reflection delivered on the first wake event after07:30. -
Single-Owner USB-JTAG
SerialSupervisor(serial_supervisor.py): Holds exclusive non-resetting ownership (DTR=False, RTS=False) of/dev/cu.usbmodem*, parses boot/panic/watchdog signatures (Task watchdog got triggered,Guru Meditation Error), and executes a 12-state Watchdog Auto-Rescue FSM (DISCONNECTED -> PASSIVE_OBSERVE -> HEALTHY -> WDT_SUSPECT -> WDT_CONFIRMED -> COOLDOWN_CHECK -> PRE_RESCUE_QUIESCE -> USB_JTAG_PULSE_RESET -> BOOT_WAIT -> POST_BOOT_VERIFY -> RECOVERED / CIRCUIT_OPEN) with a circuit breaker (max 2resets per15 min).
-
Dream Consolidation (
git clone https://github.com/morluto/design-os-robotics.git
cd design-os-robotics
python3 -m pip install pillow pyserial# Inspect the 108,522 canonical Mochi scanline spans across all 21 emotions:
python3 tools/mochi_canonical_vectors.py
# Generate all 21 GIFs into themes/procedural-mochi/ (and repack 0xAA0000 if a base .bin is present):
python3 tools/cook-procedural-avatar.py
# Optional: Bake EVO-02 Stage 4 (Mochi-Ascendant) phenotype traits + "Mochi / Hey Mochi / Hi Mochi" MultiNet6 wake word:
python3 tools/cook-procedural-avatar.py --stage 4 --curiosity 0.85 --affection 0.90 --playfulness 0.80 \
--srmodels firmware/srmodels/srmodels_mn6_en.binIf profiles/esp32-s3-1.54-ipex-v2.5-otto/08-assets-0xAA0000.bin is present locally, the script also writes a ready-to-flash themes/procedural-mochi-fullvien-240x320.bin image (checksum = 0xda16 when paired with srmodels_mn6_en.bin, leaving +64.9 KB safety headroom in 0xAA0000) and prints the exact esptool command:
python3 -m esptool --chip esp32s3 -p /dev/cu.usbmodem<port> -b 921600 \
write_flash 0xAA0000 themes/procedural-mochi-fullvien-240x320.binpython3 tools/mochi-soul-engine/app.py --port 4390 --wdt-rescue autoOpen http://127.0.0.1:4390 to inspect the 60fps authentic Mochi vector canvas (GET /api/mochi-vectors), scrub HC-SR04 distance and 16 kHz audio RMS, trigger workspace symbiosis care events (git_commit, test_pass, build_fail, pomodoro_break), evolve the EVO-01 genome (POST /api/evolve), trigger EVO-03 dream consolidation (POST /api/dream), inspect the EVO-03b USB-JTAG Watchdog Auto-Rescue FSM (GET /api/wdt), or fetch the 240×320 Tamagotchi HUD card at http://127.0.0.1:4390/api/hud.png.
python3 tools/robotctl.py health --watch 2.0 --wdt-rescue notifyOpens the USB-JTAG serial port with dtr=False and rts=False so the ESP32-S3 never resets, checks ICMP reachability on LAN, and monitors for watchdog stalls. health exits 0 with or without a board connected.
Back up NVS before you flash.
optimize --flashwrites the NVS partition at0x9000, which holds the board's saved settings, Wi-Fi included. Read that partition back from the board with esptool first, using the partition size from your own partition table, and keep the file.
The avatar build and the flash step read your own device dumps. Dumps and built .bin files are gitignored and are not in the repository:
python3 tools/cook-procedural-avatar.pyneeds your dump of the assets partition atprofiles/example-esp32s3-n16r8/partitions/08-assets-0xAA0000.bin(or pass--base-bin). Without it the script prints an error and exits with status 2. It buildsthemes/procedural-mochi-fullvien-240x320.binlocally; that file is not tracked. The finished GIFs are already committed inthemes/procedural-mochi/.robotctl.py status,optimizeandoptimize --flashread your own dump of the NVS partition atprofiles/example-esp32s3-n16r8/partitions/03-nvs-0x009000.bin(--nvsforstatus,--base-nvsforoptimize). Without it they print how to read the partition from your board and exit with status 2.--flashthen writes only NVS at0x9000, throughuvx esptool, so it needs uv.
Photos of the physical RB5320XZ78AI build, taken by the repository owner. The network name, setup address, serial prints and QR codes are blurred or covered by a solid bar. Third-party silkscreen art and logos (a ring logo, a ribbed oval emblem, a poster, a lion drawing and a few small symbols, on the board edges and in the line-art drawings shown on the screen), the embossed brand marks on a cable plug and a bottle, and the module model text are blurred in every photo where they appear. Generic board labels such as pin names, part numbers and the SPI, PWR ON and PCM labels stay visible. Photo 05 (back of the board) shows no such art, and the files carry no metadata. Select a photo for the full-size version.
robotctl.py health runs a four-layer audit without resetting the chip.
- Layer 1, physical and LAN. USB-JTAG is opened with
~HUPCLso DTR is never dropped. The tool resolves the device in the ARP table by its MAC and measures ping latency. - Layer 2, cloud AI and weather. TLS reachability to the voice server and Open-Meteo.
- Layer 3, NVS and assets. NVS CRC32 plus the asset-partition che
988B
cksum (
0x5867/0xda16). - Layer 4, UART telemetry & WDT Rescue (
EVO-03b). Passive 115200 baud logs for uptime, app state (idle/listening/speaking), WARN/ERROR counters, and 12-state Watchdog Auto-Rescue FSM.
All numbers below are single-run host measurements produced on Apple Silicon (Python 3.11) by the benchmark scripts in tools/ and stored in plans/reports/. Re-run any benchmark locally with the commands shown.
| Subsystem | Script | Headline metric (single-run host) | Report JSON |
|---|---|---|---|
| Canonical Mochi-21 Avatar Pack | python3 tools/benchmark-avatar-perf.py |
217.67 KB (222,892 B) for 21 GIFs (-91.3% vs 2,560.27 KB); 106.0 µs/frame host LZW decode |
benchmark-avatar-perf.json |
| 4D Homeostasis & EVO-01..03 Soul | python3 tools/mochi-soul-engine/engine.py benchmark |
0.76 µs/tick (1,310,618 ticks/s); 0.15 ms SQLite WAL write; 28/28 quiet-hour suppressions |
benchmark-mochi-soul-engine.json |
Proactive ota_1 Bridge & HUD |
python3 tools/mochi-soul-engine/bridge.py benchmark |
2.19 ms/card for 240×320 PNG (2,767 B); 0.92 µs/packet schema guard (9/9 malformed rejected) |
benchmark-proactive-bridge.json |
| 60fps 12-DOF Spring & Lip-Sync | python3 tools/mochi-soul-engine/reflex_60fps.py |
2.60 µs/frame 12-DOF step; 420/420 emotion pairs settle in 8.0 frames (133.3 ms); lip-sync |
benchmark-reflex-60fps.json |
Live Studio & Local /ota Hub |
python3 tools/mochi-soul-engine/app.py --benchmark |
169.55 µs/event (5,898 events/s) end-to-end pipeline; 20/20 JSON-RPC 2.0 MCP tools valid |
benchmark-live-companion-app.json |
| Component | Specification | Notes |
|---|---|---|
| SoC & Memory | ESP32-S3 (QFN56, dual-core Xtensa LX7 @ 240 MHz) |
16 MB Quad SPI Flash (0x000000..0xFFFFFF), 8 MB Octal PSRAM |
| Display | 1.54" IPS LCD (ST7789, 240×320 portrait) |
Top 40 px status bar + 240×240 full-bleed Mochi face viewport |
| Locomotion & Sensors | 6× SG90 servo channels (LF, RF, LH, RH, LW, RW) + HC-SR04 (GPIO 11/12) |
Driven by ota_1 (0x560000, xingzhi-cube-1.54tft-wifi v2.5.3) |
| Assets Partition | mmap_assets at flash offset 0xAA0000 (5.25 MB / 5.36 MB slot) |
12-byte header + 44-byte file entries + ZZ-prefixed payloads (srmodels.bin / srmodels_mn6_en.bin, font, index.json, 21 emoji_*.gif) |
Never boot
ota_0(0x020000). OnRoBot.5320, slotota_0holds an olderv2.2.24-servo build that lacks the 6-servo quadruped mixer andHC-SR04ultrasonic driver. Keepotadata(0x00d000) pointed atota_1(0x560000).
| Path | Purpose |
|---|---|
tools/mochi_canonical_vectors.py |
Decode and inspect the 108,522 Structure-of-Arrays (SoA) horizontal scanline spans (y, x0, w, color) across all 210 canonical Mochi frames (240×147 in MOCHI_PALETTE_8). |
tools/cook-procedural-avatar.py |
Render all 21 240×240 8-color Mochi GIFs (217.67 KB), apply optional EVO-02 phenotype traits (--stage, --curiosity, --affection, --playfulness, --resilience), and repack 08-assets-0xAA0000.bin (with optional --srmodels ESP-SR MultiNet6 wake-word replacement). |
tools/benchmark-avatar-perf.py |
Measure LZW compression ratios, horizontal RLE span density, dirty-pixel ratios, and host decode times across all 21 GIFs. |
tools/robotctl.py |
Unified CLI (health, preview, verify) for non-intrusive (DTR=False, RTS=False) USB-JTAG + LAN health diagnostics with --wdt-rescue {off,notify,auto} and side-by-side HTML avatar preview. |
tools/cook-assets-and-nvs.py |
Inspect and repack esp_mmap_assets (0xAA0000) and NVS (0x9000) partitions. |
tools/xtensa-disasm.py |
Disassemble Xtensa LX7 instruction windows from ota_1 (0x560000) firmware binaries. |
tools/mochi-soul-engine/engine.py |
4D homeostasis state machine (Energy, Hunger, Bond, Mood), EVO-01 Relative-Share Personality Genome, EVO-02 Dual-Track Phenotype, EVO-03 SQLite WAL Dream Consolidation, and 5 growth stages. |
tools/mochi-soul-engine/bridge.py |
Application::OnIncomingJson (0x4202c0c8) packet builder/validator and 240×320 Tamagotchi HUD PNG renderer (12-color canonical Mochi palette). |
tools/mochi-soul-engine/reflex_60fps.py |
60 Hz 12-DOF exact ZOH spring-damper solver, 16 kHz PCM RMS lip-sync envelope tracker, HC-SR04 reflex mapper, and C++17 header generator (mochi_face_60fps.hpp). |
tools/mochi-soul-engine/serial_supervisor.py |
Single-owner passive USB-JTAG supervisor (DTR=False, RTS=False) and 12-state Watchdog Auto-Rescue FSM (EVO-03b) with a 2-reset/15-min circuit breaker. |
tools/mochi-soul-engine/app.py |
Unified local HTTP server (127.0.0.1:4390) serving studio.html, /api/mochi-vectors, /api/evolve, /api/dream, /api/wdt, /ota, /api/hud.png, and /api/state. |
Run the offline smoke suite (16 functional checks across the avatar cooker, canonical vector table, EVO-01..03 soul engine, proactive bridge, 60fps spring solver, serial supervisor, and studio server) and the repository acceptance gate:
python3 tools/ci/smoke.py
bash tools/ci/acceptance.shBuilt by Jang Trịnh. More projects, case studies and writing at jang.work.
Released under the PolyForm Shield License 1.0.0 (SPDX-License-Identifier: LicenseRef-PolyForm-Shield-1.0.0). Free to inspect, run, modify, and use on your own robots; commercial redistribution that competes with the Licensor is restricted as defined in LICENSE.