Skip to content
Rob Dobson edited this page Feb 5, 2026 · 36 revisions

Raft

Raft is an opinionated framework for emebedded development. It picks up where the Arduino libraries stop and builds on the basic ideas of setup() and loop() operations to enable even the most complex applications to be built. Raft simplifies:

  • cooperative multi-tasking
  • configuration (using a smart, JSON-based configuration system)
  • networking (WiFi, BLE and serial networking just requires configuration)
  • communications (websockets, file transfer, MQTT, REST API, etc)
  • OTA update (a unified mechanism that runs over BLE, WiFi, serial, etc.)
  • web-server (a fast and capable web server supporting static files, REST API, websockets, etc)
  • I2C bus (handles device auto-detection, auto-identification, polling, failure recovery, etc)
  • modular design (main functinality is modular and has few interdependencies allowing apps to just integrate what they really need)

Raft builds on Arduino setup() and loop() for configuration and async operations

Connected applications (like IoT devices) need multi-tasking and modern development (especially for the web) has taught us that async (cooperative multi-tasking) is helpful to augment the preemptive multi-tasking that real-time operating systems (like FreeRTOS) provide. Async is often simpler and mode light-weight than RTOS because it can avoid explicit synchronisation and many embedded problems are easily described by state-machines which lend themselves well to async programming.

While Raft can (and does) use FreeRTOS in some areas (and code built with Raft can do so too), the simplest (and often best) option is to use the inherent async (co-operative multitasking) mechanism that is built into Raft. Furthermore, this mechanism uses the loop() function that will be familiar to all Arduino users.

Raft is opinionated

When 37 Signals launched the Ruby on Rails web framework they introduced Convention over Configuration (CoC). The idea is that many requirements are common to all apps - so why make the programmer work hard to add and configure functionality that almost every app needs.

Raft takes this concept to embedded programming and "powers-up" your app with things like hardware configuration, robust WiFi management, publish-subscribe message generation based on state change detection, BLE comms, Web Sockets, serial logging, REST APIs, Web Server, I2C bus management without you having to do any extra work. The way these things can be configured is quite flexible but I think the default conventions will please most programmers.

Impatient to get going?

If you are impatient to get going and want to use the ESP IDF then the RaftCLI Quick Start is for you!

If you are going to use the Arduino framework on PlatformIO then check out PlatformIO Arduino Quick Start

SysMods enable async programming and modularity

Raft applications are built using modules called SysMods which are managed by the Raft runtime.

The base functionality of the Raft framework is provided by a set of standard SysMods and developers can add their own to create the their app functionality.

Simple configuration is a key element of Raft apps

Another key aspect of the Raft framework is the way configuration is handled. Configuration is handled using a JSON document called the SysType and each SysMod has its own section in the SysType JSON document. The Raft runtime handles reading this document and provides functions to make it easy to configure a SysMod with pin definitions and any other configuration information that can be handled with JSON objects, arrays, strings, etc.

Raft has many other strong features including:

  • consistent and reliable communications over different interfaces - such as BLE, WiFi sockets & web-sockets
  • easy REST API support with the ability to use these APIs for effectively supporting remote-procedure-calls (RPC) over different interfaces including WiFi, BLE and serial
  • Web Server with static file serving, web-socket integration and REST API functionality
  • I2C bus with polling, automatic device health detection and stuck-bus handling which makes hot-swapping I2C devices possible

Raft builds on many well known technologies like JSON, REST, MQTT, WebServer, REST and I2C and currently supports ESP32, ESP32S3 and ESP32C3

Raft Concepts

Raft SysManager

Raft SysMods

Raft Core Helper Classes

Raft Core API

Raft Configuration Details

Clone this wiki locally