PhD, lecturer, Le Quy Don technical university, Vietnam, Hanoi
BUILDING FPGA-BASED DIGITAL PID CONTROLLER ON EMBEDDED COMPUTER NI-MYRIO 1900 FOR DC MOTOR SPEED CONTROLLING
ABSTRACT
The aim of this paper is to implement a digital PID controller on the FPGA chip of the embedded computer NI-myRIO 1900 for controlling the speed of a DC motor.
The proposed method of implementing the digital PID controller on the FPGA allows parallel processing of the command lines, which speeds up controller saturation, while narrowing overshoots to ensure the system works more stable, consequently the stability of the system is ensured. The research results in the article will be an important basis for research and development of mobile robot models for real-time military applications.
АННОТАЦИЯ
Целью данной статьи является реализация цифрового ПИД-регулятора с использованием FPGA на встроенном компьютере NI-myRIO 1900 для управления скоростью двигателя постоянного тока
Предложенный метод реализации цифрового ПИД-регулятора на ПЛИС позволяет выполнять параллельную обработку командных строк, что ускоряет насыщение контроллера, а также сужает выбросы для обеспечения более стабильной работы системы, следовательно, обеспечивается устойчивость системы. Результаты исследования в статье могут быть важной основой для исследований и разработки моделей мобильных роботов для военных приложений в реальном времени.
Keywords: FPGA, NI-MyRIO 1900, digital PID controller, DC motor.
Ключевые слова: FPGA, NI-MyRIO 1900, цифровой ПИД регулятор, двигатель постоянного тока.
1. Introduction
FPGA (Field Programmable Gate Array) is a digital electronic technology that allows users: to design and describe digital logic circuits, to perform functions such as signal processing, logic control, and communication. FPGAs are designed to replace integrated circuits (ASICs) and electronic control boards, increase information processing speed, reduce component size, and lower costs. FPGA has a network of programmable logic gates and storage arranged on a single chip. By using design tools, users can program FPGAs to create complex digital logic circuits, including counters, signal resolvers, image processors, and controllers.
In the field of mobile robot control, FPGAs are also used to build controllers. FPGAs have the ability to improve signal processing algorithms, and increase data processing speed. For example, FPGAs can be used to build controllers for robots, autonomous vehicles, and more. With the ability to flexibly combine with microprocessors in embedded computers, FPGAs increase the performance of mobile robots and improve the efficiency of PID controllers.
There are many universities, many organizations and individuals who have been researching and applying FPGA chip on embedded computers NI-myRIO 1900 for building controllers of mobile robots [4, 8, 5]. However, the results of these studies have not been fully published to have the most general overview of this implementation method [7, 2, 1, 9].
From the results of the evaluation of the research situation in the world, the authors propose to research, apply the FPGA chip on the embedded computer NI-myRIO 1900 to control the speed of the DC motor, in order to verify the ability to implement digital PID controller on FPGA. From there, the authors evaluated the possibility of using FPGA chips on embedded computers myRIO 1900 to build controllers for mobile robots in general.
The remainder of this paper is organized as follows: Section II presents the hardware system connection diagram of the DC motor model. Section III presents the PID algorithm. Then, design of digital PID controller for DC motor using FPGA chip on the embedded computer NI-myRIO 1900 is presented in section IV. Finally, conclusions and some future work proposals in section V wrap up the paper.
2. System hardware description
The DC motor used in this paper is 24V DC motor and is controlled by IBT-2 [3]. In addition, it is also equipped with a relative encoder sensor of 400 pulses/rev to receive motor speed feedback.
The block diagram of the hardware control system is shown in Figure 2.2. The center of the control system is the embedded computer NI-myRIO 1900, which communicates with the LabVIEW myRIO Toolkit software on the user's computer via WIFI. The required velocities cand be sent to NI-myRIO 1900 by the using the user interface on user's computer. After receiving the set speed value, the NI-myRIO 1900 will calculate the control signal and send it to the IBT-2 motor controller for controlling the actuator.
Figure 2.1. Model of DC motor with encoder
Figure 2.2. Hardware control system diagram
The NI-myRIO 1900 embedded computer has a built-in Xilinx chip Zynq-7010 FPGA and a processor ARM Cortex-A9 667 MHz that communicates with each other through the standard FPGA Interface (Figure 2.3). Therefore data be exchanged easily between the FPGA chip and the processor ARM Cortex-A9. In addition, myRIO 1900 also integrates communication ports such as USB, Ethernet, WiFi and Bluetooth, allowing connection to peripheral devices and information networks [6].
Figure 2.3. Internal structure of the embedded computer NI-myRIO 1900
The NI-myRIO 1900 also includes built-in software tools for programming and designing applications, such as LabVIEW and LabVIEW myRIO Toolkit. This makes it possible for users to quickly and easily create complex electronic and control applications.
3. PID algorithm
The mathematical formula of the PID controller is given in the standard form as follows:
(1) |
where:
u(t) is the control variable (controller output);
e(t) = r y is the error;
r is the set value (desired value);
y is the output of the process (output variable);
Kc is the scaling factor;
Ti integral time;
Td differential time.
To control the speed of a DC motor, a feedback PID controller is often used thanks to its simplicity and efficiency. This type of PID controller compares the feedback signal with the set signal to serve as a basis for correcting the output value (Figure 3.1).
Figure 3.1. Feedback control with PID controller
As shown in Figure 3.1, the input of the PID controller is the error calculated by the difference of the set speed value and the instantaneous speed of the motor, and the output is used to control the DC motor.
In the following, the authors will show how to implement a digital PID controller on the FPGA chip of the embedded computer NI-myRIO 1900 to control the speed of a DC motor. For describing the logics in the FPGA, one often uses hardware programming languages like Verilog, VHDL, etc. These languages provide parallel processing of logical streams, which increase information processing. However, these languages are fundamentally difficult to learn and have little support for available libraries.
Currently, there are many software that support automatic translation from software description language to hardware description language such as LabVIEW myRIO Toolkit, so users can describe algorithms in software language, then those logics will be automatically compiled into hardware description language by the compiler and loaded into the FPGA chip.
4. Design of digital PID controller for DC motor using FPGA chip on the embedded computer NI-myRIO 1900
The problem of speed control of actuator motor includes of 3 subproblems: data collection from encoder sensor, design of PID controller, control of actuator motor. The block diagram of the motor speed control program is shown in Figure 4.1.
Figure 4.1. Control diagram of a DC motor with encoder
Realizing the diagram in Figure 4.1 on LabVIEW myRIO Toolkit software, we get the program myRIO Custom FPGA Project to control the speed of DC motor as shown in Figure 4.2. The two signal wires A and B of the encoder are connected to pins 18 and 22 at port A of myRIO 1900 to count the return pulses. The PWM signal is sent to pin 27 of port A to connect to the driver IBT-2 to control the DC motor.
Figure 4.2. LabVIEW myRIO Toolkit program to control speed of DC motor
After loading the above program into the FPGA chip on myRIO 1900, we obtain the speed control results of the DC motor (Figures 4.3 and 4.4). The set speed value can be changed via the set point slider. The PID parameter set (Kc=0.01, Ti=0.02, Td=0) is calculated based on the experimental method Ziegler - Nichols. In addition, the user interface also displays the motor's speed response line, making it easy to monitor the instantaneous speed change of the motor when changing the set point speed value.
Based on the results in Figure 4.4, we can see that the DC motor speed is relatively good according to the set speed with small transient time, small overshoot. In addition, to increase the quality of the PID controller, we can use PID parameter setting methods such as: Ziegler - Nichols, Cohen-Coon, relay feedback, etc. to achieve better tuning quality.
The results in Figure 4.4 show that it is possible to use the FPGA chip on the embedded computer NI-myRIO 1900 to build a controller for a mobile robot.
Figure 4.3. User interactive interface (GUI)
Figure 4.4. Graph of DC motor speed response
5. Conclusion
In the content of this paper, the authors research and use FPGA chip on embedded computer NI-myRIO 1900 to build a digital PID controller for the speed control problem of DC motor. The proposed control algorithms have been tested for correctness and evaluated for superiority by controlling the DC motor model in reality.
The implementation of the digital PID controller algorithm on the FPGA chip of the embedded computer NI-myRIO 1900 can provide some advantages but also some limitations. Below is a detailed evaluation and analysis of the advantages and limitations of PID controllers using FPGA technology on mobile robots:
Advantage:
- Faster and more efficient processing speed: Using FPGA allows PID controller to operate faster than using microprocessor.
- High accuracy: With FPGA, the PID controller can achieve higher accuracy in calculation, consequently improving the controllability of the robot.
- Flexibility and ease of change: FPGA allows to change the control program without changing the hardware. This provides flexibility and ease in adjusting control parameters.
- High stability and reliability: The FPGA has self-protection feature, which ensures that the PID controller will always operate stably and reliably, even if something goes wrong.
- Ability to integrate other functions: FPGAs can be used to integrate other functions such as encoders and sensor controllers, making the robot more efficient.
Limit:
- Expensive: the NI-myRIO 1900 embedded computer costs more than microprocessors, thus increasing the cost of developing robotic projects.
- Difficult to program: FPGA requires high programming skills and is more complex than conventional microprocessors.
Compared with previous studies, the author uses FPGA technology to build a controller for a DC motor at a more complete level, and at the same time gives an assessment and comment on how to do this. test this controller on FPGA. The research results in the content of the article will be an important basis for research and development of mobile robot models for military applications that require real-time combat control.
References:
- Chokri Abdelmoula, Fakher Chaari, Mohamed Masmoudi. Real time algorithm implemented in Altera's FPGA for a newly designed mobile robot: Autonomous navigation and parallel parking // Multidiscipline Modeling in Materials and Structures. 6/2014.
- Hsu-Chih Huang. Intelligent motion control for four-wheeled holonomic mobile robots using FPGA-based artificial immune system algorithm // Advances in Mechanical Engineering. 2013.
- IBT-2 datasheet / [Электронный ресурс]. - Режим доступа: URL: http://www.hessmer.org/blog/2013/12/28/ibt-2-h-bridge-with-arduino/ (дата обращения: 19.01.2023).
- Jr-Hung Gui, Bo-Jun Yang, Kuo-Lan Su. Development of the myRIO Based Mobile Platform // Proceedings of International Conference on Artificial Life and Robotics. 01/2019. №.24. P.112-115. DOI:10.5954/ICAROB.2019.OS4-2.
- Mohammed Alawad, Sinan M.B. Ismael. LabVIEW FPGA implementation of a PID controller for D.C. motor speed control // Iraq J. Electrical and Electronic Engineering. 01/2011. Vol.6. №.2. P.98-107.
- NI-myRIO 1900 datasheet / [Электронный ресурс]. - Режим доступа: URL: https://www.ni.com/en-vn/support/model.myrio-1900.html (дата обращения: 19.01.2023).
- Rajesh Nema, Rajeev Thakur, Ruchi Gupta. Design & Implementation of FPGA Based On PID Controller // International Journal of Inventive Engineering and Sciences (IJIES). 2013. Vol. 1. №.2. P.23-34.
- Ronaldo do Amaral Oliveira, Marco Antonio de Souza Leite Cuadros, César XavierCarlos Torturella Valadão. PI controller implementation for the two wheels of a differential robot using NI myRIO // Research Society and Development. 01/2022. DOI: 10.33448/rsd-v11i2.25857.
- Sandipan Pine. Controlling a Wheeled Robot through Field Programmable Gate Array // International Journal of Engineering, Science and Mathematics. 12/2017. Vol. 6. №8. P. 57-69.