Flash Force Wiki Interactive browser →
Wiki / Protocols
#protocol#vll#reference

VLL — Visible Light Link

VLL (Visible Light Link) is LEGO's protocol for sending commands as plain on/off light pulses. A light sensor on the brick measures brightness; the sender flashes light with precise timing to encode bits. Shared by Micro Scout, Code Pilot and Scout, which all decode the same codes.

The communication protocol was covered by a LEGO patent application — period LEGO license text notes it as "protected by a pending patent application."

Frame

One command = 10 bits = 3-bit checksum + 7-bit data, wrapped in init/start/stop:

  1. Init / preamble — light ON ≈ 400 ms (some impls use 1000 ms, see Implementations below) before anything.
  2. Start — OFF 20 ms.
  3. Checksum — 3 bits, MSB first (see Checksum below).
  4. Data — 7 bits, MSB first.
  5. Stop — ON 20 ms, OFF 60 ms, ON 120 ms (some impls: just ON 20 / OFF 60).

The frame transmits [checksum:3 bits][data:7 bits], both MSB first.

Bit encoding (unit = 20 ms)

BitLight ONLight OFF
040 ms (2 units)20 ms (1 unit)
120 ms (1 unit)40 ms (2 units)

Total per bit = 60 ms either way (only the ON/OFF ratio differs).

Checksum

A 3-bit checksum is prepended (MSB first) to each 7-bit data value:

function checksum(n) {        // n = 7-bit data value
  return 7 - ((n + (n >> 2) + (n >> 4)) & 7);
}

Verified against all 27 commands in rcxvll.nqh (pbrick) and used verbatim by Flash Force, lego-blockly and elecbrick (Doug Eaton).

Commanddata nchecksum
Motor forward07
Motor reverse16
Beep 142
Beep 585
Run program334
Delete program343

Opcode table

The 7-bit data values the Micro Scout recognises (shared codebase with Code Pilot / Scout). Decoded from rcxvll.nqh (pbrick) and cross-checked with elecbrick (Doug Eaton) / Flash Force, and validated against the official Scout SDK "VLL Command Set" table (Nov 1999, pp. 66–68) and the printable MicroScout VLL barcode card.

Direct commands (execute immediately)

CodeBinaryAction
00000000Motor forward
10000001Motor reverse
100001010Stop motors (see note)
40000100Beep 1
50000101Beep 2
60000110Beep 3
70000111Beep 4
80001000Beep 5
330100001Run stored program
340100010Delete stored program
701000110"Next" (official spec; no effect on device)
711000111Reset (official spec; no effect on device)

Script commands (16–32, stored into a program; up to 15 steps)

CodeActionCodeAction
16Motor fwd 0.5 s24Beep 1
17Motor fwd 1 s25Beep 2
18Motor fwd 2 s26Beep 3
19Motor fwd 5 s27Beep 4
20Motor rev 0.5 s28Beep 5
21Motor rev 1 s29Wait for light
22Motor rev 2 s30Seek light
23Motor rev 5 s31Code (talk to another brick)
32Keep alive

Build a program = Delete (34) → send script steps 16–32 → Run (33).

Notes / gaps

Implementations

Four independent implementations agree on the core protocol:

SourceChecksumbit0/bit1PreambleEmitter
Flash Force40/20 · 20/40400 msphone torch
rcxvll.nqh (pbrick)same400 msLEGO 9V light brick on RCX
lego-blocklysame1000 msLED on FTDI DTR
elecbrick (Doug Eaton)sameopcode generator

The protocol is identical everywhere; the tunable parts are preamble length and stop-bit tail (reliability knobs).

Practical

See also