Brushless DC Motor Control on Arduino Platform

The Brushless DC (BLDC) motors are often used in many situations in many sectors. These motors are widely used in the application of the Unmanned Aerial Vehicles (AUV). However, BLDC motors need to be controlled by the external system to ensure flawless and reliable function. Using the Electronic speed control (ESC) for the brushless motor, every motor can be controlled by any platforms such as Arduino. The Arduino platform was selected due to its simplicity, availability at the market and the cost-effectiveness. The aim of this research is designing the motor control for the BLDC motor on the Arduino platform. The designed system should be used by the UAV using propellers. This paper also includes the software implementation for the motor control. An implementation is developed to study the performance of the system for wide range speed control and power quality improvement. Streszczenie. W artykule opisano zdalne sterowanie bezszczotkowym silniekiem DC w zastosowanou do dronów. Wykorzystano platformę Arduno i system ESC – electronik speed control.Przedstawiono oprogramowanie I badania przy różnych warunkach pracy. Sterowanie bezszczotkowym silniem DC z wykorzystaniem [latformy Arduno


Introduction
In many industrial applications such as blowers, vacuum pumps, and centrifugal compressors, a high-speed brushless DC (BLDC) motor has become a major area of interest due to its high power density, small size, and low weight.It became popular even in the applications with the Unmanned Aerial Vehicle.The Author [2] said that for a high-speed BLDC motor, a simple and robust motor drive system with high energy efficiency and excellent operating performance is required.In a traditional BLDC motor drive, six discrete rotor position signals are needed and detected through three hall sensors.According to the author [4] the BLDC motor provides many advantages such as less consumption, small volume, good stability, larger torque and simple control.That is the reason why BLDC motors are mainly used in the UAV.
These motors can be divided into two types.First one is the out-runner.This type of motor has lower spinning speed, but it has far more torque.The typical speed for the out-runners is twice smaller than for in-runners.It means that in-runners usually using the gearbox for increasing the torque.The UAV need torque more speed, and the gearbox adds to the model more weight which is undesirable for all UAV.These are the reasons why UAV using out-runners instead of in-runners.These differences are also visible.The out-runner has the rotor as the casing of the whole motor.It means that the frame is moving and it is also more dangerous to the for nearby obstacles.
The rotor of the out-runner motor is composed of the powerful magnet, and the stator is composed of three windings which are shifted from each other by 120 degrees.These motors need a driver to control the switching polarity of the internal winding.The driver has the power part and control part.Power part consists of the power voltage and transistors that can control the current flow through the windings.As mentioned in [3] Three-phase switching signals based on Pulse Width Modulation (PWM) are required to drive six Virtual Switching Instance (SVI) switches the drive.
As authors [1] and [9] mentioned that the BLDC motors are the second variant of DC motors.Brushless motors provide electrical commutation with permanent magnet rotor and stator with a sequence of coils.A permanent magnet rotates and current carrying conductors are fixed in this type of motor.Transistors or rectifiers at the correct rotor position switch the armature coils in such a way that the armature field is in space quadrature with the rotor fields.According to the [2] the traditional BLDC motor drive, six discrete rotor position signals are needed and detected through three hall sensors.However, for a high-speed BLDC motor drive, traditional position sensors may degrade the rotor dynamic performance and increase the extra ventilation loss at highspeed rotation.For the UAVs, it is possible to use the BLDC without the hall sensors.With sensors, the motor can maximize the torque and control the phase angle to a high degree of precision and reduce the consumed power.The design of the common BLDC motor can be found in the following figure.
Fig. 1 The design of the BLDC motor [1] The power source for these motors used in the UAV applications usually provides the lithium-polymer (LiPo) battery.One cell of LiPo battery have typically 3,7 V. Brushless motors has working voltage is in the range between 10 V up to 14 V. Several cells of LiPo battery are connected to reach proper working voltage.The number of connected cells is indicated by the marker on the package using the S-symbol. • 4 cell -4S -14.8 V Most of the commercial made UAVs using the 3S or 4S.A higher combination is not used.The other parameter of the battery is the immediate charge which can the battery provide to the connected motor.This number is marked as C-symbol and is the maximal amount of current that can battery provide.The number depends on the voltage of the battery.The final amount of the possible current can be obtained by the multiplying of the C and voltage.
The configuration of the battery tells that battery has 11,1 V and the maximal output current is 1,6A x 20C which is 32 A. This current can be exceeded by less than 10 seconds without any damage of the battery.All mentioned parameters can be found in the documentation of every single brushless motor, and the designer should follow these recommendations to avoid any possible damage.

Electronic Speed Control for the BLDC motors
The Electronic Speed Control (ESC) circuit needs a microcontroller with PWM outputs and three power MOSFET half-bridge drivers to drive the three motor windings.The driver has two transistors each to drive a pin high, low, or not connected.Each driver has firmware with the function which can sense the motor's back EMF and eliminate the need for the hall sensor to generate the correct sequence and timing of the PWM output signals which generate a three-phase AC-like signal for the motor.The general schematic for the ESC can be found in the following figure.
Fig. 2 Three-phase based BLDC motor driver [6] According to the [8] the Q1 and Q4 are turned ON, and the current flows from the battery to the motor.During this switching the motor inductor stores energy and in the next cycle Q1 is turned off and, Q4 is still ON.The inductor releases its energy via Q4 and freewheeling diode of Q2.This operation is described for one state (60°).Similarly, there will be total six states (because one cycle is 360°).In the described state Q4 is always ON and Q1 is operated by PWM.
The input voltage of the driver is typically used for an ESC ranges from 7.4 V to 22.4 V, and the DC link current from the LiPo battery typically ranges from 10 A to 20 A. [6] The desired PWM frequency for ESC modules is between 30 kHz and 60 kHz because of the relatively low inductance of the high-speed motors and the potential interference to sensor boards.In an application with the higher safety requirements, there must be feedback in the form of the Hall sensors or so-called shunt resistor.Both techniques can determinate the current position of the rotor.

Hardware connection
The author [8] mentioned that the Arduino board designs use a variety of microprocessors and controllers.The boards are equipped with sets of digital and analogue input/output (I/O) pins that may be interfaced to various expansion boards and other circuits.The Arduino Uno was connected by the digital port 10 to the PWM port in the driver.Not all ports can establish the PWM function.The driver is also connected to the common ground with the Arduino.This information can be found in the datasheet of the ATmega328.All Arduino boards have communications interfaces such as Universal Serial Bus (USB) which is used for loading programs from the personal computers.
The motor is connected to the ESC driver by three wires in the counter-clockwise direction.The motor has three wires where each wire is for one wiring in the motor.The driver is powered by the Turnigy 3S 5000mAh 20C 11.1V LiPo battery.The motor MT1806 2300kv was used for this research.
The motor also needs to be connected firmly to the table or some heavy holder.The torque of the motor is huge, and the light motor should spin itself.The power line from the battery to the driver should also have the emergency switch in case of system failure.The Arduino board is connected to the computer via the USB to real-time operation.The board can also be powered by the battery using the voltage regulator.Also, another mainboard can be used for the controlling.For example, Arduino DUE which has more memory and much fast processor.The connection can be found in the following figure.

Software solution
The Arduino GUI has been chosen for the programming due to its simplicity and availability of all needed program libraries.The Arduino platform is one of many ways, how the final program can be uploaded to the Atmel chip.The Atmel Studio or other C/C++ based program can be used for the programming.The Arduino has several embedded libraries for the servo control.This library can also be used for the control the ESC.However; for purposes of this research, own program was created to demonstrate the BLDC motor control.
Every ESC is based on the PWM modulation which consists of short pulses.According to the [4] every ESC can proceed signal between the 200 and 2000 microseconds.The author [7] also mentioned that the average voltage obtained for various duty cycles is also mentioned and as the duty cycle percentage decreases average voltage also decreases from the supply voltage.Duty cycle is defined as the percentage of time the motor is ON.The practical function of the PWM module which is embedded into all Arduino mainboards can be found in the following figure.
Fig. 4 Arduino built-in PWM module [10] At the beginning of the program, it is necessary to include the servo library.The program starts with the maximal and minimal values of the throttle signal.These values can be saved in the command for using the class command.Recommended values are mentioned in the previous chapter.Implemented values can be found in the following figure.
Fig. 5 Creating the class of the servo library [10] In this case, the maximal value for the driver is 2000, and the minimal value for the driver is 1000 microsecond.However, this range can differ in the driver and, the program must be calibrated.The general calibration can be done using the following process: Powering up the ESC while the having maximum forward throttle is applied.The confirmation beep tone indicates that the ESC has measured the wavelength of the maximal throttle value.Repeating this process with the minimal throttle is applied.After it, the program is calibrated to the appropriate levels.The testing program is listed in the following figure.This procedure is very often used in controlling of the UAV.The program can be extended to the autonomous stability system which can be deflected by the incoming signal from the RC transmitter.

Conclusion
This paper shows the potential of the Arduino platform which is frequently used in many electrical applications.It recapitulates principle of BLDC motor functionality, and it also shows the principle of the ESC driver.The practical experiment proved that the BLDC motors could be driven by the Arduino platform.
The first experiment was done by the automatic increasing and decreasing of the speed where motor operates without any problems.The second experiment was done with the signal which was received from the RC transmitter.This pattern shows that Arduino platform can also be used for the controlling the UAV.The further research can be focused on the practical programming of the real model of the UAV which can be controlled by the Arduino platform.

Fig. 6
Fig. 6 Autonomous testing program for the UAV The final program automatically goes from 0% up to the 100% of the throttle signal.The range is given by the 180 degrees which are taken from the servo control.When the maximal speed of the motor is reached, the program goes automatically down.The final program is used only for the verification.

Fig. 7
Fig. 7 Testing program for the RC transmitterThe ESC is connected to receive inputs from the R/C transmitter, and it works as a servo.It just reads the throttle signal, and maps it from 0-1023 to 0-179 (analogue reading to servo "degrees") and then sends it to the ESC via the Servo library.Even in its extreme simplicity, this sketch it very useful to calibrate a new ESC to work with the Servo library of Arduino.This procedure is very often used in controlling of the UAV.The program can be extended to the autonomous stability system which can be deflected by the incoming signal from the RC transmitter.