Reverse Engineering of LEGO Mario, Luigi, and Peach
LEGO Mario is a BLE device which supports LEGO Wireless Protocol. It has six input/output devices as follows:
0x47
Accelerometer, Gesture?0x49
Color Barcode, RGB Color0x4a
Pants0x46
Events, Debug, and something0x55
???0x14
VoltageEach color barcode is drawn with five out of nine (eight?) colors. The first two lines are always green and red as header part. The other three lines are data part. The data value can be from 0x01
to 0xd2
. That means there are 0xd2
= 210
(= 7 * 6 * 5
) patterns.
0x02
. is 0xb8
.Each pants has a unique 6 bit code. The pants sensor at the bottom of LEGO Mario can detect it physically.
100001
= 0x21
.Example: 97 03 00 43 03 ff ff 00
0x43
LEGO System - Mario0x44
LEGO System - Luigi0x45
LEGO System - Peach0x03
Supports Central Role, Supports Peripheral Role0x03
FW Version: 5.0.00.00000x12
Volume: 0 - 100Port ID | IO Type | Capabilities | Input Modes | Output Modes | Possible Mode Combination |
---|---|---|---|---|---|
0 | 0x47 | Logical Combinable, Input | 0, 1 | - | [0, 1] |
1 | 0x49 | Logical Combinable, Input | 0, 1 | - | [0, 1] |
2 | 0x4a | Input | 0 | - | - |
3 | 0x46 | Input | 0, 1, 2, 3 | - | - |
4 | 0x55 | Input, Output | 0, 1 | 0, 1 | - |
Port ID | Mode | Name | RAW Range | PCT Range | SI Range | Symbol | Mapping | Value Format |
---|---|---|---|---|---|---|---|---|
0 | 0 | RAW | 0 - 100 | 0 - 100 | 0 - 100 | cnt | Supports NULL, Discrete | 3 * 8 bit |
1 | GEST | 0 - 10 | 0 - 100 | 0 - 10 | raw | Supports NULL, Discrete | 2 * 16 bit | |
1 | 0 | TAG | 0 - 10 | 0 - 100 | 0 - 10 | idx | Supports NULL, Discrete | 2 * 16 bit |
1 | RGB | 0 - 10 | 0 - 100 | 0 - 10 | raw | Supports NULL, Discrete | 3 * 8 bit | |
2 | 0 | PANT | 0 - 63 | 0 - 100 | 0 - 63 | idx | Supports NULL, Discrete | 1 * 8 bit |
3 | 0 | CHAL | 0 - 65535 | 0 - 100 | 0 - 65535 | na | Supports NULL, Discrete | 2 * 16 bit |
1 | VERS | 0 - 255 | 0 - 100 | 0 - 255 | na | Supports NULL, Discrete | 4 * 32 bit | |
2 | EVENTS | 0 - 65535 | 0 - 100 | 0 - 65535 | na | Supports NULL, Discrete | 2 * 16 bit | |
3 | DEBUG | 0 - 65535 | 0 - 100 | 0 - 65535 | na | Supports NULL, Discrete | 4 * 32 bit | |
4 | 0 | FS Code | 0 - 65535 | 0 - 100 | 0 - 65535 | na | Supports NULL, Discrete | 1 * 16 bit |
1 | Events | 0 - 65535 | 0 - 100 | 0 - 65535 | na | Supports NULL, Discrete | 2 * 16 bit |