How to: Tello drone to micro bit - Victor Alikberov, Blog#1
1. Introduction.
The purpose of this blog is to explain everything that is needed in order to connect tello drone to micro bit. It will cover wiring, javascript code behind custom created tello extension and how to use this extension to connect and drive tello via microbit.
2. Wiring.
Since tello drone creates its own wi-fi hotspot, additional wi-fi module is required in order to establish wireless connection between micro bit and tello. ESP8266 will be used to connect micro bit to tello wi-fi hotspot and also to establsih UDP communications between micro bit and drone. The pinout of the ESP8266 chip is shown below.
ESP8266 chip pinout.
Receiving port (Rx) is connected to transmitting port of the micro bit (pin 2) and transmitting port (Tx) of the ESP8266 is connected to receiving port of the micro bit (pin 1). 3.3 volts power supply should be provided both to micro bit and ESP8266
chip. Chip enable port is also connected to 3.3v power supply.
3. JavaScript code.
Since there are no code blocks for tello, javascript will be used to create custom code blocks that will allow us to connect ESP8266 to tello wi-fi hotspot and then open UDP transmission between ESP8266 and tello so that commands can be sent to drive the drone. ESP8266 communicates to micro bit via serial ports using special AT commands. The list of usefull AT commands for ESP8266 that will be used is presented in the table below.
First, all necessary variables and auxiliary functions need to be defined. Boolean wifi_connected and udp_connected will be used to check the status of the connections.
When ESP8266 recieves an AT command it sends responce back to micro bit. Next function named "waitResponce" is used to search for "OK" in responce string message. It will mean that the AT command has been executed without errors.
Next step is to create function that connects ESP8266 to tello wi-fi hotspot. Tello drone wi-fi hotspot default SSID is "TELLO-60132C" and by default it has no password.
As a result, the whole javascript code is appeared as an extension for micro bit.
Anyone can add this extension into his project by typing https://github.com/victoralikberov/tello_and_microbit in the extensions search field.
4. How to use Tello extension.
Now Tello extension can be used to initialize ESP8266 module and connect it to
Tello wi-fi hotspot. This is achieved by using “Initialize ESP8266” code block that assigns the Rx and Tx pins and connects to TELLO-60132C (TELLO
drone SSID) wi-fi hotspot. By default, TELLO drone wi-fi has no password, and
therefore password field is kept empty.
Next step is to start UDP communications between ESP8266 and Tello drone. Tello ip adress is 192.168.10.1 and UDP port is 8889
After setting up wireless connection between ESP8266 and TELLO drone, “Wifi connected?” and “UDP connected?” code blocks can be used to check status of the connections.
The final step is to send
command named “command” that activates Tello SDK and it has to be sent before
sending other commands. All commands are sent by using the code block presented
below.
To
send a command user has to type name of that command and number of bytes this
command has. Number of bytes is simply number of characters (space counts as
two bytes). Tello drone has a fixed list of commands, some of them are
presented in a table below.
The full sequence of code blocks that connects tello to micro bit is presented below. This sequence has to be executed every time when starting a micro bit.
Now
after establishing communication between tello and micro bit via ESP8266 wi-fi
module, micro bit features can be used to send commands to the drone. For example,
micro bit buttons can be used for simple press A to takeoff and press B to land
test.
5. Additional links
1. https://drive.google.com/drive/folders/18hALZysU_BmnhHvIsWMj7a4IeLly4f1u?usp=sharing. Videos of tello plus micro bit tests.
2. https://github.com/victoralikberov/tello_and_microbit. GitHub repository with javascript codes. Also used to import tello extension into makecode project.
Comments
Post a Comment