-
Notifications
You must be signed in to change notification settings - Fork 0
Betaflight MAVLink Telemetry
jonpas edited this page Jan 31, 2019
·
9 revisions
This page describes how to wire a Betaflight flight controller board and a USB-to-TTL Serial Converter (USART) to get MAVLink Telemetry data out of Betaflight to your PC remotely, decode it and send it to DroneVis Server.
Note: Save files linked in this page with right-click and save as if they show up as text, as GitHub Wikis remove download attribute. Note: All instructions are for specific hardware we originally created this project with, own research is required to use other hardware!
Hardware:
- Board:
STM32F411
(STM32F411VE
MCU) - Wi-Fi Module:
ESP-01 (1MB)
(ESP8266
) - Adapter USB-to-TTL for UART:
RS232
(CP2102
)
- Download Betaflight 4.0.0 STM32F411DISCOVERY [DEV] (built from
betaflight/betaflight@a6fabe1
) or an official release since Betaflight 3.5.5 - Download Betaflight Configurator
- Flash downloaded target (instructions here)
- Connect to Configurator via
USER
USB port - Go to "Configuration" (tab) -> "Other Features" (box) and enable "TELEMETRY"
- "Save and Reboot"
- Go to "Ports" (tab) and for "UART6" select "MAVLink" in "Telemetry Output" (dropdown) and set it to "115200"
- "Save and Reboot"
- 2x ESP8266 required!
- Flash mavesp8266 (instructions below under ESP8266 Flashing)
- Connect the following pins (module pin-side, rest of board facing left -> board)
-
W b [GND__] [TX___]
->[GND] [PC7]
-
i a [GPIO2] [CH_PD]
->[___] [3V_]
-
F c [GPIO0] [RESET]
->[___] [___]
-
i k [RX___] [VCC__]
->[PC6] [3V_]
-
- Download wifi_receive.py
- Run
$ python wifi_receive.py
- Confirm data is received
- Data is sent in MAVLink protocol (garbled without a decoder)
- Setup ESP8266 Bridge UDP-UART (instructions in same URL and below under ESP8266 Flashing)
- Connect the following pins (module pin-side, rest of board facing left -> USB-to-TTL module)
-
W b [GND__] [TX___]
->[GND] [RX_]
-
i a [GPIO2] [CH_PD]
->[___] [3V_]
-
F c [GPIO0] [RESET]
->[___] [___]
-
i k [RX___] [VCC__]
->[TX_] [3V_]
-
- Connect 3V on reliable power supply! Some USB-to-TTL modules do not provide enough current through them!
- Connect USB-to-TTL to a USB port on PC
- Download pymavlink (eg. via
pip
) - Download mavlink_listener.py
- Run
$ python mavlink_listener.py --device=<port> --baudrate=115200
- Replace
<port>
with connected TTY/COM port (eg. Linux:/dev/ttyUSB0
, Windows:COM0
)
- Replace
- Confirm data is received
- Data is sent in MAVLink protocol and will be shown decoded
- Run DroneVis Server (instructions here)
- Download pymavlink (eg. via
pip
) - Run
$ python givers/mavlink_giver.py -a <ip:port> -d <device>
- Replace
<ip:port>
with IP and port of running DroneVis server (eg.:127.0.0.1:8080
) - Replace
<device>
with connected TTY/COM port (eg. Linux:/dev/ttyUSB0
, Windows:COM0
)
- Replace
- Download esptool
- Connect the following pins (module pin-side, rest of board facing left -> USB-to-TTL module)
-
W b [GND__] [TX___]
->[GND] [PC7]
-
i a [GPIO2] [CH_PD]
->[___] [3V_]
-
F c [GPIO0] [RESET]
->[DTR] [RTS]
(for Automatic Bootloader or onlyGPIO0
->GND
for Manual Bootloader) -
i k [RX___] [VCC__]
->[PC6] [3V_]
-
- Run
$ esptool erase_flash
- Run
$ esptool write_flash 0x0 <flash_file.bin>