Sitemap
Alexander Doyle

Alexander Doyle

Flying Tello EDU Drones in Python

2 min readMay 15, 2022

--

A guide to fly the DJI Tello EDU in Python with the Py-Tello library. Py-tello is a library to make it easier to fly your Tello Edu in python. This article covers swarming drones with an external router.

Prerequisites

  • Windows 7+
  • Python 3+

Library Installation

Well now we’ve got that out of the way, how do we install the Py-Tello library? You need to enter the command prompt and enter the following command to install the library onto your Python environment:

pip install pytello-hsu==3.0.0

Get Alexander Doyle’s stories in your inbox

Join Medium for free to get updates from this writer.

How The Drone Communicates

It is important to understand how the drone communicates with you. The Tello EDU emits a wifi signal for your device to connect to. Then, the Py-tello library creates a server-client connection with your tello. The drone is by default set to the IP address 192.168.10.1. Our device that communicates with the drone sends packets containing commands for the drone to follow. A packet is a block of data that is transmitted via a network. Once the drone receives the packet the drone will send a packet responding to the command such as an error message if the command didn’t make sense, or a message telling us that the command was executed successfully.

How to Write the Code for a Direct Connection

Now we know how the drone communicates with our device we can start coding the connection between the drone and our device. The following code imports the library we installed in the previous step into the file and initializes the drone class.

import hsupytellomy_drone = drone()

After we get the class of the drone initialized and the library imported, we’re going to set the drone’s variables. Below are the basic default variables that can be changed by you:

These are just the basic variables. For more comprehensive variables click here

my_drone.tello_address = ("192.168.10.1", 8889) # Decleration of the address of the drone
my_drone.console_output = False # Console output of telemetry data from the drone
my_drone.receiving_port = 1518 # Port to receive information from the drone
my_drone.time_format = "%H:%M:%S:%f" # The time format used when logging when telemetry data was recived

All of this may look complicated but, it is not as it seems. The tello address variable is a tuple that contains the IP-Address of the drone and the port it communicates on. We do not need to worry about changing this variable yet because the drone has a static IP on its network. The console output variable determines if the information sent back by the drone is printed to the console. This variable defaults to being false so if you want to see if any errors are coming from the drone, it is recommended that you set this variable to be true. The receiving port is the port on your device where you want to receive packets from the drone. This could be any port but, some ports are reserved for other applications and may have unwanted traffic on them. See the IANA Website for more details on ports and who they belong to.

--

--