AI Story Companion Ecosystem — Functional requirements organised by domain: Physical Input (P), Camera & Projection (C), Core Device & Cloud (D), Education System (E), and Mobile App (M). Technology stack, infrastructure architecture, and AI API cost estimates across the full 5-SKU modular platform including the 7-camera vision system and the expanded education tier system.
All 4 buttons, the mechanical privacy slide, and the USB-C port are on the BACK face (parent-facing) of the AI Audio Cube. The firmware must handle GPIO interrupts with <50ms debounce latency and differentiate single-press from long-press events.
| ID | Requirement | GPIO / Interface | Priority |
|---|---|---|---|
| P-01 | Power Button (BACK face) — short press powers on; long press (≥3 s) initiates graceful shutdown sequence; interrupt-driven, debounced 50 ms | GPIO 17 (BCM) — pull-up, falling edge | MUS |
| P-02 | Volume Up (BACK face) — single press increments volume by 1 step (16 steps, 0–100%); long press auto-repeats at 150 ms intervals; visual LED pulse confirms event | GPIO 27 (BCM) — pull-up, falling edge | MUS |
| P-03 | Volume Down (BACK face) — same behaviour as P-02 in reverse; mute on double-press; LED dims on mute state | GPIO 22 (BCM) — pull-up, falling edge | MUS |
| P-04 | Camera Capture (BACK face) — single press triggers Sony IMX477 1080p30 capture; captured image sent to personalisation pipeline; LED ring flashes white on capture; button disabled when privacy slide closed | GPIO 5 (BCM) — pull-up, falling edge | MUS |
| P-05 | Privacy Slide (BACK face) — mechanical hardware kill — sliding to CLOSED position physically blocks the IMX477 lens AND triggers GPIO LOW, immediately suspending the camera capture pipeline (<100 ms); no software bypass possible; privacy state logged for audit; camera LED reflects slide state at all times | GPIO 6 (BCM) — pull-up, closed = LOW | MUS |
| P-06 | USB-C Port (BACK face) — standalone charging — USB-C 3.1 Gen 1 receptacle; 5V/3A (15W) input via TI BQ25895 PMIC; primary standalone charging path (Dock is optional convenience); charge LED on BACK face reflects charge state; supports USB-C cable included in box | USB-C 3.1 Gen 1 — PMIC I²C 0x6B | MUS |
| P-07 | Button Handler firmware service — single daemon process managing all 4 GPIO interrupts; debounce filter 50 ms; event bus publishes button_event{id, type} where type ∈ {press, long_press, double_press, release}; no blocking I/O; runs at <1% CPU idle | gpiozero / RPi.GPIO interrupt callbacks | MUS |
Total: 7 cameras across the 5-SKU system. All camera feeds are processed on-device — no video streams are stored or transmitted to the cloud. Projection mapping runs as an on-device calibration pipeline (Calibration Engine) activated at boot and on module hot-plug.
| ID | Requirement | Component | Priority |
|---|---|---|---|
| C-01 | Cube camera (Sony IMX477, FRONT face) — 12MP, 1080p30, wide-angle, CSI-2 interface; activated only by P-04 Camera Capture button press; capture image sent to AI personalisation pipeline; disabled entirely when privacy slide is CLOSED (P-05) | libcamera + IMX477 driver | MUS |
| C-02 | Dome camera (OV5647, downward) — 5MP, wide-angle fisheye view of ceiling; streams to Calibration Engine only during calibration phase; never stored; ceiling scan complete <8 s at boot | libcamera + OV5647 driver | MUS |
| C-03 | 1-Proj camera (OV5647, forward) — 5MP dual-role: (a) wall geometry mapping for keystone correction; (b) continuous real-time person detection during active projection; camera stream processed entirely on-device NPU via TFLite MobileNet | libcamera + OpenCV + TFLite | MUS |
| C-04 | 4-Sides cameras (4× OV5647, N/S/E/W) — one camera per face; simultaneous capture for per-face geometry correction and edge blending; all 4 feeds processed in parallel on Cube SoM; calibration complete <15 s at boot | libcamera multi-camera + OpenCV | MUS |
| C-05 | Fisheye distortion correction (Dome) — apply Brown–Conrady or equidistant fisheye model; pre-computed LUT stored on-device; correction applied per-frame before scene render; ≥95% ceiling coverage at 2.5 m room height validated at Phase 2 | OpenCV calibrateCamera + undistort | MUS |
| C-06 | Wall geometry mapping + keystone correction (1-Proj, 4-Sides) — detect wall plane via camera; compute homography; apply perspective warp to rendered frame before projection; re-calibrate automatically if camera detects geometry change >5% | OpenCV findHomography + warpPerspective | MUS |
| C-07 | Person / eye safety detection (1-Proj camera) — TFLite MobileNet person detector runs continuously at ≥10 fps during projection; on person detection in beam path → I2C dim command to projector within <200 ms; projector brightens when person clears; EN 62471 photobiological safety compliance required | TFLite MobileNet + I2C dim ctrl | MUS |
| C-08 | Auto-calibration on boot and hot-plug — Calibration Engine triggers full calibration sequence for each newly detected module within 3 s of I2C detection event; calibration runs non-blocking in background; projection begins in fallback (uncorrected) mode until calibration complete | FW (Calibration Engine) | MUS |
| C-09 | Calibration Engine — 6-step pipeline: (1) Module detection via I2C; (2) Camera initialisation via libcamera; (3) Checkerboard / structured-light scan; (4) Distortion parameter computation; (5) Homography / LUT generation; (6) Scene compositor update. Total calibration time <15 s per module. | FW (Calibration Engine) + OpenCV | MUS |
| C-10 | Edge blending (4-Sides Module) — detect seam between adjacent projected faces; apply alpha-gradient blend across ≥10 px overlap zone; blend must be imperceptible in normal viewing conditions (≥1.5 m from wall) | OpenGL ES blend shader | MUS |
| C-11 | Camera data privacy — no camera frame or derived data (embeddings, detections) is transmitted to the cloud; on-device processing only; camera feeds are discarded after use; only scene calibration parameters (LUT/homography) are persisted to local flash | FW policy + privacy audit log | MUS |
| ID | Requirement | Priority | Component |
|---|---|---|---|
| D-01 | System must detect wake word with <500ms latency in ambient noise up to 60 dB; wake-word runs entirely on-device (Porcupine); no cloud dependency for activation | MUS | FW (Wake-word) |
| D-02 | ASR must transcribe child speech with >90% accuracy (ages 4–10); primary: Google Cloud Speech / AWS Transcribe; fallback: on-device Whisper.cpp tiny/base model | MUS | FW + Cloud STT |
| D-03 | Module Manager must auto-detect any attached module via I2C 1-Wire ID ROM within <3 seconds of physical connection; hot-swap without crash; graceful recovery on unexpected disconnect | MUS | FW (Module Manager) |
| D-04 | Projection Compositor must render the correct scene per attached module set (Dome / 1-Proj / 4-Sides / any combination); frame sync across all active modules <1 ms; 4 Sides Module must maintain <1 ms cross-projector frame synchronisation | MUS | FW (Proj. Compositor) |
| D-05 | System must support offline storytelling mode using pre-cached story segments; offline cache ≥5 stories; automatic sync when Wi-Fi reconnects | MUS | FW + Cloud |
| D-06 | OTA firmware update must apply to all connected modules in a single session; rollback on failure for any SKU; update size <250 MB per SKU; boot to updated state <3 min | MUS | FW + DevOps (Mender) |
| D-07 | Story generation API must return first audio chunk in <800 ms (p95); content safety classifier must pass every LLM output before transmission to device; child-safe system prompt enforced at all times | MUS | Cloud (Story Orchestrator) |
| D-08 | Story memory service must persist characters, plotlines, and preferences across sessions; memory retrievable by child ID; parent can delete all data; deletion propagates within 30 days (GDPR/COPPA) | MUS | Cloud (Memory Svc + pgvector) |
| D-09 | All child data encrypted at rest (AES-256) and in transit (TLS 1.3); all microphone audio processed on-device and discarded — never stored; sleep motion data anonymised before analytics processing; COPPA and GDPR compliance required | MUS | All services |
| D-10 | Platform must support horizontal auto-scaling to 100K concurrent devices; target p99 API latency <2 s at peak load; device must boot to ready state in <15 s | MUS | Cloud Infra / K8s |
The education system introduces three age-differentiated tiers, a downloadable Adventure Course content system, and curriculum alignment with EYFS/KS1/KS2 (UK) and Common Core State Standards (US). All education processing runs through the standard Story Orchestrator pipeline with age-tier context injection.
| ID | Requirement | Priority | Component |
|---|---|---|---|
| E-01 | Age tier selection — 3 tiers: Seedlings (ages 3–5), Explorers (ages 5–7), Adventurers (ages 7–10); tier set by parent in app or via BACK face button combination; tier persists in child profile; controls LLM complexity, vocabulary, TTS rate, and curriculum mapping | MUS | Cloud (Story Orchestrator) + Mobile App |
| E-02 | Seedlings mode (3–5 yrs) — simplified vocabulary; TTS rate ≤120 WPM; sentence length ≤8 words; phonics and basic numeracy prompts; large LED cues for milestones; max session length enforced: 20 min; no complex projections — simple colours and shapes only | MUS | Story Orchestrator + FW |
| E-03 | Explorers mode (5–7 yrs) — intermediate vocabulary; TTS rate 120–150 WPM; guided narrative with literacy, math, and early science; IMU gesture support for interactive elements; standard projection with auto-keystone; session length up to 35 min | MUS | Story Orchestrator + FW |
| E-04 | Adventurers mode (7–10 yrs) — full AI pipeline; multi-turn reasoning; complex narrative structures; full subject breadth (language, maths, science, geography, history); immersive projection with all active modules; Adventure Course packs streamed from local flash; session up to 60 min | MUS | Story Orchestrator + FW |
| E-05 | Adventure Course packs — downloadable content bundles (50–150 MB compressed); each pack contains: narrative scripts, structured lesson plan, audio assets, scene image assets, quiz prompts; packs stored on 32 GB eMMC flash; sync via Wi-Fi during idle/charging; max 100+ packs on-device | MUS | Cloud (Content CDN) + FW (local storage) |
| E-06 | EYFS curriculum alignment (UK) — Early Years Foundation Stage: Communication & Language, Literacy, Mathematics, Understanding the World, Expressive Arts; LLM system prompt includes active EYFS learning goal for each session; progress logged per goal | MUS | Story Orchestrator (system prompt) |
| E-07 | KS1 / KS2 curriculum alignment (UK) — Key Stage 1 (ages 5–7) and Key Stage 2 (ages 7–11) national curriculum subjects; English, Mathematics, Science, History, Geography; curriculum goal injected into story context; Adventure Courses tag each session with relevant KS objectives | MUS | Story Orchestrator + Content System |
| E-08 | Common Core State Standards mapping (US) — ELA and Mathematics standards K–3 mapped to Seedlings and Explorers tiers; Standards K–5 for Adventurers; standard identifiers tagged in Adventure Course metadata; US-specific content packs align to grade-level expectations | SHO | Story Orchestrator + Content System |
| E-09 | Subject areas — Language & Literacy (phonics, vocabulary, reading comprehension, creative writing); Numeracy (counting, arithmetic, patterns, geometry); Science (nature, experiments, life cycles, space); Geography (maps, countries, habitats); History (timelines, famous people, world events); at least 1 subject active per Adventure Course | MUS | Content System + Story Orchestrator |
| E-10 | Learning progress tracking — per-child progress logged per subject, per tier, per Adventure Course; progress visible to parent in app; learning streak tracking (daily session count); milestone LED animations triggered by level completion | MUS | Cloud (Progress Svc) + Mobile App |
| E-11 | Adaptive difficulty — Story Orchestrator monitors child response patterns; if comprehension signals fall below threshold (e.g. repeated "I don't know" responses), system auto-decreases complexity within session; upward difficulty adapts over sessions not within session | SHO | Story Orchestrator (ML signal) |
| E-12 | Parental educational control — parent sets active age tier, subject preferences, and blocked topics via mobile app; BACK face button combination allows quick tier change without app (documented in setup guide); content restrictions propagate to device within <30 s of app change | MUS | Mobile App + Cloud (Parental Ctrl Svc) |
| E-13 | Educational content safety classifier — separate classifier layer for education content in addition to base child-safe classifier (D-07); validates factual accuracy signals; flags content that contradicts curriculum objectives; age-appropriateness score checked against tier limits | MUS | Cloud (Safety Svc) |
| E-14 | Adventure Course marketplace — in-app browsable catalogue of available course packs; free tier (3 included) + premium subscription unlocks full library; one-time pack purchases available (€2.99–€4.99 per pack); licensed IP packs (Disney, BBC, Penguin) available post-launch; download triggered from app, delivered via CDN to device | SHO | Mobile App + Cloud (Content CDN) + Billing |
| ID | Requirement | Priority | Component |
|---|---|---|---|
| M-01 | App must support iOS 16+ and Android 12+ | MUS | Mobile App |
| M-02 | Parent must be able to create and manage up to 5 child profiles, each with name, age, and education tier | MUS | Mobile App |
| M-03 | App must display which modules are currently connected to the Cube (live status with module name, icon, and connection health) | MUS | Mobile App |
| M-04 | App must provide per-module brightness and projection controls for each attached projection module | MUS | Mobile App |
| M-05 | App must provide content filtering controls (themes, age level, topics) and education tier selection (Seedlings / Explorers / Adventurers) | MUS | Mobile App |
| M-06 | App must display sleep summary with story and motion timeline; education progress dashboard (per subject, per tier) | SHO | Mobile App |
| M-07 | App must support bedtime schedule configuration with automatic enforcement | MUS | Mobile App |
| M-08 | App must allow purchase and management of subscriptions and Adventure Course packs | MUS | Mobile App |
| M-09 | App must work offline for settings management (sync when reconnected) | SHO | Mobile App |
| M-10 | Push notifications for sleep summary delivery, usage alerts, and new Adventure Course availability | COU | Mobile App |
| M-11 | App must display story history, education progress timeline, and allow replay of saved stories | COU | Mobile App |
| Layer | Technology | Justification |
|---|---|---|
| Embedded OS | Linux (Yocto/Buildroot 2024) | Minimal footprint, full control, wide hardware support |
| Embedded Language | Python 3.11 + asyncio | Rapid prototyping, async I/O for audio/network/module detection |
| Wake Word | Porcupine SDK (on-device) | Privacy-first, no cloud dependency, <5mW |
| Button GPIO | python-gpiozero / RPi.GPIO | 4× tactile button debouncing (Power, Vol+, Vol−, Camera Capture) + privacy slide state monitoring — all BACK face |
| Camera Driver | libcamera + V4L2 | Unified camera interface for Sony IMX477 (Cube, FRONT) and 6× OV5647 (Dome, 1-Proj, 4-Sides) |
| CV Pipeline | OpenCV 4 + TFLite MobileNet | Person detection on 1-Proj (<200 ms auto-dim); fisheye correction (Dome); geometry mapping + edge blending (4-Sides) |
| Calibration Engine | Custom Python service + OpenCV | 6-step projection mapping calibration pipeline; triggers on boot and module hot-plug; non-blocking background execution |
| Module Manager | Custom I2C daemon (Python/C) | Handles hot-swap, module ID via 1-Wire, GPIO sync |
| Projection Compositor | Custom OpenGL ES renderer | Per-module-set scene rendering, fisheye correction, frame sync |
| Local STT | Whisper.cpp (tiny/base) | Offline fallback, acceptable accuracy for simple commands |
| Cloud STT | Google Cloud Speech / AWS Transcribe | High accuracy, multi-language, child voice models; $0.024/min |
| LLM | Anthropic Claude 3 Sonnet (primary), GPT-4o (fallback) | Safety features, quality, cost balance; education tier context injection |
| Orchestration | LangChain + LangGraph | Narrative state machine, tool use, memory + module context + education tier integration |
| Vector DB | pgvector (PostgreSQL) / Pinecone | Story memory, semantic search, low-latency retrieval |
| TTS | ElevenLabs (primary), Azure Cognitive Services (fallback) | Natural child-friendly voices; $0.12/1K chars; tier-appropriate rate and style |
| Music | MusicGen (HuggingFace) + S3 curated library | Dynamic generation + reliable fallback |
| Image Generation | DALL-E 3 / Stable Diffusion XL | Quality illustrations, child-safe safety filters |
| Projection Scene Service | Python/FastAPI microservice | Module-aware scene selection, narrative context integration |
| Education Content System | FastAPI microservice + S3 CDN | Adventure Course pack storage, curriculum metadata, progress tracking API |
| Backend Language | Python 3.11 + FastAPI | Async, fast, typed, excellent ecosystem |
| Message Queue | RabbitMQ / AWS SQS | Async task dispatch for generation services |
| Primary DB | PostgreSQL 16 | ACID, pgvector, mature, excellent managed options |
| Cache | Redis 7 | Session tokens, TTS cache, rate limiting |
| Time-Series DB | InfluxDB 2 / TimescaleDB | Sleep/motion sensor data |
| Analytics | ClickHouse | High-volume anonymised event analytics |
| Object Storage | AWS S3 / Cloudflare R2 | Illustrations, audio cache, firmware bins (all 5 SKUs), Adventure Course packs |
| CDN | Cloudflare | Global low-latency media delivery + Adventure Course pack distribution |
| Container Runtime | Docker + Kubernetes (EKS/GKE) | Scalable microservices, managed K8s |
| CI/CD | GitHub Actions + ArgoCD | GitOps, automated deploy, rollback; separate FW pipelines per SKU |
| Monitoring | Prometheus + Grafana + Loki | Metrics, dashboards, log aggregation |
| Mobile | React Native + Expo | Cross-platform iOS + Android, code sharing |
| Auth | Keycloak + JWT | OIDC/OAuth2, SSO, parental consent flows |
| IaC | Terraform + Helm | Reproducible infra, version-controlled deployments |
| OTA | Mender / SWUpdate | Secure firmware update for all 5 SKUs in single session |
The platform is deployed on AWS (primary) with GCP as a failover/multi-cloud option. All services run containerised on Kubernetes. Environment separation: dev / staging / production. The Projection Scene Service and new Education Content Service run as independent microservices alongside the Story Orchestrator. The Calibration Engine runs entirely on-device — no cloud component.
| Service | AWS Service | Sizing (initial) | Scaling |
|---|---|---|---|
| Kubernetes Cluster | EKS (Kubernetes 1.30) | 3 × m6i.xlarge nodes | Auto-scale 3–20 nodes |
| Relational DB | RDS PostgreSQL 16 | db.t3.large (Multi-AZ) | Read replicas at 10K DAU |
| Cache | ElastiCache Redis 7 | cache.t3.medium (cluster) | Scale with session volume |
| Message Queue | Amazon SQS | Standard queues | Managed, auto-scales |
| Projection Scene Service | EKS Pod (FastAPI) | 2 replicas minimum | Auto-scale with device count |
| Education Content Service | EKS Pod (FastAPI) + S3 | 2 replicas + CDN | Auto-scale; CDN offloads pack delivery |
| Object Storage | S3 Standard + Intelligent Tiering | Unlimited (incl. 5× FW binaries + course packs) | Managed |
| CDN | CloudFront + Cloudflare | Global PoPs | Managed |
| Container Registry | ECR | Private repos per service + per SKU FW | Managed |
| Secrets | AWS Secrets Manager | Per-service secrets | Managed |
| DNS & Load Balancer | Route53 + ALB | Regional ALB | Managed, auto-scales |
| Monitoring | CloudWatch + managed Prometheus Workspace | — | Managed |
| Log Aggregation | CloudWatch Logs + Loki (Grafana Cloud) | Retained 30 days | Managed |
| CI/CD Runners | GitHub Actions (managed) | 8-core runners | Managed |
| Analytics DB | ClickHouse Cloud (startup tier) | 2 shards | Scale with data volume |
Assuming 20 minutes average daily usage, 30 days/month, ~1,200 LLM tokens per story exchange. Estimates at 10,000 MAD (Monthly Active Devices). CV pipeline runs entirely on-device (NPU on CM5) — zero cloud cost. STT updated to $0.024/min (premium child voice model tier). TTS at $0.12/1K chars (ElevenLabs Pro v2).
| Service | Volume / month (10K MAD) | Unit Cost | Monthly Total |
|---|---|---|---|
| LLM (Claude Sonnet / GPT-4o) | 360M tokens in + 90M out | $3/$15 per 1M | ~$4,700 |
| STT (Google Cloud Speech — child voice model) | ~6,000 hours audio | $0.024/min | ~$8,640 |
| TTS (ElevenLabs Pro v2) | ~17,500K chars | $0.12/1K chars | ~$2,100 |
| DALL-E 3 (scene illustrations) | ~200K images | $0.04/image | ~$8,000 |
| Projection Scene Service (LLM calls — module-aware scenes) | ~5,500 sessions/day × scene tokens | $3/$15 per 1M | ~$300 |
| AWS Infra (K8s + DB + S3) | Fixed + variable | — | ~$2,700 |
| CDN + Storage (media + 5× FW + course packs) | Media delivery + firmware bins + pack sync | $0.02/GB out | ~$900 |
| CV Pipeline (person detection, fisheye, geometry mapping) | On-device NPU — no cloud compute required | $0 | $0 |
| Total estimated | ~$27,340/mo | ||
| Per active device | ~$2.73/device/mo | ||