DEVLRBETA
For developers

Rotator Bluetooth protocol

The Bluetooth LE protocol Devlr speaks to the rotator's firmware (firmware 9). Published for anyone building their own client or hardware that speaks it. The protocol is public; the rotator's firmware is not open source.

The rotator is still in development. This protocol is pre-release and may change without notice — don't build a hard dependency on it yet.

How it works

The client uploads the whole recipe (up to 8 steps) and starts it. The rotator keeps a copy (up to 32 recipes, favourites pinned, the rest replaced by least recent use) so it can also run it from its own panel. From then on the rotator is the source of truth: it times every step, stops the motor at the end of each one and waits for the next chemical to be poured. The client follows the state it reports. The rotator may also have its own control panel, so the run can change without the client asking (paused, reset, started at another step) — always follow the reported state rather than assuming it.

On connecting

A client should do this, in order:

  1. Find the device by the Service UUID, connect, and start notifications on Events, Progress and Status.
  2. Send HELLO and unlock the link (see Pairing). ERR:UNKNOWN: the device has no pairing, carry on.
  3. Send VERSION (reply FW:<n>) and check the firmware supports what you use. Devlr needs 9 or later.
  4. Send TIME:<unix>: the rotator has no clock, and rolls from this power-on that had no time get their real start from it.
  5. Read a Progress notification before assuming the rotator is idle: a run may already be going on, started from the panel.
  6. Optional: LIST to see which recipes are stored (with the hash you sent, so you can skip uploading one that is already up to date).
  7. Optional: LOG to collect the rolls developed since the last sync. Save them, then send LOG_ACK:<seq> with the last seq you stored, so they are not sent again. If you never acknowledge, the rotator keeps the last 40.

Then upload a recipe and run it (see Commands and the minimal client below). Send one command at a time and wait for its reply, here too.

Pairing (PIN)

From protocol level 11 (the Devlr Timer since firmware 2 and the DEVLR Rotator since firmware 11, November 2026) every connection starts locked: only the four commands below are answered, anything else gets ERR:AUTH, and no status, progress or events are sent. The PIN is part of this protocol, not the phone's Bluetooth pairing, so it works the same in every browser. It stops anyone in range from driving the device; the link itself is not encrypted.

  1. HELLO → OK:HELLO:<tid>:<proto>:<nonce>. tid: the device's id (8 hex). nonce: 12 hex, new for every HELLO.
  2. With a key kept for that tid: AUTH:<tag> → OK:AUTH. The tag is base64url (no padding) of the first 9 bytes of HMAC-SHA256(key, "<tid>:<nonce>"): 12 characters. Each nonce works once (ERR:STATE = no HELLO before it). ERR:AUTH: the device no longer knows the key (the pairings were cleared on the device): delete it and pair again. The third wrong AUTH drops the connection.
  3. Without a key: PAIR → OK:PAIR, and the device shows P 123456 on its display (for up to 2 minutes). ERR:CLOSED: new pairings are only accepted in a short window. DEVLR Rotator: the first 30 s after it is plugged in, or 30 s after holding MODE for 2 s on its recipe screen (it shows PAir); without its panel there is nowhere to show a PIN, so it always answers ERR:CLOSED. Devlr Timer: the first 30 s after entering film mode. A locked link sends no status, so when ERR:CLOSED arrives an app doesn't yet know which device it is talking to.
  4. PIN:<6 digits> → OK:KEY:<key>: 16 bytes in base64url (22 characters). Keep it with the tid; the link is now unlocked. ERR:PIN: wrong. ERR:PINRESET: the third wrong PIN, the display now shows a new one. ERR:STATE: no PIN on the display.

A device keeps 4 keys; a new pairing with all 4 taken replaces the one used longest ago. Clearing them all: on the DEVLR Rotator hold RESET for 3 s on the recipe screen and confirm with START; on the Devlr Timer, the bLE item in its setup. Test vector: key BQYHCAkKCwwNDg8QERITFA, tid 18aabbcc, nonce 15161718191a → tag N9oKsvj_8p2I.

Service & characteristics

NameUUIDAccess
Service1f9acdab-bed6-4bf6-b977-c76dfc017962—
Command0e3dcb11-2dc6-464d-b24e-c51a5f649cbfwrite (UTF-8 text, ≤ 20 bytes)
Status6a519880-6c8b-4aca-8adb-89d349dcb9e5notify, JSON, 10 Hz
Progress885d7e11-51fe-4d2a-962f-bb468204a539notify, JSON, 2 Hz
Events37a01203-11a3-4087-8fa4-3b9a698e15cenotify, text

The app scans by filtering on the Service UUID, so compatible firmware must advertise it.

Commands

Write UTF-8 text to Command, one command per write (at most 20 bytes, so no MTU negotiation is needed). Every command gets one reply on Events: OK:… or ERR:<reason>. Send one command at a time and wait for its reply — the firmware only holds one pending command and drops a second one that arrives too soon.

CommandWhenEffect
RECIPE_BEGIN:<n>any timeStart uploading a recipe of n steps (1–8).
STEP:<i>:<s>:<rpm>:<half>after RECIPE_BEGINStep i (0-based, any order): s = seconds (1–99999), rpm = target speed (0–100, 0 = timer only, no rotation), half = seconds per direction (0–600, 0 = no reversals). Re-sending an index replaces it.
NAME:<i>:<text>during uploadOptional step name for the panel, up to 4 characters (7-segment: K and X show as H, V as U, M as a single n-shape, W takes two digits).
RNAME:<offset>:<chunk>during uploadOptional recipe name (up to 32 characters, ASCII), in chunks so each command stays within 20 bytes. A chunk may contain ":".
RID:<id>:<fav>during uploadOptional: 8 lowercase hex digits identifying the recipe (Devlr uses the CRC-32 of its recipe id); fav 1 = pinned. With an id the rotator stores the recipe at RECIPE_END.
RHASH:<hash>during uploadOptional: 8 hex digits, a content hash of your choosing. LIST reports it back so you can tell whether a stored copy is up to date.
ADJ:<i>:<s>during uploadDuration of step i for this run only. The stored copy keeps the STEP time. Not used on temperature-compensated steps.
TCMP:<i>:<s>:<t>during uploadTemperature compensation of development step i: its own time s (before the rotator %) at temperature t (°C × 10). Stored.
TCMP2:<t>:<s>during uploadOptional second anchor of the recipe (°C × 10, seconds), to fit K. Stored.
ROT:<pct>during uploadThe recipe's rotator compensation % (already included in the STEP times). Stored.
TEMP:<t> / DEVP:<pct> / SROT:<pct>during uploadThis run's temperature (°C × 10), push/pull % and rotator %. Compensated steps are computed from them, and the panel can change temperature and push/pull.
RECIPE_ENDafter the stepsAccepted only once every step has arrived. Stores the recipe if it has an id (may send EVICT:<id> first) and selects it on the panel. Without RUN (Devlr's "Send to rotator"), the next time it is picked on the panel it uses this upload's ADJ / TEMP / DEVP / SROT, once.
RUN[:<i>]no run activeStart the uploaded recipe at step i (default 0). That step's chemical is assumed to be in the tank already.
NEXTWAITING_POURNext chemical poured: start the next step. Its time counts from here.
SKIPRUN / INVERT / PAUSEDEnd the current step early.
PAUSERUN / INVERTStop the motor and freeze the step clock.
RESUMEPAUSEDContinue the step where it stopped.
STOPany timeStop everything and go back to IDLE. The recipe stays loaded.
LISTany timeOne REC:<id>:<hash>:<fav> event per stored recipe (pinned first, then most recently started), then OK:LIST:<count>.
DEL:<id>any timeRemoves a stored recipe (ERR:NOT_FOUND if there is none).
CFGany timeOne CFG:<key>:<value> event per setting (rpm, half, mtime, mrpm, bright, fspwm, kp, ki, kd, name), then OK:CFG:<count>.
SET:<key>:<value>any timeChanges a setting, kept on the rotator: rpm 0–100 (default for recipes), half 0–600 s, mtime 1–99999 s and mrpm 0 or 10–66 (manual control), bright 0–7 (panel), fspwm 50–255 (failsafe PWM), kp/ki/kd 0–10000 (PID × 1000), name up to 11 characters (after RESTART).
CFG_RESETany timeEvery setting back to its default.
RESTARTidleRestarts the rotator (ERR:BUSY while a program is active).
TIME:<unix>on connectingThe client's clock in Unix seconds (the rotator has none). Rolls of the current power-on that had no time get their real start.
LOGany timeOne LOG:<seq>:<rid>:<epoch>:<boot>:<upSec>:<durSec>:<temp×10>:<devp>:<rotp>:<steps>:<done>:<first>:<flags> event per roll not yet confirmed (oldest first; epoch 0 = unknown; flags 1 = finished, 2 = started by RUN, 4 = failsafe), then OK:LOG:<count>:<boot>. One entry per roll of a stored recipe, written when it ends; the last 40 are kept.
LOG_ACK:<seq>after LOGEvery roll up to seq is synced: they are not sent again.
VERSIONany timeReplies FW:<n>.
HELLO / PAIR / PIN:<pin> / AUTH:<tag>locked linkPairing, protocol level 11: see Pairing (PIN).

Errors: ERR:FORMAT, ERR:RANGE, ERR:STATE (not allowed in the current state), ERR:INCOMPLETE, ERR:NO_RECIPE, ERR:BUSY (a run is active — STOP first), ERR:UNKNOWN.

The step times Devlr sends are not the recipe's raw times. For development steps it applies the temperature compensation, the user's Dev% and a rotator compensation — a time deduction, since continuous motorized agitation is treated as more effective than manual inversion. The rotator compensation defaults to −15% but is user-adjustable per session (and optionally per recipe), so a third-party client replicating Devlr's timing should expose it as a setting rather than hardcoding −15%. The firmware itself knows no chemistry: for temperature-compensated steps it applies Devlr's model with the data you send — t = round(raw · e^(−K·(T − T₀))), K fitted from the two anchors when it falls in [0.06, 0.13], otherwise 0.09 — then round(t · (1 + push/pull %) · (1 + rotator %)).

States

IDLE ──RUN──► RUN ⇄ INVERT ──end of step──► WAITING_POUR ──NEXT──► RUN …
                │   ▲                          └─ last step ──► DONE
           PAUSE│   │RESUME
                ▼   │
               PAUSED
any state ──STOP──► IDLE
  • INVERT — the short stop (200 ms) between directions.
  • WAITING_POUR — motor stopped, waiting for the next chemical. It waits there, even if the client disconnects.
  • PAUSED — motor stopped, step clock frozen.
  • READY — a recipe was picked on the rotator's panel; nothing started yet. RUN is accepted.

Progress notifications

{
  "state": "IDLE" | "READY" | "RUN" | "INVERT" | "PAUSED" | "WAITING_POUR" | "DONE",
  "step": 1,            // current step, 0-based (WAITING_POUR: the step that just ended)
  "steps": 3,
  "stepRemaining": 28,  // seconds left in the focused step, rounded up
  "totalRemaining": 358,
  "next": 1,            // step NEXT will start (= step outside WAITING_POUR)
  "stepTime": 60,       // effective duration of "next", in seconds
  "rid": "86b12f78",    // id of the loaded recipe ("manual" = the panel's manual control, "" = no id)
  "temp": 205,          // this run's temperature, °C × 10 (0 = no temperature compensation)
  "devp": 0,            // this run's push/pull %
  "run": 12             // roll-log number of the roll in progress (or the last one); 0 = none
}

Show stepRemaining and stepTime rather than the times you uploaded: the rotator's panel can change the time of a step (temporarily — the uploaded recipe never changes) and pick which step comes next.

Status notifications

{"fw":11,"proto":11,"panel":1,"failsafe":0,"targetRPM":35,"currentRPM":35.2,
 "currentPWM":150,"direction":"FORWARD" | "REVERSE" | "STOP"}

fw is the firmware version (Devlr needs 9 or later). proto (from firmware 11) is the protocol level; without it, the level is fw. failsafe is 1 when the rotation sensor stopped giving readings: the motor keeps turning open-loop at roughly the target speed, so the run carries on. panel is 1 when a control panel is attached. The other fields are motor diagnostics. The run itself (state, step, times) is only in the progress notifications.

The DEVLR Timer (film mode) sends a shorter status with no motor fields, e.g. {"fw":3,"hw":3,"dev":"timer","proto":11,"panel":1}. dev is "timer" (without dev the device is a Rotator), and hw (from timer firmware 3) is its hardware revision; older timers send none.

Events

  • STEP_START:i, STEP_END:i, DONE — the run. A step can start without the client asking, and not necessarily in order.
  • PAUSED:i, RESUMED:i — from the commands or the panel.
  • ILFORD_WASH:i — the wash i was ended early from the panel (hold ▶ for 1 s in a running wash of a recipe that has a developer step); STEP_END:i follows at once. The roll log gets flag 8.
  • RESET_STEP:i (step i back to its start, paused), RESET_ALL (back to IDLE), READY — panel actions.
  • EVICT:id — the store was full: that recipe was removed to make room.
  • REC:id:hash:fav — one per stored recipe, in reply to LIST.
  • FAILSAFE_ON, FAILSAFE_OFF — rotation sensor lost / back.

Behavior on connection drop

Nothing on the rotator depends on the connection. A step in progress runs to its end, the motor stops, and the rotator waits in WAITING_POUR for the next chemical — it never starts a step on its own. A client that reconnects should read the progress and pick up from there instead of assuming the run stopped.

Minimal client (Web Bluetooth)

const SERVICE  = '1f9acdab-bed6-4bf6-b977-c76dfc017962';
const COMMAND  = '0e3dcb11-2dc6-464d-b24e-c51a5f649cbf';
const PROGRESS = '885d7e11-51fe-4d2a-962f-bb468204a539';
const EVENTS   = '37a01203-11a3-4087-8fa4-3b9a698e15ce';

const device = await navigator.bluetooth.requestDevice({ filters: [{ services: [SERVICE] }] });
const service = await (await device.gatt!.connect()).getPrimaryService(SERVICE);
const command = await service.getCharacteristic(COMMAND);
const events = await service.getCharacteristic(EVENTS);
const progress = await service.getCharacteristic(PROGRESS);
const text = (e: Event) => new TextDecoder().decode((e.target as BluetoothRemoteGATTCharacteristic).value!);

// Replies (OK:/ERR:/FW:) answer the last command; everything else is a spontaneous event
let waiting: ((reply: string) => void) | null = null;
events.addEventListener('characteristicvaluechanged', e => {
  const msg = text(e);
  if (waiting && /^(OK|ERR|FW):/.test(msg)) { waiting(msg); waiting = null; }
  else console.log('event', msg);          // STEP_START:0, STEP_END:0, PAUSED:0, DONE, ...
});
await events.startNotifications();

progress.addEventListener('characteristicvaluechanged', e => console.log(JSON.parse(text(e))));
await progress.startNotifications();

// One command at a time: wait for the reply before sending the next one
async function send(cmd: string) {
  const reply = new Promise<string>(resolve => (waiting = resolve));
  await command.writeValueWithResponse(new TextEncoder().encode(cmd));
  const r = await reply;
  if (r.startsWith('ERR:')) throw new Error(`${cmd} -> ${r}`);
  return r;
}

// Pairing (protocol level 11): unlock the link first. Keep the key per tid (localStorage, a file...).
const b64 = (u: Uint8Array) => btoa(String.fromCharCode(...u)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
const unb64 = (t: string) => Uint8Array.from(atob(t.replace(/-/g, '+').replace(/_/g, '/') + '=='.slice(0, (4 - t.length % 4) % 4)), c => c.charCodeAt(0));
const hello = await send('HELLO').catch(() => null);   // ERR:UNKNOWN: a device without pairing
if (hello) {
  const [, , tid, , nonce] = hello.split(':');
  let key = localStorage.getItem(`devlr-key-${tid}`);
  if (key) {
    const k = await crypto.subtle.importKey('raw', unb64(key), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
    const mac = new Uint8Array(await crypto.subtle.sign('HMAC', k, new TextEncoder().encode(`${tid}:${nonce}`)));
    await send(`AUTH:${b64(mac.slice(0, 9))}`);      // ERR:AUTH: the device forgot this key, pair again
  } else {
    await send('PAIR');                                // ERR:CLOSED: outside the pairing window
    key = (await send(`PIN:${prompt('PIN on the display')}`)).slice('OK:KEY:'.length);
    localStorage.setItem(`devlr-key-${tid}`, key);
  }
}

// Developer 6:30 at 35 RPM, stop 1:00, fixer 5:00 — 10 s per direction
await send('RECIPE_BEGIN:3');
await send('STEP:0:390:35:10');
await send('STEP:1:60:35:10');
await send('STEP:2:300:35:10');
await send('RECIPE_END');
await send('RUN');        // developer already poured: step 0 starts now
// ... on STEP_END:0 ask the user to pour the stop bath, then:
await send('NEXT');

Illustrative and trimmed for readability (no timeouts or reconnection). Verify against the protocol description above before relying on it.

Para a tua câmara escura