A complete operating system for handheld devices based on ESP32 and FreeRTOS. This project implements a modular kernel architecture, a custom transactional file system, and advanced connectivity capabilities (AI Chat, UDP Mesh Messaging), all running on a low-cost, high-efficiency microcontroller.
| Front | PCB Front | PCB Back |
|---|---|---|
![]() |
![]() |
![]() |
-
True Multitasking Architecture: FreeRTOS-based kernel with segregated tasks for UI Rendering (50Hz), Input Sampling (High Speed), Network Communications, and Business Logic.
-
Custom Flash File System: A Log-Structured File System designed from scratch featuring:
- Automatic Wear Leveling and Garbage Collection to extend Flash memory life.
- Power-loss corruption protection via Atomicity and Journaling.
- Dynamic partitioning based on key prefixes.
-
Modular Application Engine: Uses the Factory design pattern to dynamically load, unload, and manage the lifecycle of "Apps" to optimize RAM usage.
-
Hybrid Connectivity:
- Online Mode: REST Client for interaction with LLMs supporting stream responses.
- Local Mode: Decentralized "Walkie-Talkie" style chat via UDP Broadcast over local network (Serverless).
-
Smart Input: Experimental predictive text engine based on N-Grams to speed up typing.
-
Power Management: Smart Deep Sleep with hardware interrupt wake-up and critical state persistence.
The system abandons the simple setup/loop paradigm in favor of a professional layered architecture:
graph TD
H["Hardware (ESP32)"] --> D["Drivers (Pantalla, Teclado, Flash)"]
D --> K[Kernel / CoreSystem]
K --> OS[FreeRTOS Tasks]
OS --> T1[Input Task]
OS --> T2[UI Render Task]
OS --> T3[Network/UDP Task]
K --> AM[App Manager]
AM --> App1[Calculator]
AM --> App2[AI Chat]
AM --> App3[Messaging]
AM --> App4[Text Reader]
Acts as the central orchestrator (Singleton). It manages the application lifecycle, injects hardware dependencies, and controls the state machine transitions.
nstead of using standard file systems (SPIFFS/LittleFS), a direct driver over SPI Flash ( Flash.cpp / FlashInterface.cpp) was implemented to allow:
-
Append-Only Writing: Maximizes speed and flash lifespan.
-
Address Virtualization: Apps access data using keys (
MSG_ID,BOOK_TEXT) without knowing physical hex addresses. -
Garbage Collection (GC): An intelligent background process compacts fragmented sectors when necessary, recovering space without losing active data.
- AI Chat: Client for language models (GPT/Claude/Local). Allows conversation with an AI, configuring parameters such as MODEL and CONTEXT directly in Flash.
-
Messaging (Local): Local instant messaging system. Devices on the same WiFi network automatically discover each other and exchange messages via UDP packets.
-
Text Reader: A book/document reader with smooth pagination, capable of reading large files stored in dedicated partitions.
-
Calculator: Mathematical utilities with a dedicated graphical interface.
-
Settings: Control panel for managing WiFi, brightness, and system parameters.
The system is designed to run on custom hardware.
lib/APPS: Business logic for each application (Calculator, AI Chat, etc.).lib/BASICS: Low-level drivers (Flash, Battery, Screen, Keyboard).lib/APPS/CoreSystem: Kernel, State Machine, and Application Manager.src/main.cpp: FreeRTOS tasks and interrupts initialization.docs/: schematics and diagrams.
© 2025 Felix - Open Source Project.






