Documents



Home Config Updates Docs

db Flight Controllers

Get started

To be updated

Protocol description

The flight controllers receive data frame by frame and use NULL (0x00) bytes as frame delimiters. There will be no 0x00 bytes in a data frame. Each frame contains a key (1 byte), a value (3 bytes) of the and a checksum (1 byte).

<1 key byte>: The description in the keys table. The value of the key byte should be key + 1.

<3 value bytes>: This 3 bytes is to contain a value from 0 to 16581375 (= 255*255*255).
For example, the number 1000000 will be converted to 3 bytes as bellow:
byte[2] = 156 as 1000000 % 255 = 156, take 156 + 1 = 157
byte[1] = 97 as integer of (1000000 / 255) = 3921 and 3921 % 255 = 96, take 96 + 1 = 97
byte[0] = 16 as integer of (3921 / 255) = 15 and 15 % 255 = 15, take 15 + 1 = 16

<1 checksum byte>: Is calculated from the key & value bytes then modulo 255
For example, key is 5, value is 1000000, then we have 4 bytes of key and value as bellow:
bytes: 6, 16, 97, 156
checksum = (6*255^3 + 16*255^2 + 97*255 + 156) % 255 = 156
The frame is: 6, 16, 97, 156 156 0

Javascript code

key = ...
value = ...
let out_bytes = [-1, 0, 0, 0, 0, 0]

let byte1 = key;
value = parseInt(value);
let byte4 = value%255;
value = parseInt(value/255);
let byte3 = value%255;
value = parseInt(value/255);
let byte2 = value%255;

let check = (byte1*(255*255*255) + byte2*(255*255) + byte3*(255) + byte4) % 255;
let byte5 = check;

out_bytes[0] = byte1 + 1;
out_bytes[1] = byte2 + 1;
out_bytes[2] = byte3 + 1;
out_bytes[3] = byte4 + 1;
out_bytes[4] = byte5 + 1;
              
Python code

key = ...
value = ...
out_bytes = [-1, 0, 0, 0, 0, 0, 0]

byte1 = key
value = int(value);
byte4 = value%255
value = int(value/255)
byte3 = value%255
value = int(value/255)
byte2 = value%255

check = (byte1*(255*255*255) + byte2*(255*255) + byte3*(255) + byte4) % 255
byte5 = check

out_bytes[0] = byte1 + 1
out_bytes[1] = byte2 + 1
out_bytes[2] = byte3 + 1
out_bytes[3] = byte4 + 1
out_bytes[4] = byte5 + 1
              
Key Description
1Initial motor speed (PWM)
2Minimum motor speed (PWM)
3Take-off motor speed (PWM)
4Maximum motor speed (PWM)
5Token-off height (PWM)
6P gain (Roll)
7I gain (Roll)
8I accumulation gain (Roll)
9D gain (Roll)
10Offset (Roll)
11P gain (Pitch)
12I gain (Pitch)
13I accumulation gain (Pitch)
14D gain (Pitch)
15Offset (Pitch)
16P gain (Yaw)
17I gain (Yaw)
18I accumulation gain (Yaw)
19D gain (Yaw)
20Offset (Yaw)
21P gain (Position hold)
22I gain (Position hold)
23I accumulation gain (Position hold)
24D gain (Position hold)
25Brake after releasing the control
26P gain (Altitude hold)
27I gain (Altitude hold)
28I accumulation gain (Altitude hold)
29D gain (Altitude hold)
30Tilt compensation (Altitude)
31Moving support 1 (Altitude)
32Moving support 2 (Altitude)
33Moving support 3 (Altitude)
34PID smoothing 1 (Roll/Pitch/Yaw)
35PID smoothing 2 (Roll/Pitch/Yaw)
36PID smoothing 3 (Roll/Pitch/Yaw)
37PID smoothing 1 (Position hold)
38PID smoothing 2 (Position hold)
39PID smoothing 3 (Position hold)
40PID smoothing 1 (Altitude)
41PID smoothing 2 (Altitude)
42PID smoothing 3 (Altitude)
43Monitor request
44RC type

SDKs

dbFlow

Get started

To be updated

Output messages

To be updated


Products made by @db team
db team has lots of improvements in PID and optical flow algorithm