Skip to content

silvamleandro/UAV_Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Platform for UAV Controlling

This project aims to develop an MQTT platform for UAV control applying the detection of DoS attacks on the wireless network. Thus, two programs are built: one for the controller and the other for the Raspberry Pi, which is responsible for communicating with the UAV. The connection between the Raspberry Pi and the UAV is through the Wi-Fi network, so a machine learning model is generated in order to detect attacks, such as deauthentication.

The group for this project is composed of the following members:

Technologies and Tools Used

The technologies and tools in the sequence have been used for the development of this project:

  • DJI Tello Consists of an extremely light UAV with only 80 g counting the propellers and battery, low cost and portable, in addition to being designed for beginners in the area. The UAV can fly up to 13 minutes at a speed of 28.8 km/h within a radius of up to 100 meters away;
  • Python: Simple, versatile programming language and has a huge amount of libraries, such as paho-mqtt and djitellopy;
  • Raspberry Pi Model B: Single-board computer with low cost and accessible to students in general. This model contains an Ethernet port, and allows the connection of a Wi-Fi dongle to connect to the real drone;
  • Eclipse Mosquitto: Broker server that is easy to install and configure. Also, it's open source and has an image on Docker Hub;
  • Eclipse Paho: Library to implement the MQTT client, that is, to send and receive messages. The Mosquitto Python Client project was donated to Eclipse Paho in June 2013, and allows integration with several programming languages as well, such as C or Java;
  • OpenSSL: Allows the generation of X.509 certificates, in the X.509 Public Key Infrastructure (PKI) standard and encrypted with SHA-256.

Configuration and Execution

To run the programs, it is necessary to have Python 3.6+ and install the following libraries:

pip install paho-mqtt
pip install djitellopy

Also, it is possible to install the libraries through requirements.txt:

pip install -r requirements.txt

Note 1: It is possible to create a virtual environment too. However, don't forget to activate it when installing the libraries and running the code.

Note 2: The djitellopy library is only used in the uav.py script, so no need to install on the controller. And for the library to work correctly, it is necessary to install OpenCV and libatlas on the OS through the commands:

sudo apt-get install python3-opencv
sudo apt-get install libatlas-base-dev

In addition, it is possible to configure your MQTT broker address and SSL/TLS certificates in the codes. As the platform supports DJI Tello, it is necessary to configure your network on the Raspberry Pi or any other device that will connect with the UAV. On Linux systems, it can be done by editing the file /etc/wpa_supplicant/wpa_supplicant.conf and creating an entry:

network={
    ssid="TELLO SSID"
    psk="TELLO PASSWORD"
}

To initialize receiving commands and publishing UAV state, run the command python3 uav.py. The -t or --tello parameter is to inform that DJI Tello is available to receive commands. Then, check if Tello is connected to the network before informing this parameter. Also, the drone state is published every two seconds, being sent pitch, yaw, roll, speed on three axes (x, y, z), average temperature, battery level, and height.

If it gets the error "Python [Errno 98] Address already in use" when rerunning with DJI Tello, it will need to terminate the process:

ps -fA | grep python
kill -9 process_id

Commands are sent by the controller through the command python3 controller.uav, addition to receiving the UAV state. There are two ways to enter commands: single command and flight plan. The single command is informed in the -a or --action parameter, and its respective value in the -v or --value parameter. For example, the command python3 controller.py -a left -v 10 makes the UAV fly left for 10 cm. The second way is to use the .txt file with the flight plan defined, as defined in the example flight_plan.txt. To enter a text file, the -f or --flight_plan parameter is required. Below are the possible actions implemented in this project:

  • takeoff: take off the UAV;
  • land: land the UAV;
  • up value: ascend to value cm;
  • down value: descend to value cm;
  • forward value: fly forward for value cm;
  • backward value: fly backward for value cm;
  • left value: fly left for value cm;
  • right value: fly right for value cm;
  • rotate_clockwise value: rotate value degrees clockwise;
  • rotate_counterclockwise value: rotate value degrees counterclockwise.

Note 3: The -o or --only_publish parameter is used only publish commands, not subscribe.

Note 4: For the DJI Tello to work with the application, its firmware needs to be updated to the latest version. In addition, some bugs may occur, so it is recommended to connect the drone to the smartphone and fly, and then connect to the platform.

Note 5: The dataset to train the model against wireless attacks was provided from the Aegean Wi-Fi Intrusion Dataset 2 (AWID2).

About

MQTT platform for UAV controlling

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published