PBL in the development and stability control of an UAV with interdisciplinarity between digital control and computer assisted design

— Considering the difficulty of the members of the engineering courses in applying theoretical knowledge in practical situations, the proposals of Project-Based Learning (PBL) and experimental materials aim to expose the student to the professional reality applying the theoretical knowledge learned in the classroom and laboratories of experiments. Applying ABP in the discipline of Digital Control, it was proposed that the students develop a drone, a technology that for their implementation needs the application of the knowledge of digital control, electronics, mechanics, programming and modeling in Computer Aided Design (CAD) software. At the end are presented the results that the project has brought to the learning of the disciplines on the optics of the tutor and students.


INTRODUCTION
A major difficulty for students entering on engineering degrees is to apply theoretical knowledge and visualize practical situations in their professional reality [1]. Aimed at applying theoretical knowledge and exposing students to the challenges of professional reality, Project Based Learning (PBL), which consists of a learning style that seeks to expose students to new challenges, can be applied through the development of a Unmanned Aerial Vehicle (UAV), or drones, as they are best known, as a means of visualizing the application of the theory [2].
The usage of drones is growing in several areas and becoming one of the most commercialized technologies. Thus, the development of projects that allows the learning of technology gets a lot of prominence in the academy [3]. This technology allows the application of subjects commonly seeing in the course of Engineering of Control and Automation, such as digital controls, algorithms and many others [2].
This article aims to exhibit the development and stability control of a drone through practices in the Dig ital Control module of the University of Fortaleza (UNIFOR).

II. PROTOTYPE
The students developed in the Solid Works software the parts that make up the drone to be used in the Digital Control practices so that the complete structure behaves (or fits) with the components available in the laboratory, they are: motors and propellers model SIMA x5 Fig. 1A); ESP32 microcontroller (Fig. 1B); and MPU6050 accelerometer / gyroscope module (Fig. 1C). In addition to the drone structure itself, a pyramidal base was also designed to serve as a support for calibration tests, the complete design can be seen in Fig. 2. The prototype was printed in 3D, as shown in Fig. 3. The files needed to the structure was made available to the students, however, the possibility of using other structures and / or components was at their discretion. like quadcopters consist of complex electromechanical dynamic systems. In order to keep a quadcopter as stable as necessary, a robust control is required. Ogata [4] explains that digital control systems are systems that have a digital computer, which is responsible for processing the control of the system and controlling the dynamics of the system. According to the control theory, control systems constitute processes and subsystems that are constructed in order to obtain a response from a given input [5].
Closed-loop control systems, also called feedback control systems, operate through response measurements, comparing the response obtained with the desired response and with that, obtaining the error. From this, they alter their performances on the system in order to minimize the error [5].
The PID controller is an example of a viable controller to stabilize a drone, as pointed by Babu [6], because it acts on the system through the sum of three operations calculated over the error obtained, by the feedback system of control. Each operation has its relevance determined by different coefficients, the synchronization of those make a successfully control to occur and the behavior to be as desired [7]. The PID controller can be represented mathematically by equation (1).
The works of Prakosa [8] and Devos, Ebeid and Manoon-pong [9] explain that in order to achieve stability during flight of a drone, the directions of rotation of the propellers must be alternated as shown in Fig. 4, where the rotors of number 1 and 3 rotates clockwise while those of numbers 2 and 4 rotate in the oppos ite direction. Thus, if the speeds of motors 1 and 3 are greater than those of motors 2 and 4, the drone will rotate on its own axis in the clockwise direction and vice versa. The altitude can be controlled from the speed of rotation of its four propellers together. The forward and backward tilt is given by operating on motor pairs 3 and 4 or 1 and 2 in this order, while for left and right pairs 2 and 3 or 1 and 4, also in this order. The PID controller, presented in equation (1), needs to be modified to transform it into an algorithm that can be implemented on a digital platform such as a microcontroller. These modifications are necessary because Equation (1) is written in the continuous time domain while the ESP32, as a digital platform, operates in the discrete time domain. Yang and Bi [10] state that for the implementation of the PID in microcontrollers should use the formulation below, as presented in equation (2): Where and (t) is the difference between the desired value, or setpoint, and the value obtained. In this way, the PID controller has the same operation and result, but with this definition the algorithm is easier to implement in a digital systems. The generated algorithm follows the flow shown in Fig. 5.

Sensors Reading
In order to read the data from the guidance and motion of the drone, this work uses an MPU6050 module, which has embedded in its hardware a 3-axis accelerometer sensor and a 3-axis gyroscope. From those sensors it is capable of measure the angles related to X, Y and Z, known in aviation as yaw, pitch and roll. These axes are represented in Fig. 6. The work of Carlos et al. [12] converts the values of the acceleration data (ax, ay, and az) to the degree of slope relative to the earth's surface. These conversions are obtained through the application of equations (3), (4) and (5 Similarly to what was done with the acceleration data of the MPU6050, the data of the gyroscope was also transformed into a more usual unit to facilitate the understanding and the development of the applications. Equations (6), (7) and (8) represent the calculation for transforming the values gx, gy and gz, which are gross values of the read rotations respectively for the X, Y and Z axes, for vX, vY and vZ , which are values of the turns in degrees per second for the X, Y and Z axes, respectively. The constant g_gain is the calibration constant for the resolution set at the sensor; it is informed in the datasheet of the gyroscope. gain g gx vX _ *  (6) gain g gy vY _ *  (7) gain g gz vZ _ *  (8) According to Baerveldt and Klang [13], the readings made by accelerometers are quite sensitive to vibration noises. Because of that, it is important to use a filter in order to improve the accuracy of measurements. Baerveldt and Klang [13] recommend the application of the complementary filter, which integrates the readings of an accelerometer and a gyroscope into a single orientation result. The equations (9), (10) and (11) show the application of the complementary filter, where: Where FiltX, FiltY and FiltZ are respectively the values of the angles of the X, Y and Z axes obtained with the usage of the complementary filter. AA is the consideration factor of the accelerometer in sensors' joint. This value determines the confidence of the values obtained by the accelerometer. A value between 0 and 1 must be chosen for the variable. gXint, gYint and gZint which are integrals of the turns in the X, Y and Z axes, respectively, those values can be obtained through the usage of the Equations (11), (12) and (13), where dT is the time taken to re-sample the MPU6050 readings.:

Classroom practices
In the classroom practice, students were challenged to implement and calibrate a robust PID controller for altitude ( Fig. 7 item 1) and rotation axis (Fig. 7 items 2, 3  and 4). Controllers can / should be tested and calibrated separately. In a second moment, all the controllers were implemented simultaneously. The applied source code, can be found on github through the link: https://github.com/afonsohfontes/DroneStabilityControl, while the videos footage of the results, can be seeing using the following links:http://youtu.be/gNNePRGetCc, http://youtu.be/07HaDTp5J7c and http://youtu.be/fimDQZ_pDu0. According to Babu, Das and Kumar [6] for the teams that developed this project, many opportunities will be open with the addition of this work in their résumés. As a result of this work a was built a experimental prototype of good quality and low cost that could be us ed by other students of the module of Digital Control of the University of Fortaleza, in the application and simulation of control algorithms.
The students who participated in the practices reported in this study answered a questionnaire containing the questions raised by the tutor. All the questions asked could be answered on a scale of 1 to 5, where 1 would be the most possible negative answer and 5 to most positive. Fig. 8 depicts how motivated the students were during practice, while Fig. 9 shows how challenging the proposed project was for them. In a universe of 15 students it is noticed that 80% of them saw the project as very challenging and yet 93.3% of them felt motivated or very motivated. It is noted from Fig. 10 and 11 that all students support the application of PBL and that this practice helped them to better understand the content of the digital control discipline, great motivator of the accomplishment of this interdisciplinary work. Ofpossession of the results obtained in this project, we observe the possibility of the constant use of drones in the discipline of Digital Control, with the purpose of amplifying the student's development, facilitating the comprehension of the studied content.