FlySys Bluetooth Low Energy protocol
FlySys Duo transmits vertical speed, barometric pressure, estimated altitude, battery charge and G-force over Bluetooth Low Energy (BLE). Applications can receive samples in ASCII or binary format.
API 1.0 · protocol and telemetry schemas 1
1. Discover and connect to Duo
Switch Duo on, then press its button briefly to open the advertising window. Scan for the FlySys service UUID, connect to the device and discover its GATT characteristics.
- AdvertisingFrom Duo to the applicationSwitch on Duo and press its button briefly to open the advertising window.
- Service discoveryFrom the application to DuoScan for the service UUID, connect and discover its characteristics.
- Subscription and stream requestFrom the application to DuoEnable text notifications, check access and request the flight data stream.
- Telemetry notificationsFrom Duo to the applicationDuo sends samples. The application displays vertical speed in m/s.
Duo advertises as “FlySys Duo”. Match the service UUID below during discovery. Command RX receives writes from the application. Text TX sends replies and ASCII samples to the application.
| UUID | Operation |
|---|---|
6E400001-B5A3-F393-E0A9-E50E24DCCA9E | Discover the FlySys service |
6E400002-B5A3-F393-E0A9-E50E24DCCA9E | App → Duo · Write commands (with or without response) |
6E400003-B5A3-F393-E0A9-E50E24DCCA9E | Duo → App · Subscribe to text replies, events and ASCII telemetry |
6E400005-B5A3-F393-E0A9-E50E24DCCA9E | Duo → App · Subscribe for binary samples |
2. Subscribe and check access
Before sending the first command, subscribe to notifications on Text TX (UUID ending in 0003 before the first hyphen). Enable its Client Characteristic Configuration Descriptor (CCCD). Send all text commands to Command RX (0002).
The arrows show direction and are omitted on the wire. Send each request as ASCII followed by a single LF byte (0x0A). Split writes at min(ATT_MTU − 3, 512) bytes, or 20 bytes at the default MTU of 23. Buffer incoming text until LF and handle several lines in a single notification.
Give each pending REQ a unique positive 32-bit ID. Match RES by ID and wait for the terminal OK or ERR, even after a successful GATT write. ITEM rows, EVT events and TEL samples can arrive in between.
;1.0;REQ;1;AUTH;STATUS
;1.0;RES;1;OK;AUTH;STATUS;NOT_CONFIGUREDWith NOT_CONFIGURED, proceed to device information. With CONFIGURED, authenticate before sending device or stream commands.
If AUTH;STATUS returns CONFIGURED
Ask the owner for the device password. Send AUTH;CHALLENGE and read salt_hex, challenge_hex and iterations from the OK payload in that order. Compute the response locally with these returned values. This Python example uses the standard library.
import hashlib, hmac
def response(password, salt_hex, challenge_hex, iterations):
salt = bytes.fromhex(salt_hex)
challenge = bytes.fromhex(challenge_hex)
if len(salt) != 16 or len(challenge) != 16 or not 1 <= iterations <= 1_000_000:
raise ValueError("AUTH;CHALLENGE")
p = password.encode("utf-8")
key = hashlib.sha256(b"FLYSYS-BLE-PASSWORD-V1" + salt + p).digest()
for _ in range(1, iterations):
key = hashlib.sha256(key + salt + p).digest()
return hmac.new(key, b"FLYSYS-BLE-AUTH-V1" + challenge, "sha256").hexdigest()Send AUTH;RESPONSE;<hex> with the returned digest and continue after OK;AUTH;RESPONSE;AUTHORIZED. After AUTH_FAILED request a fresh challenge. Use a new request ID for each command.
3. Read device information and field definitions
Send one request at a time. Match each RES to its request ID and wait for the final OK or ERR. These are example replies. Device-specific values vary. For STREAM;DESCRIBE, only the first and last ITEM rows and the final OK are shown.
DEVICE;INFO
Reply 2 contains key/value pairs. Read them by name. hardware_id identifies this unit, firmware is its installed release and api;1.0 selects the command format used here. ble_connected;true indicates an active BLE link. battery_voltage_v;4.190 means 4.190 V.
; 1.0; REQ; 2; DEVICE; INFO
; 1.0; RES; 2; OK; DEVICE; INFO; name; FlySys; model; DUO; firmware; 0.6.6; hardware_revision; 0.3; api; 1.0; ble_compiled; true; ble_active; true; ble_connected; true; ble_advertising; false; battery_adc_raw; 2600; battery_pin_mv; 2095; battery_voltage_v; 4.190; battery_percent; 100.0; battery_adc_calibrated; true; input_power_present; true; charge_status_low; false; hardware_id; ESP32S3-1020BA5EE840; model_number; FSD012BIBW; serial_number; FS260805002304; store; flash| Field | Returned value | Meaning |
|---|---|---|
name | FlySys | Device name in the protocol. |
model | DUO | Product model. |
firmware | 0.6.6 | Installed firmware release. |
hardware_revision | 0.3 | Assigned hardware revision. |
api | 1.0 | Version in the message prefix. |
ble_compiled | true | The firmware build includes BLE support. |
ble_active | true | BLE transport is active on the device. |
ble_connected | true | A client currently has a BLE connection. |
ble_advertising | false | Whether Duo is currently advertising. |
battery_adc_raw | 2600 | Raw battery ADC reading, in counts. |
battery_pin_mv | 2095 | Voltage at the ADC input in millivolts. |
battery_voltage_v | 4.190 | Battery voltage in volts. An unavailable reading is reported as nan. |
battery_percent | 100.0 | Estimated battery charge in percent. nan means unavailable. |
battery_adc_calibrated | true | Whether calibrated ADC conversion succeeded. |
input_power_present | true | External input power detected. |
charge_status_low | false | Logic level of the charger status pin. true means low. |
hardware_id | ESP32S3-1020BA5EE840 | Stable hardware identifier for this unit. |
model_number | FSD012BIBW | Assigned product model number. |
serial_number | FS260805002304 | Assigned product serial number. |
store | flash | Settings storage in use. flash is persistent, ram is volatile. |
DEVICE;CAPABILITIES
Reply 3 also contains key/value pairs. protocol_schema_version;1 and telemetry_schema_version;1 identify the command and telemetry schemas to decode. Check that your application supports both before starting the stream. imu_model;BMI270 identifies the motion sensor. imu_odr_hz;100 is its sampling rate in Hz. Select the BLE stream rate separately.
; 1.0; REQ; 3; DEVICE; CAPABILITIES
; 1.0; RES; 3; OK; DEVICE; CAPABILITIES; imu_model; BMI270; imu_odr_hz; 100; imu_odr_configured_hz; 100; imu_odr_actual_hz; 99.75; gyro_range_dps; 2000; accel_range_g; 16; imu_drdy; false; imu_drdy_gpio; -1; protocol_schema_version; 1; telemetry_schema_version; 1; ble_access; button_session; security_profile; development; secure_version; 1| Field | Returned value | Meaning |
|---|---|---|
imu_model | BMI270 | Model of the initialized motion sensor. |
imu_odr_hz | 100 | Nominal IMU output data rate in hertz. |
imu_odr_configured_hz | 100 | Configured IMU output data rate in hertz. |
imu_odr_actual_hz | 99.75 | Measured IMU sample rate in hertz. |
gyro_range_dps | 2000 | Gyroscope range in degrees per second. |
accel_range_g | 16 | Accelerometer range in g. |
imu_drdy | false | Whether the IMU data-ready interrupt is in use. |
imu_drdy_gpio | -1 | GPIO for that interrupt. −1 means unused. |
protocol_schema_version | 1 | Version of the command and response schema. |
telemetry_schema_version | 1 | Version of the telemetry field schema. |
ble_access | button_session | BLE access mode. A button press opens the advertising window. |
security_profile | development | Firmware build security profile. |
secure_version | 1 | Firmware security version used to check update compatibility. |
STREAM;DESCRIBE
Each ITEM describes one field. The first row assigns ID 0 to vertical_speed_mps, a floating-point value in m/s with three decimal places in ASCII. Store descriptors by ID. The final OK;STREAM;DESCRIBE;42 means this example returned 42 descriptors. Count the rows with request ID 4 and compare with the reported total. The BLE stream supports the five fields shown in step 5.
; 1.0; REQ; 4; STREAM; DESCRIBE
; 1.0; RES; 4; ITEM; STREAM; DESCRIBE; 0; vertical_speed_mps; float; m/s; 3
; 1.0; RES; 4; ITEM; STREAM; DESCRIBE; 41; ahrs_acceleration_recovery; bool; 1; 0
; 1.0; RES; 4; OK; STREAM; DESCRIBE; 42| ID | Field | Type | Unit | Decimals |
|---|---|---|---|---|
| 0 | vertical_speed_mps | float | m/s | 3 |
| 41 | ahrs_acceleration_recovery | bool | 1 | 0 |
4. Start the ASCII stream
BLE field IDs and masks
| Field | ID | Mask (hex) | Unit |
|---|---|---|---|
Vertical speedvertical_speed_mps | 0 | 001 | m/s |
Barometric pressurebaro_pressure_hpa | 2 | 004 | hPa |
Estimated altitudeestimated_altitude_m | 5 | 020 | m |
Battery chargebattery_percent | 8 | 100 | % |
G-forceg_force | 9 | 200 | g |
The ID is the bit position. Combine the masks of the selected fields with bitwise OR and send the result without the 0x prefix. For vertical speed and pressure, 001 | 004 = 005, so send STREAM;START;20;5;ascii.
The request selects all five BLE fields (hex mask 325) at 20 Hz. The supported rate is 1–50 Hz. RES;5;OK acknowledges request 5 and echoes the accepted rate, mask and format. Keep listening on Text TX for TEL samples.
;1.0;REQ;5;STREAM;START;20;325;ascii
;1.0;RES;5;OK;STREAM;START;20.00;325;ascii5. Decode a telemetry sample
;1.0;TEL;0;123456;325;1.250;1012.500;453.200;87.0;1.0470Read the line from left to right. Split it at semicolons. $FLYSYS identifies the protocol, 1.0 the API version and TEL a telemetry sample. The next three tokens describe the sample.
0- Sequence number 0, the first sample of this stream.
123456- Device uptime in microseconds. 123456 µs = 0.123456 s since boot.
325- Hexadecimal field mask (0x325). Bits 0, 2, 5, 8 and 9 are set. Read one value per set bit in ascending ID order, as shown below.
| Sample value | Field | ID | Bit (hex) |
|---|---|---|---|
1.250 m/s | Vertical speedvertical_speed_mps | 0 | 001 |
1012.500 hPa | Barometric pressurebaro_pressure_hpa | 2 | 004 |
453.200 m | Estimated altitudeestimated_altitude_m | 5 | 020 |
87.0 % | Battery chargebattery_percent | 8 | 100 |
1.0470 g | G-forceg_force | 9 | 200 |
In sample 0, bit 0 is set. The first value (1.250) therefore represents a vertical speed of +1.25 m/s. Positive values indicate ascent and negative values indicate descent.
;1.0;TEL;1;173456;125;-0.800;1012.510;453.160;87.0In mask 125, bit 9 is clear, so the sample omits G-force. The first value (−0.80 m/s) indicates descent. The last value (87.0%) is the battery charge. A battery field containing nan indicates an unavailable reading.
Use uptime to compare samples within a run. It has no UTC epoch. Gaps in the sequence can indicate lost samples. Duo sends no replay.
6. Maintain and close the session
While streaming, send STREAM;KEEPALIVE every 12–30 seconds to renew the 60-second lease. If it returns STREAM_NOT_ACTIVE, start a new stream. To finish, stop streaming, request DEVICE;DISCONNECT and close GATT within two seconds of its OK.
;1.0;REQ;6;STREAM;KEEPALIVE
;1.0;RES;6;OK;STREAM;KEEPALIVE
;1.0;REQ;7;STREAM;STOP
;1.0;RES;7;OK;STREAM;STOP
;1.0;REQ;8;DEVICE;DISCONNECT
;1.0;RES;8;OK;DEVICE;DISCONNECTAfter unexpected link loss, mark readings stale, cancel pending requests and discard partial lines. Duo reopens its advertising window. Reconnect, subscribe, authenticate if required, check capabilities and start a fresh stream. The sequence restarts. If a read times out, discard its partial reply and retry with a new ID.
Optional binary format
Keep text notifications enabled for replies. Subscribe to binary telemetry TX, then request STREAM;START;20;325;binary. Each binary notification contains one complete little-endian packet. With all five fields it needs 36 payload bytes and ATT_MTU ≥ 39. If START is rejected, request the ASCII stream.
| Byte offset | Type | Field |
|---|---|---|
| 0 | uint8 | Packet version (1) |
| 1 | uint8 | Flags (0) |
| 2 | uint16 | Sample sequence, low 16 bits |
| 4 | uint32 | Uptime in µs, low 32 bits |
| 8 | uint64 | Actual field mask |
| 16… | float32 | One value per set bit in ascending order |
Accept packet version 1 with flags 0 and exactly 16 + 4 × (number of set bits) bytes. Account for wraparound of the 16-bit sequence and 32-bit clock when calculating differences.