1. Connect and wake
Scan for an LM- advertisement, select that device, and discover its services. Connect through your BLE library; the car does not need a Wi-Fi connection for normal control. A name alone is not unique device identity.
| Purpose | UUID |
|---|---|
| API service | 00010001-574f-4f20-5370-6865726f2121 |
| API writes and notifications | 00010002-574f-4f20-5370-6865726f2121 |
Anti-DoS handshake, under service 00020001… | 00020005-574f-4f20-5370-6865726f2121 |
| Debug shell; not the API channel | 00010003-574f-4f20-5370-6865726f2121 |
- Write the exact UTF-8 bytes
usetheforce...bandto the anti-DoS characteristic, without a terminator. This is a protocol constant. - Enable notifications on
00010002…. Use that same characteristic for API writes. Select write-with/without-response from its advertised properties. - Send wake
13/0D, empty payload. Allow several seconds for startup.11/0Fis the startup event; a fresh successful version query11/00after wake also demonstrates API responsiveness. - Before driving, send
17/0B [01]to enable user drive. Match its response. Keep optional sensor setup separate from this basic path.
The original apps use untargeted wake; Red Thunder currently targets processor 11 for wake/system/power queries. The example uses the original untargeted route. A DFU-only profile needs wake/recovery assessment, not ordinary drive packets. Do not send DFU opcode 30 as a handshake.
2. Packets and responses
Command notation is hexadecimal device/command. BE16 is a big-endian 16-bit integer. Untargeted packets have this layout:
8D | flags | device | command | sequence | payload… | checksum | D8
checksum = (~sum(flags through payload)) & 0xFF
Escape body/checksum: 8D → AB 05, D8 → AB 50, AB → AB 23
Use flags 0A for ordinary requests and 08 for drive updates. Both reset inactivity; only 0A requests an ordinary success reply. Allocate sequences 00..FE; reserve FF for asynchronous events.
If flag 10 is set, insert target after flags; flag 20 adds source after target (or flags if no target). These fields count toward the checksum. For example, adding target 11 to a 0A request makes flags 1A. Do not add a target byte to an untargeted command.
Reassemble the notification stream, unescape and validate checksum before parsing. A notification may split one packet or contain several. The decoded sum including checksum must be FF.
Ordinary replies have response flag 01 and payload status + data. Match device, command, sequence and applicable routing; status 00 means success. Events have command-specific raw payloads: do not strip their first byte as a status code.
Headlights full, sequence 01:
8D 0A 1A 13 01 FF C8 D8
Example success reply to that request:
8D 01 1A 13 01 00 D0 D8
Play profile 0069, sequence 42:
8D 0A 17 05 42 00 69 2E D8
A BLE write callback confirms transport, not physical output. Keep a bounded request queue and discard stale responses after reconnect. The small example keeps one ordinary request outstanding and every outgoing frame under 20 bytes; larger commands need a separate paced fragmentation implementation.
3. Driving and stopping
Use untargeted 16/02, flags 08, with two big-endian IEEE-754 float32 values: steering first, speed second. This is Ackermann steering, not a compass heading or Sphero’s generic roll command.
payload = struct.pack(">ff", steering, speed)
steering 0.5, speed -0.25:
3F 00 00 00 BE 80 00 00
Straight stop, sequence 00:
8D 08 16 02 00 00 00 00 00 00 00 00 00 DF D8
Red Thunder passes normalized steering −1..1 and signed throttle −1..1 directly to these floats. Zero steering is straight; positive/negative throttle requests forward/reverse. The original native builder clamps its steering parameter to ±15, so do not assume generic Sphero angle units or scale normalized input to 360 degrees.
Our app sends the latest input immediately, then at about 15 Hz. Keep only the latest drive state rather than building a backlog. Missing success replies are expected with flags 08; any error reply still matters.
On release, cancellation or focus loss, send both floats as zero. Stop the send loop and clear its inputs on disconnect; never replay the old throttle after reconnect. A stop packet cannot cross a dead connection, and a reliable motor watchdog timeout has not been established here.
4. Lights, audio and animations
These requests use flags 0A, no target, and matching success replies.
| Action | Command | Payload |
|---|---|---|
| User drive | 17/0B | 01 enable, 00 disable |
| Idle animation/chatter | 17/0A | 01 enable, 00 disable |
| Headlights / taillights | 1A/13 / 1A/14 | One brightness byte, 00..FF |
| Read volume | 1A/09 | Empty; successful reply data is one byte |
| Set volume | 1A/08 | One byte, 00..FF; read back with 1A/09 |
| Play coordinated profile | 17/05 | BE16 installed profile ID |
| Play sound only | 1A/07 | BE16 logical FILE start block + mode byte; example uses mode 00 |
| Stop audio | 1A/0A | Empty |
Use a profile for coordinated movement and speech. Reference English IDs include 0069 (“Ka-chow”), 005E (“I am speed”) and 0130 (engine rev). IDs depend on installed animation content; they are not audio addresses. For sound-only playback, get a verified FILE start from the selected audio image.
Disabling idle/chatter is not a global mute; stop-audio does not promise to halt mouth/body motion. A new profile interrupts the current profile. Generic “stop animation” 17/2B is unsupported on the inspected McQueen path. Direct eyes/mouth/suspension requests need richer payloads than one byte; they are outside this tested control set.
5. Optional sensor events
Add these after basic control works. They are not prerequisites for lights or a profile. Targets below describe Red Thunder’s current routes.
| Feature | Setup request | Event / result |
|---|---|---|
| Battery | 13/04 reads state; 13/05 [01] enables changes. Target 11. | 13/06 raw state byte: 0 charged, 1 charging, 2 not charging, 3 OK, 4 low, 5 critical. |
| Capacitive touch | 1A/0B [01], target 12 | 1A/10 touch event; individual touch-location decoding is not specified here. |
| Collision | Untargeted 18/11 [02 B4 82 B4 82 64], then 18/14 [01] only after accepted configuration. | 18/12 collision event. |
| Accelerometer | 18/00 [00 FA 00 00 00 E0 00], target 12: 250 ms, unlimited samples, mask 0000E000. | 18/02, first 12 raw bytes: BE float32 x, y, z. Disable with seven zero bytes. |
| Animation completion | No extra subscription beyond API notifications | 17/11; an event does not prove physical movement. |
Battery percentage 13/10 is optional; standard GATT 180F/2A19 is a fallback when exposed. Sleep is 13/01 (original untargeted, current app target 11); stop driving first and suppress inactivity-resetting traffic through 13/19 will-sleep and 13/1A did-sleep.
6. Run the Python example
Download control_car.py into a working folder. It needs Python 3.10+, a BLE adapter and Bleak. The self-test runs offline without Bleak. Grant the terminal Bluetooth access if the OS asks.
python3 control_car.py --self-test
python3 -m venv .venv
source .venv/bin/activate
python -m pip install bleak
python control_car.py --scan
On Windows, activate with .venv\Scripts\activate. Copy the selected identifier from the scan (a UUID on macOS). Replace YOUR_DEVICE_ID below; no action selects a car by name alone.
# Start with visible, stationary output.
python control_car.py --address YOUR_DEVICE_ID --headlights 128
python control_car.py --address YOUR_DEVICE_ID --read-volume
python control_car.py --address YOUR_DEVICE_ID --volume 128
python control_car.py --address YOUR_DEVICE_ID --profile 0x0069 --listen 10
# Unplug the charger and clear the area before this explicit movement test.
python control_car.py --address YOUR_DEVICE_ID --drive 0.15 --seconds 1
python control_car.py --address YOUR_DEVICE_ID --drive -0.15 --seconds 1
The example wakes the car, requires a fresh standard-A 2.173.0 reply, and correlates ordinary responses. Drive also requires a confirmed non-low, unplugged battery state and user-drive enable. It caps throttle at ±0.3 and duration at three seconds, uses 15 Hz, and attempts zero drive in finally, including cancellation. Failed stop delivery is reported explicitly.
It has no firmware, erase, factory-shell, reconnect/resume or content-upload path. It does not prove B/content health or physical output. Other options include taillights, sound-only --audio using a verified block, and --stop; that last option includes connection setup and is not an emergency stop. Light/volume settings remain changed until changed again.
7. Compatibility and sources
The basic profile, drive, idle, user-drive, lights and volume formats agree across inspected original Android apps 1.0.1, 1.1.0 and 1.2.3 and both current Red Thunder builders. This does not prove every old firmware/content pair accepts them. Normal control should not install firmware automatically.
API errors include 01 bad device, 02 bad command, 05 bad data length, 07 bad parameter and 08 busy. Log the exact request/reply and stop repeated failing actions. A rejected profile does not by itself diagnose erased audio; missing optional metadata should stay unavailable.
The new example’s offline tests cover literal packets, floats, escaped/split/routed responses, stale replies, timeouts, drive rejection and cancellation-stop handling. No new hardware run was performed for this publication.
See the machine-readable commands and example hash, restore research and source fingerprints, and Bleak’s client and scanner documentation. No proprietary firmware, audio or private device identifiers are included.