Repository navigation
Home
Raft is an opinionated framework for embedded development. It picks up where the Arduino libraries stop and builds on the basic ideas of setup() and loop() to enable even the most complex applications to be built. Raft simplifies:
- Cooperative multi-tasking
- Configuration (smart, JSON-based)
- Networking (WiFi, BLE, Ethernet, serial)
- Communications (REST, WebSockets, MQTT, file transfer, BLE GATT)
- OTA update (unified mechanism over BLE, WiFi or serial)
- Web server (static files, REST API, WebSockets, SSE)
- I2C bus (auto-detection, identification, polling, recovery)
- Modular design (mix and match capabilities; few interdependencies)
Raft builds on Arduino
setup()andloop()for configuration and async operations, and is opinionated about Convention over Configuration: most of what every connected device needs is provided by default, and configured with a single JSON document.
Raft currently targets the ESP32 family (ESP32, ESP32-S3, ESP32-C3, ESP32-C6) on top of ESP IDF.
- Quick Start — scaffold and build your first Raft app with Raft CLI
- Raft Architecture at a Glance — one-page system overview
- Writing Your First SysMod — end-to-end tutorial
-
Raft CLI — the
raftcommand-line tool - SysTypes — variant-aware build configuration
- Top-Level SysType Configuration — keys at the root of the SysType JSON
-
Raft Build Process — what happens between
raft buildand a flashed binary - WebUI Build Pipeline — parcel/npm flow that bundles the Web UI into the FS image
- File System — LittleFS / SPIFFS / SD, including data files in the build, runtime API, and keeping file system work off the main loop (the file system worker, flash write stalls, write pacing)
- Partitions and Flash Layout — partition tables, OTA slot sizing, NVS
- Local Raft Development Libraries — overriding fetched components with local checkouts
-
Library Developer Guide — unit tests, examples,
raftdevlibs/,linux_unit_tests/anddevdocs/conventions for working on a Raft library
- Architecture at a Glance — one-page system overview with diagram
- SysMods — anatomy of a Raft module
- SysManager — the supervisor that owns SysMods; keeping the main loop short and slow SysMod reporting
- Configuration — configuration layering and access
- JSON / RaftJson — the JSON parser used everywhere
- Advanced RaftJson — chaining, prefix views, NVS, change callbacks
- Communications Stack Overview — channels, codecs, ProtocolExchange, REST endpoints
Networking and connectivity:
Comms channels:
Files, logging and updates:
Publishing and state:
Devices and buses:
- See section 6 below.
- Adding REST API Endpoints — register endpoints from your SysMod
- Adding a Comms Channel — expose a transport as a Raft channel
- Adding an I2C Device Type — plug-and-play support for a new I²C sensor
- Built-in REST Endpoints — endpoints provided by Raft core/SysMods
- Subscription / publish endpoints (see RaftSysModAPI)
- Comms Channels — channel registration, transports, message flow
- ProtocolExchange — the dispatch hub for non-HTTP requests
- RICREST Protocol — wire formats used over BLE, serial and sockets
- Real-Time Streams — open-ended RICREST streams for low-latency bidirectional data
-
File Download Protocol (OKTO) — downloads, and uploads (
ufStart) - File transfers over RICREST — upload and download message flow as clients see it
- OTA Update Flow — end-to-end view of HTTP-direct + file-stream firmware updates
- File upload over HTTP — see FileManager SysMod (
fileupload) - OTA update — see ESPOTAUpdate SysMod
- DeviceManager (settings, REST API)
- Device Factory and Classes
- Device Type Record Format
-
Selecting Device Types — one file per record,
DeviceTypeSources.json - Adding an I2C Device Type — step-by-step tutorial
- Device Data Publishing
- Data Logger
- I2C:
- MotorControl:
- Camera (RaftCamera) — JPEG captures to flash or SD, interval captures, published frames
-
RaftROS — a Raft application as a native ROS 2 node: auto-published device topics, services, parameters,
/api/ros - RaftROS Serial Link — the Zenoh session over the USB cable, switched on and off at run time
-
Console Port Sharing —
RaftConsolePort, how a binary link takes the console's port
- Helper Classes Index — RingBuffer, ThreadSafeQueue, ExpressionEval, NumericalFilters, DebounceButton, MiniHDLC, NamedValueProvider, SupervisorStats, ConfigPinMap, StatusIndicator, DNSResolver, ArPreferences, libb64
- LEDPixels (JSON config)
-
Console Port Sharing —
RaftConsolePort
-
Remote Logging —
raft debugand theRaftRemotelog destination - Raft CLI — flash, monitor, OTA, debug, and files and device type records on a running device over HTTP, WebSocket, serial or BLE
- Raft Web Apps — the Device Types app and the Raft Flasher, in the browser with nothing to install
The Raft framework is split across several repositories:
| Repo | Contents |
|---|---|
| RaftCore | Framework core: SysManager, SysMod base, comms stack, configuration, helper classes |
| RaftSysMods | Built-in SysMods: BLE, Network, MQTT, FileManager, LogManager, OTA, comms channels |
| RaftI2C | I2C bus driver, device scanning, identification, polling |
| RaftWebServer | HTTP / WebSocket / SSE web server with REST, static-file and upload handlers |
| RaftROS | ROS 2 node SysMod (Zenoh, RTPS), device auto-publishing, services, parameters |
| RaftCamera | Camera SysMod (esp32-camera): still captures, interval captures, published frames |
| RaftCLI | The raft command-line tool: scaffold, build, flash, monitor, OTA, and device files and type records |
Each repo also has a devdocs/ folder with internal design notes that may be promoted into this wiki over time.
The Raft libraries are MIT licensed. RaftCore also contains some third-party code and device type records with settings from third-party drivers: its THIRD_PARTY_NOTICES.md lists them with their licences, and the notices a product built with Raft should include in its documentation (with those of ESP-IDF and the other libraries it uses).
Getting Started
- Quick Start
- Architecture at a Glance
- Writing Your First SysMod
- Adding a Comms Channel
- Adding an I2C Device Type
Scaffolding & Building
- Raft CLI
- Web Apps (Device Types, Flasher)
- SysTypes
- Top-Level SysType
- Build Process
- WebUI Build Pipeline
- File System
- Partitions & Flash
- Local Dev Libraries
- Library Developer Guide
Architecture
Built-in SysMods
- NetworkManager
- WiFi Troubleshooting
- BLEManager
- WebServer
- MQTTManager
- SerialConsole
- CommandSerial
- CommandSocket
- CommandFile
- FileManager
- LogManager
- ESPOTAUpdate
- StatePublisher
- Remote Logging
- Data Source Registration
Comms & Protocols
- Stack Overview
- Comms Channels
- ProtocolExchange
- RICREST Protocol
- Real-Time Streams
- Adding REST Endpoints
- Built-in REST Endpoints
- File Download (OKTO)
- OTA Update Flow
Devices & Buses
- DeviceManager
- Device Manager REST API
- Device Factory & Classes
- Device Type Records
- Adding an I2C Device Type
- Device Data Publishing
- Data Logger
- I2C Bus
- I2C Device Scanning
- I2C ID & Polling
- MotorControl Overview
- MotorControl Config
- MotorControl Commands
- Camera
ROS 2
Helpers
Reference