Software Requirements · Dev Needs & Infrastructure · March 2026

Software Development & Infrastructure Analysis

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.

1. Functional Software Requirements

Priority Key: MUS = Must Have (MVP)   SHO = Should Have (v1.0)   COU = Could Have (post-launch)

1.1 Physical Input Requirements (P-xx)

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.

IDRequirementGPIO / InterfacePriority
P-01Power Button (BACK face) — short press powers on; long press (≥3 s) initiates graceful shutdown sequence; interrupt-driven, debounced 50 msGPIO 17 (BCM) — pull-up, falling edgeMUS
P-02Volume 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 eventGPIO 27 (BCM) — pull-up, falling edgeMUS
P-03Volume Down (BACK face) — same behaviour as P-02 in reverse; mute on double-press; LED dims on mute stateGPIO 22 (BCM) — pull-up, falling edgeMUS
P-04Camera 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 closedGPIO 5 (BCM) — pull-up, falling edgeMUS
P-05Privacy 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 timesGPIO 6 (BCM) — pull-up, closed = LOWMUS
P-06USB-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 boxUSB-C 3.1 Gen 1 — PMIC I²C 0x6BMUS
P-07Button 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 idlegpiozero / RPi.GPIO interrupt callbacksMUS

1.2 Camera System & Projection Mapping Requirements (C-xx)

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.

IDRequirementComponentPriority
C-01Cube 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 driverMUS
C-02Dome 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 bootlibcamera + OV5647 driverMUS
C-031-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 MobileNetlibcamera + OpenCV + TFLiteMUS
C-044-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 bootlibcamera multi-camera + OpenCVMUS
C-05Fisheye 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 2OpenCV calibrateCamera + undistortMUS
C-06Wall 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 + warpPerspectiveMUS
C-07Person / 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 requiredTFLite MobileNet + I2C dim ctrlMUS
C-08Auto-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 completeFW (Calibration Engine)MUS
C-09Calibration 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) + OpenCVMUS
C-10Edge 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 shaderMUS
C-11Camera 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 flashFW policy + privacy audit logMUS

1.3 Core Device & Cloud Requirements (D-xx)

IDRequirementPriorityComponent
D-01System 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 activationMUSFW (Wake-word)
D-02ASR must transcribe child speech with >90% accuracy (ages 4–10); primary: Google Cloud Speech / AWS Transcribe; fallback: on-device Whisper.cpp tiny/base modelMUSFW + Cloud STT
D-03Module 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 disconnectMUSFW (Module Manager)
D-04Projection 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 synchronisationMUSFW (Proj. Compositor)
D-05System must support offline storytelling mode using pre-cached story segments; offline cache ≥5 stories; automatic sync when Wi-Fi reconnectsMUSFW + Cloud
D-06OTA 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 minMUSFW + DevOps (Mender)
D-07Story 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 timesMUSCloud (Story Orchestrator)
D-08Story 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)MUSCloud (Memory Svc + pgvector)
D-09All 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 requiredMUSAll services
D-10Platform 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 sMUSCloud Infra / K8s

1.4 Education System Requirements (E-xx)

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.

IDRequirementPriorityComponent
E-01Age 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 mappingMUSCloud (Story Orchestrator) + Mobile App
E-02Seedlings 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 onlyMUSStory Orchestrator + FW
E-03Explorers 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 minMUSStory Orchestrator + FW
E-04Adventurers 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 minMUSStory Orchestrator + FW
E-05Adventure 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-deviceMUSCloud (Content CDN) + FW (local storage)
E-06EYFS 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 goalMUSStory Orchestrator (system prompt)
E-07KS1 / 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 objectivesMUSStory Orchestrator + Content System
E-08Common 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 expectationsSHOStory Orchestrator + Content System
E-09Subject 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 CourseMUSContent System + Story Orchestrator
E-10Learning 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 completionMUSCloud (Progress Svc) + Mobile App
E-11Adaptive 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 sessionSHOStory Orchestrator (ML signal)
E-12Parental 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 changeMUSMobile App + Cloud (Parental Ctrl Svc)
E-13Educational 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 limitsMUSCloud (Safety Svc)
E-14Adventure 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 deviceSHOMobile App + Cloud (Content CDN) + Billing

1.5 Mobile App Requirements (M-xx)

IDRequirementPriorityComponent
M-01App must support iOS 16+ and Android 12+MUSMobile App
M-02Parent must be able to create and manage up to 5 child profiles, each with name, age, and education tierMUSMobile App
M-03App must display which modules are currently connected to the Cube (live status with module name, icon, and connection health)MUSMobile App
M-04App must provide per-module brightness and projection controls for each attached projection moduleMUSMobile App
M-05App must provide content filtering controls (themes, age level, topics) and education tier selection (Seedlings / Explorers / Adventurers)MUSMobile App
M-06App must display sleep summary with story and motion timeline; education progress dashboard (per subject, per tier)SHOMobile App
M-07App must support bedtime schedule configuration with automatic enforcementMUSMobile App
M-08App must allow purchase and management of subscriptions and Adventure Course packsMUSMobile App
M-09App must work offline for settings management (sync when reconnected)SHOMobile App
M-10Push notifications for sleep summary delivery, usage alerts, and new Adventure Course availabilityCOUMobile App
M-11App must display story history, education progress timeline, and allow replay of saved storiesCOUMobile App

2. Technology Stack

LayerTechnologyJustification
Embedded OSLinux (Yocto/Buildroot 2024)Minimal footprint, full control, wide hardware support
Embedded LanguagePython 3.11 + asyncioRapid prototyping, async I/O for audio/network/module detection
Wake WordPorcupine SDK (on-device)Privacy-first, no cloud dependency, <5mW
Button GPIOpython-gpiozero / RPi.GPIO4× tactile button debouncing (Power, Vol+, Vol−, Camera Capture) + privacy slide state monitoring — all BACK face
Camera Driverlibcamera + V4L2Unified camera interface for Sony IMX477 (Cube, FRONT) and 6× OV5647 (Dome, 1-Proj, 4-Sides)
CV PipelineOpenCV 4 + TFLite MobileNetPerson detection on 1-Proj (<200 ms auto-dim); fisheye correction (Dome); geometry mapping + edge blending (4-Sides)
Calibration EngineCustom Python service + OpenCV6-step projection mapping calibration pipeline; triggers on boot and module hot-plug; non-blocking background execution
Module ManagerCustom I2C daemon (Python/C)Handles hot-swap, module ID via 1-Wire, GPIO sync
Projection CompositorCustom OpenGL ES rendererPer-module-set scene rendering, fisheye correction, frame sync
Local STTWhisper.cpp (tiny/base)Offline fallback, acceptable accuracy for simple commands
Cloud STTGoogle Cloud Speech / AWS TranscribeHigh accuracy, multi-language, child voice models; $0.024/min
LLMAnthropic Claude 3 Sonnet (primary), GPT-4o (fallback)Safety features, quality, cost balance; education tier context injection
OrchestrationLangChain + LangGraphNarrative state machine, tool use, memory + module context + education tier integration
Vector DBpgvector (PostgreSQL) / PineconeStory memory, semantic search, low-latency retrieval
TTSElevenLabs (primary), Azure Cognitive Services (fallback)Natural child-friendly voices; $0.12/1K chars; tier-appropriate rate and style
MusicMusicGen (HuggingFace) + S3 curated libraryDynamic generation + reliable fallback
Image GenerationDALL-E 3 / Stable Diffusion XLQuality illustrations, child-safe safety filters
Projection Scene ServicePython/FastAPI microserviceModule-aware scene selection, narrative context integration
Education Content SystemFastAPI microservice + S3 CDNAdventure Course pack storage, curriculum metadata, progress tracking API
Backend LanguagePython 3.11 + FastAPIAsync, fast, typed, excellent ecosystem
Message QueueRabbitMQ / AWS SQSAsync task dispatch for generation services
Primary DBPostgreSQL 16ACID, pgvector, mature, excellent managed options
CacheRedis 7Session tokens, TTS cache, rate limiting
Time-Series DBInfluxDB 2 / TimescaleDBSleep/motion sensor data
AnalyticsClickHouseHigh-volume anonymised event analytics
Object StorageAWS S3 / Cloudflare R2Illustrations, audio cache, firmware bins (all 5 SKUs), Adventure Course packs
CDNCloudflareGlobal low-latency media delivery + Adventure Course pack distribution
Container RuntimeDocker + Kubernetes (EKS/GKE)Scalable microservices, managed K8s
CI/CDGitHub Actions + ArgoCDGitOps, automated deploy, rollback; separate FW pipelines per SKU
MonitoringPrometheus + Grafana + LokiMetrics, dashboards, log aggregation
MobileReact Native + ExpoCross-platform iOS + Android, code sharing
AuthKeycloak + JWTOIDC/OAuth2, SSO, parental consent flows
IaCTerraform + HelmReproducible infra, version-controlled deployments
OTAMender / SWUpdateSecure firmware update for all 5 SKUs in single session

3. Infrastructure Architecture

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.

ServiceAWS ServiceSizing (initial)Scaling
Kubernetes ClusterEKS (Kubernetes 1.30)3 × m6i.xlarge nodesAuto-scale 3–20 nodes
Relational DBRDS PostgreSQL 16db.t3.large (Multi-AZ)Read replicas at 10K DAU
CacheElastiCache Redis 7cache.t3.medium (cluster)Scale with session volume
Message QueueAmazon SQSStandard queuesManaged, auto-scales
Projection Scene ServiceEKS Pod (FastAPI)2 replicas minimumAuto-scale with device count
Education Content ServiceEKS Pod (FastAPI) + S32 replicas + CDNAuto-scale; CDN offloads pack delivery
Object StorageS3 Standard + Intelligent TieringUnlimited (incl. 5× FW binaries + course packs)Managed
CDNCloudFront + CloudflareGlobal PoPsManaged
Container RegistryECRPrivate repos per service + per SKU FWManaged
SecretsAWS Secrets ManagerPer-service secretsManaged
DNS & Load BalancerRoute53 + ALBRegional ALBManaged, auto-scales
MonitoringCloudWatch + managed Prometheus WorkspaceManaged
Log AggregationCloudWatch Logs + Loki (Grafana Cloud)Retained 30 daysManaged
CI/CD RunnersGitHub Actions (managed)8-core runnersManaged
Analytics DBClickHouse Cloud (startup tier)2 shardsScale with data volume

4. AI API Cost Estimates

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).

ServiceVolume / month (10K MAD)Unit CostMonthly 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
~61%
Gross AI+Infra Margin at 10K MAD
>75%
Margin at 50K MAD (volume discounts)
€7/mo
Premium Subscription Price
Unit Economics Note: At €7/mo Premium subscription, gross AI+infra margin is ~61% at 10K MAD (~$2.73/device/mo). At 50K MAD, volume discounts on LLM and STT push margin above 75%. STT cost reflects child voice model premium tier ($0.024/min). TTS savings from ElevenLabs Pro v2 pricing ($0.12/1K chars). CV pipeline for the 7-camera system runs entirely on the on-device NPU at zero cloud cost — a key advantage of the SoM selection (CM5 / i.MX 8M+ with dedicated NPU). Adventure Course pack delivery cost is absorbed in CDN/Storage line.