DOCUMENTACIÓN TÉCNICA W4RP

DEEP DIVE

Arquitectura de hardware, APIs de firmware, pipeline CAN, bridges nativos y despliegue OTA

FLUJO DE DATOS

SOFTWAREW4RP App / Website
BRIDGESwift / Kotlin / Web BLE
FIRMWAREW4RPBLE
HARDWAREEdge / Core Module

1. ARQUITECTURA DE HARDWARE

Módulos Edge, Core & Diseño de Expansión

El hardware W4RP sigue una arquitectura modular y apilable. El sistema separa computación (PCB Core) de capacidad (PCB Expansión), permitiendo a fabricantes crear dispositivos especializados reutilizando el mismo stack de comunicación.

LOS TRABAJADORES

Módulos Edge

Un Módulo Edge es un "sándwich" de dos PCBs. El PCB Core contiene el microcontrolador, transceptor CAN y regulador. El PCB Expansión define la capacidad del módulo.

  • MCU ESP32-C3 o ESP32-S3
  • Transceptor TWAI (CAN)
  • Regulador 12V/24V a 3.3V
  • Antena BLE integrada
LOS ORQUESTADORES

Módulos Core

Los Módulos Core coordinan configuraciones multi-Edge. Tienen controladores TWAI duales: uno para el bus CAN del vehículo, otro para una red privada de Edges. Sin slot de expansión—solo orquestación.

  • ESP32-C6 o ESP32-P4
  • Controladores TWAI duales
  • CAN vehículo + Red privada
  • Gateway BLE al teléfono

ESTRUCTURA DEL MÓDULO

An Edge Module is a "sandwich" of two PCBs connected via header pins. The Core PCB provides computing power, CAN interface, and BLE connectivity. The Expansion PCB defines the module's physical capabilities.

CAPABILITY BOARDRelay / MOSFET / Sensor / PWM
HEADER CONNECTOR
ESP32-C3/S3 + TWAIMCU • CAN • BLE • Vreg

MODOS DE OPERACIÓN

En modo Standalone, un Edge se conecta directamente al bus CAN del vehículo y comunica con el teléfono via BLE.

PUENTETELÉFONO
EDGE
VEHÍCULOCAN BUS
MODO INDEPENDIENTE

En modo Esclavo, un Módulo Core lee el CAN del vehículo y transmite a múltiples Edges en red privada.

PUENTETELÉFONO
CORE
VEHÍCULOCAN BUS
EDGE 1
EDGE 2
EDGE 3
MODO ESCLAVO
Expansion TypeFunctionTypical Use
RelayHigh-current ON/OFFLights, pumps, solenoids
MOSFETPWM switchingFans, LEDs, servos
SensorAnalog/Digital inputTemperature, pressure, O2
PWM BankMulti-channel outputRGB strips, motors

2. FIRMWARE & W4RPBLE

El Motor de Tiempo Real

W4RPBLE es una librería Arduino/ESP-IDF que abstrae CAN, BLE y el Motor de Reglas en una API simple. Maneja restricciones de tiempo, gestión de buffers y matching O(1) de señales.

exhaust_valve.ino
CPP
#include <W4RPBLE.h>
W4RPBLE w4rp;

void setup() {
    w4rp.setBleName("Module Name");
    w4rp.setModuleHardware("Module HW ID");
    w4rp.setModuleFirmware("Module FW Version");
    w4rp.setPins(21, 20, 8); // RX, TX, LED
    w4rp.begin();
    
    [ Capability Registration ]
    w4rp.registerCapability("capability_name", [](const ParamMap &params) {
      [ Capability logic ]
    });
}

void loop() {
    w4rp.loop();
}

Configuration API

MethodDescriptionRequired
setBleName(name)Advertised BLE nameYes
setModuleHardware(hw)Hardware identifierYes
setModuleFirmware(ver)Firmware versionYes
setModuleSerial(sn)Unique serial numberYes
setPins(rx, tx, led)GPIO configurationYes
begin()Initialize all systemsYes

3. PIPELINE DBC & OPENDBC

De Tramas CAN Crudas a Señales Semánticas

Las tramas CAN crudas no tienen significado sin contexto. El pipeline DBC las transforma en señales semánticas como Engine_RPM y Vehicle_Speed que los usuarios pueden entender y usar en automatización.

1
Fetch
2
Parse
3
Store
4
Enrich
5
Embed
AI ProviderUse Case
GROQFast signal interpretation
OpenAIComplex flow generation
AnthropicNuanced descriptions
GoogleDefault provider
CustomBYOK in Settings

4. EL BRIDGE NATIVO

Comunicación Multi-Plataforma en Tiempo Real

JavaScript es single-threaded con pausas de garbage collection—inadecuado para streams BLE en tiempo real. El Bridge Nativo descarga operaciones críticas a Swift (iOS) y Kotlin (Android).

iOS

CoreBluetooth via W4RPBLEManager.swift

  • Background modes
  • State restoration

Android

BluetoothGatt via W4RPBLEManager.kt

  • Foreground service
  • Connection priority

Web

Web Bluetooth API

  • Chrome only
  • No background

BLE Protocol Commands

CommandDescription
GET:PROFILERequest module info (name, serial, firmware)
SET:RULES:RAM:<json>Load rules to volatile memory
SET:RULES:NVS:<crc>:<json>Persist rules to flash with CRC
DEBUG:STARTBegin streaming raw signals
DEBUG:STOPStop signal streaming
OTA:BEGIN:<size>:<crc>Initiate firmware update
OTA:DATA:<chunk>Send 512-byte chunk
OTA:ENDComplete update, reboot

5. SOFTWARE & UI DE REGLAS

Constructor de Automatización Visual

La capa de software provee la interfaz de usuario y backend cloud. Los usuarios construyen flujos de automatización visualmente, y la app los serializa a rulesets JSON que el firmware entiende.

LayerTechnology
UI FrameworkReact Native (Expo), Next.js
LanguageTypeScript (strict mode)
StateZustand (global), TanStack Query (async)
Flow Editor@xyflow/react
BackendSupabase (Postgres, Auth, Edge Functions)
PaymentsStripe, MercadoPago
ruleset.json
JSON
{
  "nodes": [
    { "id": "n1", "type": "condition", "signal": "engine_rpm", "op": ">", "value": 4000 },
    { "id": "n2", "type": "action", "capability": "exhaust_flap", "params": { "amount": 100 } }
  ],
  "flows": [
    { "id": "f1", "from": "n1", "to": "n2", "debounce": 500 }
  ],
  "meta": { "name": "Sport Mode", "persist": true }
}

6. MÓDULOS & USUARIOS

Propiedad, Compartir & Seguridad

W4RP implementa un sistema de propiedad de módulos que previene acceso no autorizado mientras permite compartir controlado entre usuarios.

StateDescription
freeUnclaimed. First user to connect can claim.
owned_by_meI am the primary owner. Full control.
shared_accessI have shared access from another user.
lockedOwned by someone else. Cannot interact.

MATRIZ DE PERMISOS

ActionOwnerShared
Read module info
Send commands
Update rules
Flash firmware
Factory reset
Generate share codes

7. OTA & DESPLIEGUE

Actualizaciones Delta & Opciones de Hosting

BLE transfiere a ~4KB/s. Un firmware de 1.5MB toma 6+ minutos. Nuestro sistema OTA usa actualizaciones delta (Janpatch) para reducir esto a segundos.

ACTUALIZACIONES DELTA (JANPATCH)

Full Binary:
v1.0 (1.5MB) → v1.1 (1.5MB)
~6 minutes over BLE
Delta Patch:
v1.0 → Patch (50KB) → v1.1
~12 seconds over BLE
PartitionAddressSizePurpose
nvs0x900016KBRules storage
otadata0xd0008KBBoot flags
app00x100001MBSlot A (active)
app10x1100001MBSlot B (update)

DESPLIEGUE OTA

Self-Hosted (Full)

Self-hosted firmware file + Self-hosted update platform

  • Full control
  • Manual patch generation
  • Your infrastructure

Hybrid

Self-hosted firmware file + W4RP Platform

  • Your storage
  • W4RP distribution
  • Easy setup

W4RP Managed

W4RP hosted firmware file + W4RP Platform

  • Zero maintenance
  • Auto patching
  • Analytics

¿LISTO PARA CONSTRUIR?

OPEN SOURCE HARDWARE • MIT LICENSE