PID Control System on Brushless DC Motor for Quadcopter Balance

— Unmanned Aerial Vehicle (UAV) is an unmanned aircraft system that is no longer a special need but has become a general need for the community, and one example is used to capture everyday moments through photos or videos from the air. Among the models of UAV aircraft is the quadcopter, where there is a flight controller that functions to fly the quadcopter by adjusting the speed of each motor. The flight controller that is often used today is the Pixhawk manufacturer. The Pixhawk module is an integrated system that the factory has provided, so it cannot be modified in terms of control and I/O. This research focuses on making an independent flight controller that can be used to fly a quadcopter. The control method that is implanted is Proportional Integral Derivative or commonly known as PID. The flight controller uses the PID control method to adjust each Brushless DC Motor (BLDC) speed to maintain stability while flying. From the test results, the quadcopter can fly stably with KP parameters of 2.5, KI of 0.6, and KD of 1.0. The response time in processing feedback is 3s.


I. INTRODUCTION
Unmanned aircraft (UA) or commonly called Remotely Piloted Vehicle (RPV) or Unmanned Aerial Vehicle (UAV) is one type of unmanned aerial vehicle (aircraft) that can be controlled by radio waves remotely. Control of the UAV in the air is generally done manually from the Ground Control Station below. Currently, UAV is no longer a special need but has become a general need of society. Among the uses of flying robots are aerial photos used for land mapping and taking photos or videos of our daily moments, which when the view is better if taken from the air and for the benefit of monitoring the area [1].
One model of a UAV aircraft shape is a flying robot with two, three, four, six rotors around the aircraft [2]. The quadcopter model (4 rotors) is a flying robot that has 4 brushless DC motors on the sides of the robot. Usually the quadcopter's mechanical body forms the letter "X" or "+". The brushless DC motor here serves to fly the quadcopter in the air. To do aerial photography, using a quadcopter-type flying robot is more appropriate because of its easy maneuverability.
In 2013 the Ministry of Education and Culture supported flying robots by holding an Unmanned Aerial Vehicle (UAV) competition called the Kontes Robot Terbang Indonesia (KRTI). This contest aims to develop the potential for UAV manufacture in Indonesia such as stability control, monitoring and mapping. There is a special division that focuses on developing flight controllers. Flight Controller here aims to provide control on an aircraft while flying in the air [3]. The need for aircraft balance in the air is very important, so it is necessary to have the right control method so that the motors installed can rotate according to the command from the remote.
Flight controllers used in general use manufacturing from Pixhawk. The Pixhawk is an integrated system for use in aircraft control. However, the I/O of the Pixhawk is limited, and it is also difficult to modify the control side for specific needs. Previously [4], Low-Cost Flight Controllers have been made, but the PCB board model is still not printed neatly. Therefore, in this study, a Flight Controller was made independently to fly an unmanned flying robot of the Quadcopter type. The method used is Proportional Integral Derivative (PID) control. With this research, a flight controller board is produced that can fly a quadcopter with homemade controls whose PCB shape is very suitable to be placed on the f450 type quadcopter frame.

A. Quadcopter Concept
Quadcopter is one type of uncrewed aircraft that uses several motors as aircraft lift, quadcopter has a mechanical design that is designed symmetrically to stabilize the aircraft by adjusting the automatic calculations, the load carried and the speed of the motor used.
The quadcopter itself consists of 2 types, type "x" and type "+" depending on the speed of the quadcopter. Quadcopter has a frame, whereas the fulcrum at the x and y coordinates. To move up required the same speed and large enough on all four rotors. Effect of rotor speed on quadcopter movement. In Figure 1, the green color for the rotation of the motor is the motor speed with low speed, while the red color represents the motor speed with high speed. The quadcopter has four propellers with a + type ride design. The quadcopter uses four motors as propulsion, where there are two motors that rotate clockwise, with the other two motors rotating counterclockwise. During take-off, all motors rotate at high speed, and then for landing, all motors rotate at low speed. For forward movement, m1 rotates at high speed, and m2, m3, and m4 rotate at low speed, then for backward movement then m3 rotates at high speed, and m1, m2, and m4 rotates at low speed. For the direction of the motor to the right side, then m2 rotates at high speed, vand m1, m3, and m4 rotate at low speed. For left side motor movement then m4 rotates high speed and m1, m2 and m3 rotate at low speed, then for rotational movement to the right, then m2 and m4 rotate at high speed, and m1 and m3 rotate at low speed, then for rotational movement to the left m1 and m3 rotate at high speed, and m2 and m4 rotate at low speed. Figure 2 is a quadcopter configuration, a pair of front and rear rotors are W1 & W3, which rotate counterclockwise, and a pair of left and right rotors are W2 & W4, which rotate clockwise. Mathematical model of each robot so that the response of the robot can be known so that it is used as a reference and comparison for making equations and control systems to be used, the following table explains the symbols, variables, and terms that will be used: Table I is an explanation of the quadcopter model formula with the "+" shape motor BLDC position configuration.

B. Quadcopter Mathematic Model
The position of the copter on the x-axis Y The position of the copter on the y-axis Z The position of the copter on the z-axis ϕ Roll angle on the x -axis ϴ Pitch angle on the y -axis is a controller to determine the precision of a system with feedback on the system. In figure 3 the PID control components consist of three types, namely Proportional, Integrative and Derivative. If interpreted in terms of time: depends on the current error value, is the accumulation of the previous error value, and is a prediction of error in the future, based on the rate of change [5]. The three controls can be used together or alone, depending on the desired response to a plant. Because the pid control system relies only on measurable process variables, not knowledge of the process, it can be widely used. By tuning all three model parameters, the PID controller can meet the needs of the process. The response of the controller can be explained by how it responds to errors, the amount of overshoot from the setpoint, and the degree of system oscillation. The use of the PID algorithm does not guarantee optimum control of the system or even its stability. In the Equation shown in reference [6], when n is the discrete-time of t, the discrete Equation of PID uses Equation (2).
Where µ variable is the controller output, E variable is Error = Setpoint -Process Value, Kp variable is a proportional gain constant, Ki variable is the integral gain constant, and Kd is the derivative gain constant There are several ways to determine the value of Kp, Ki, Kd variables. One of them is by tuning the values one by one. Starting with the value of Kp (Gain proportional), first, we need to find the fastest system response by minimizing the rise time value, do not give a Kp value that is too large or too small. After the response is deemed appropriate, the next thing that can be done is to assign a value to Kd (Derivative Gain). This aims to reduce the amplitude value so that the oscillations can be damped or even eliminated. Then the last process in tuning the Gain value is to find the value of Ki (Integral Gain). Tuning Ki is needed if the system condition has a steady-state error, i.e., there is a difference between the setpoint value and the system value when it reaches steadystate conditions.

D. Control System Design
In this balance control system, angle PID control is used for each axis of the quadcopter. The setpoint angle used in this control is fixed. Its function is as a reference or target angle for a balanced position on the quadcopter. For the quadcopter to be balanced, the speed for each motor is set. Where the speed of this motor comes from the conversion of the PID control output angle, which is entered in the kinematic formula of the quadcopter. The angle PID control input itself comes from an error or difference in value between the setpoint angle and feedback in the form of the actual angle generated by the quadcopter. The block diagram of the balance control system design can be seen in Figure 4. The PID control output is used to determine the speed of each motor, so that it is used as input for the kinematic quadcopter. In this system, there are 3 PID controls, each of which is to regulate roll ( ), pitch ( ), and yaw ( ) movements on the quadcopter. Feedback for each tilt angle is obtained from the IMU sensor mounted on the flight controller In figure 5 describes in detail the hardware design. In making hardware where the microcontroller used is ARMSTM32F4, the features used are PWM to control brushless motors, USART to read IMU data, along with hardware design and some other I/O. It can be seen in the composition hardware block diagram in Figure 5, the hardware composition for the quadcopter consists of an ARMSTM32F4, remote control, receiver, IMU Gy-25 sensor, Telemetry, 4 ESCs and 4 Brushless DC motors.

E. Brushless Motor DC (BLDC)
The main component in flying a multirotor is a brushless motor, where the brushless motor has three wires. These three wires function to control the three-phase motor. When connected to the Electronic Speed Control, it will affect the motor's rotational direction by CW (clockwise) or CCW (counterclockwise). The lifting force or thrust affects whether the multirotor can fly or not, for example to be able to fly a multirotor with brushless motor specifications as shown in Figure 6. The DJI 920kv brushless motor produces 1310 grams of thrust, so the overall thrust is 5240 grams. To be able to fly a multirotor, it is necessary to calculate the numerical force (F lift). Using the Equation (3). If the total mass is 915, then ( ) = 915 / (2) 5240 x 100% = 17.46%. In conclusion, the multirotor can fly (hover) with 17.46% of the total thrust. F = total mass / F total x 100%

F. Quadcopter Kinematics with "+" Model
In the manufacture of this mechanic, the quadcopter used is the frame quadcopter f450, along with the quadcopter design used, shown in Figure 7. Quadcopter kinematics is divided into four parts: hovering, rolling, pitching, and yawing, where the kinematic reading results will be seen from the response of the moving motor. In figure 8, the test is done by changing the position of the stick on the Remote Control so that the speed of the brushless motor will change according to the input value.  Table II, this test aims to obtain information about the Brushless DC Motor (BLDC) response when there is a change in the remote control. The Table III, the result of the test is that the brushless motor rotates following the input value from the Remote Control which has been carried out by the previous kinematic process, the difference in the value of the speed data from the remote (PWM) results in changes as shown in the quadcopter kinematic table. For yaw or turning to the right, motor two and motor four are faster because the direction of rotation of the motor rotates clockwise. Then, and vice versa, when it rotates to the left, motor 1 and motor three are faster because the direction of rotation rotates counterclockwise.  Table IV, this test aims to obtain information about the motor's response when there is a change in the IMU gy25 sensor to maintain a balanced condition when flying. The response of the PID quadcopter control is divided into three parts, namely roll, pitch, and yaw. The test is carried out by changing the position of the quadcopter at the roll, pitch, and yaw angles so that the speed of the brushless motor will change when the IMU position is not at the specified setpoint. The result of the test is that the brushless motor rotates following changes in the value of the IMU sensor, where when the quadcopter is not at the specified setpoint conditions at each angle, the brushless motor will rotate to maintain a balanced condition.

C. Test Flight
In figure 9, this flight test aims to obtain information about the control system design that has been made whether it is (3) Flight Controller working well, namely the control system can maintain the balance of the quadcopter by giving natural interference.  The test is carried out when the quadcopter is flown freely outdoors with changes when the throttle is raised (hovering) without any balance assistance from the remote control. Figure 11. Quadcopter test flight using PID control In this test, it was found that the quadcopter can do hovering quite well with a throttle value of 50%, in Figure 11 provides information about the response of the PID control system while flying. These results are obtained from the IMU sensor value data by means of when the quadcopter has been run with a thrust request of approximately 1500us. The control system on the quadcopter tries to reduce the error so that it can be 0 degrees to the setpoint, with the parameter value of the control system kp = 2.5, ki = 0.6, kd = 1.0, a response time of 3s is obtained. to maintain the longitude and latitude positions the quadcopter must be assisted by using a remote control.

IV. CONCLUSION
The design of the flight controller with balance control using PID control according to the system diagram as shown in Figure 4, the control system is used properly. This control system is proven to drive a Brushless DC Motor (BLDC) when the quadcopter is flying. The quadcopter can hover properly in about 3 seconds to return to the setpoint without the help of remote control. With PID parameters for KP value of 2.5, KI of 0.6, and KD of 1.0, it can beat Quadcopter with a response time of 3s. In the future, we want to build a quadcopter accompanied by monitoring sensors and communication from the ground control station.