Skip to content

Instantly share code, notes, and snippets.

@inonote
Last active March 10, 2025 18:04
Show Gist options
  • Select an option

  • Save inonote/00251fed881a82c9df1e505eef1722bc to your computer and use it in GitHub Desktop.

Select an option

Save inonote/00251fed881a82c9df1e505eef1722bc to your computer and use it in GitHub Desktop.
UMIGURI LED Controller Protocol

UMIGURI LED Controller Protocol v1

Overview

This is a protocol to control a LED without dependence on a specific controller. UMIGURI uses it through WebSocket.

Terms in This Document

  • Client: software sending LED colors to the server, like UMIGURI.
  • Server: software receiving packets from the client and controlling the LED device directly.

Packet Format

Offset (bytes) Length (bytes) Name
0 1 Version
1 1 Command
2 1 Payload Length
3 n Payload

The Version field must be 0x01 in this version.

Command List

Command Number From Name Required Payload Length
0x10 Client SetLED 103
0x11 Client Initialize 0
0x19 Server Ready 0
0x12 Client Ping 4
0x1A Server Pong 6
0xD0 Client RequestServerInfo 0
0xD8 Server ReportServerInfo 44

The command number with the 4th bit standing indicates that it's sent from the server.

SetLED (0x10)

Set the LED colors.

Offset (bytes) Length (bytes) Description
0 1 Overall brightness
1 3 Color of the leftmost land (Slider)
4 3 Color of next land (Slider)
... ...
46 3 Color of the rightmost land (Slider)
49 3 Color of the leftmost border (Slider)
52 3 Color of next border (Slider)
... ...
91 3 Color of the rightmost border (Slider)
94 3 Color of the topmost (Air Strings)
97 3 Color of the middle (Air Strings)
100 3 Color of the bottommost (Air Strings)

Land is an area on a touch sensor. Border is a separator between lands.

Color format:

Offset (bytes) Length (bytes) Description
0 1 Red
1 1 Green
2 1 Blue

0x00 is darkest, 0xFF is brightest.

Initialize (0x11)

Initialize the server of controller. If it succeed initialization, it sends Ready packet to client.

Ready (0x19)

It's sent for notifying the client of initialized.

Ping (0x12)

Send ping to the server with a specified any value. If the server received the ping, it sends back Pong with the specified value.

Offset (bytes) Length (bytes) Description
0 4 Any value

Pong (0x1A)

It's sent from the server when it received Ping.

Offset (bytes) Length (bytes) Description
0 4 The any value sent from the client
4 2 Server Type (always { 0x51, 0xED })

RequestServerInfo (0xD0)

Request to report the server information.

ReportServerInfo (0xD8)

Response to request RequestServerInfo from the client.

Offset (bytes) Length (bytes) Description
0 16 Server name in ASCII string (null padding)
16 2 Major version of the server
18 2 Minor version of the server
20 2 Reserved (always 0x00)
22 16 Connected hardware name in ASCII string (null padding)
38 2 Major version of the connected hardware
40 2 Minor version of the connected hardware
42 2 Reserved (always 0x00)

If the Server name and the Connected hardware name is less than 16 bytes, you must fill the remaining bytes with null '\0'.

Example of Communication in UMIGURI

Client (UMIGURI) Server
Ping ->
<- Pong
Initialize ->
<- Ready
SetLED ->

UMIGURI continuously sends SetLED every 33 ms after initialized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment