Print
Category: Projects
Hits: 6746

 

Author:  Edgar Rodrigo Mancipe Toloza

 

Downloadables: 

 

ABSTRACT: The main objective of this paper is to present the steps of how to program a PID controller in a FPGA, and in that way to control a DC motor using Pulse Width Modulation. Also we want to give some ideas to people interested in program embedded controllers in hardware.

During the project we will use some tools to help us to visualize the behavior of the controller on the computer screen through rs232 communication and LabView chart to plot, and LCD display for visualize the Set Point, gains and the current value.

 

KEYWORDS: PID, Control, FPGA, DE0-Nano, Embedded.

 

INTRODUCTION

 

Nowadays FPGA's have increased their popularity due the many ways to acquire it, reliability, and low costs. As a consequence of that, we can see more FPGA's applications in control systems.

For many years, microcontrollers used to be on the top of this field due their low-cost, but through years FPGA's have turned into a striking option, thanks to its main property of controlling many systems in parallel in the same embedded system.[1]. 

In this project we want to show in a quick way, how to program a PID control in FPGA using Verilog language, also we will change the values of Gain variables to see the behavior of the controlled value.

This article is not intended to give a definitive PID algorithm, the intention is to introduce and give some ideas for the readers of how to create and implement their own PID equation embedded in FPGA.

 

 MATERIALS 

This section will show the name of the main objects used in the analog and digital interface of the project for signal conditioning and power circuit.

 

BLOCK  DIAGRAM OF THE CONTROLLER

Before start to program the FPGA, is necessary defining a strategy through a block diagram. In the Figure 6, we can see that the Set Point is selected using a Dip- switch and the feedback signal is coming from the quadrature encoder coupled to the DC motor. The error is the difference between Set Point and feedback (Encoder), and the error sign defines the rotation of the motor through the H Bridge. A Pulse Width Modulation (PWM) is the output signal of the PID algorithm that will change its Duty Cycle depending of the controller result.

 

Figure 6 Block Diagram of the controller.

 

PROGRAMMING

Once defined the strategy for the controller, we proceed to program the algorithm in HDL Verilog, using Quartus II. In this case we divided the entire Project in different sub-modules that will allow us to interpret and design in modular way, so that is going to be an advantage at the moment of write and understand the program lines

 

 

IMPLEMENTATION

On this stage we will present a test of the algorithm performance using labview and RS232 communication to send the data to the pc. Due that the importance of this document it's to present the controller, we are not going to focus in the RS232 algorithm that is also embedded in the FPGA. Another document will present the steps of how to use and program a serial-USB converter FT232.

 

Now we decrease Kp to 5 again, but this time Kp have a different value than 0. In figure 19 we can see that the response tents to reach the set point value slowly but with a small amount of overshoot (less than 5%).

Figure 19. Response of test 3.

 

Increasing the Kp value will make the response faster, but also will increase the overshoot, as shown in figure 20.

Figure 20. Response of test 4.

In this case we can see that increasing the Ki value to high, will make oscillate the system before stabilize, figure 21 is the result of the test 5.

Figure 21. Response of test 5.

ASSEMBLY IMAGES

 

Figure 22. Complete project.

 

LCD with Current Variable, Set-Point, Proportional Gain, Integral Gain and Derivative Gain values.

 

Figure 24. Serial-USB converter.

 

CONCLUSION

 

In this project we saw that is viable the implementation of a PID controller in a FPGA, and the modular design allow us to think and solve one problem at once. Trough the test made to the controller we manage to saw the behavior of the controlled variable when we change the values of the proportional an integral gains, as we saw, the proportional gain will give more speed to the controller but it also can increase the overshoot percent, in other way the integral gain can give a more accurate response getting closer to the set-point. There were also a test changing the derivative gain, however the response was always saturated because of the noise derived, so still pending the implementation of an additional filter to solve this problem

 

VIDEO DEMOSTRATION

 

REFERENCES