Field‐programmable gate array‐based laboratory oriented to control theory courses

This article presents a methodology to improve the performance of learning of students in the major of Automation Engineering, through the development of a multidisciplinary project that involves the use of contemporary technological tools and knowledge of previous subjects. It is sought to add in their educational training, theory and practice for the student, learning, new knowledge, and skills within their training as an engineer. Despite advances in teaching methods and the inclusion of contemporary tools in the learning process, the success rate is low. A qualitative and quantitative analysis of student learning is made by integrating a multidisciplinary project based on contemporary tools compared with other reviewed works. This laboratory based on a field‐programmable gate array helps the student to acquire skills related to the implementation of reconfigurable logic and instrumentation applied to control theory. The development of the final project involves the design of a graphic user interface, hardware description, communication protocols, and implementation of motion control, it is looking for is that the student can relate theory to practice in order to motivate and increase skills and knowledge, as well as solving both didactic and industrial problems. The results obtained show that the students are satisfied with the course and that the experience with the integration of this type of multidisciplinary projects directly impacts the motivation and learning of the student, considerably increased developed based on the specific indicators that the Querétaro State University has accredited by Accreditation Board for Engineering and Technology since 2016.

Information technology and new technological developments provide new ways to transmit knowledge to the students of this technological age. Teaching methods are the main component of the educational process because they favor the scientific conception of the world and the assimilation of the student's knowledge. They have been used since the origin of education to the present, and have evolved with scientific and technological advances [9].
The method of "problem-based learning" proposes to students a problem be solved and to learn more about it, through group work or independent study. With this strategy, learning is proactive and helps develop autonomy and responsibility. In the method of "project-based learning," students define the purpose of the creation of a final product, investigate the subject, create a plan for project management, and design and produce a product [6,15,18,29].
On the other hand, Piaget and Vygotsky also established that the practice facilitates the learning process and the lived experiences because it allows the individual to relate the new knowledge with the previous one [4,17,35]. The trend is also directed to carry out these projects in an interdisciplinary way, with the collaboration of other dependencies or engineering departments [11].
Teaching methods apply norms or criteria for evaluation, with the purpose of verifying the abilities of the students for their professional formation: one of them is Accreditation Board for Engineering and Technology (ABET) [14,16,19,32,36]. Prototypes have been created to develop in the students the skills of design, mathematics, and logical reasoning, as in [3,12,20,26,30]. Although the prototypes are good in the technological area, they do not analyze the final skills (student outcomes) that the students acquire.
The demand for specialized engineers in the area of automation has grown in the labor market. For that reason, it is necessary to integrate theory and practice in educational training, so that students can acquire new knowledge and training of new skills can encourage students to participate in multidisciplinary project presentations or prototype development. The use of didactic platforms in automation tends to reduce this setback, offering a closer contact to the student with the practice routines that will be found in the future [5,34].
From a pedagogical point of view, the simulation of physical and mathematical models and the design of prototypes has become the core of teaching methodologies, because they let the students develop a better theory comprehension and the application of diverse areas like control systems. Therefore, laboratory courses help students increase their practical skills [7,8,27].
Signal processing and digital control have several advantages over the analog processing and control; a consequence of this fact is the transfer of analog processing and control to the digital domain [27]. The signal processing functions offer an intelligent approach to reduce the total cost of the motion controllers and a less amount of hardware circuits for filtering. For this reason, currently, embedded systems are a fundamental part of industrial devices, medics, commercial, and so forth [8,26,31].
A few courses such as Programming, Electrical machines, Power electronics, Control theory, and Digital systems used special devices, such as microcontrollers, digital signal processors (DSPs), and field-programmable gate array (FPGA). The use of the FPGA in the digital design of embedded systems represents a versatile alternative-they are relatively easy to program and even affordable [31]. One of the most important advantages of working with the FPGA is that one can run some processes parallelly.
VHSIC Hardware Description Language is a hardware description language widely occupied for modeling and designing processing and control systems. On the other hand, LabVIEW is a software for data acquisition and signal processing used extensively in the industry due to its graphics programming environment [37].
For instance, the experimental platform used in [13,26,31] was developed using an FPGA, getting as a result modular and open-source adaptive digital systems courses. The proposal made in [22,27,37] aimed at using the LabVIEW environment as a practical topic for virtual instrumentation, digital communication, temperature control, servo control, filter design, and simulation. However, in [37], the acquisition is obtained through a NI-DAQ expensive board. In [33] the parameter identification of a motor was performed, and a proportional derivative velocity controller was implemented in MA-TLAB using a microcontroller ATmega 2560, leaving the theoretical analysis aside and focusing on the practical aspect. Whereas, in [1,27,28], a control system was presented using a DSP from the Texas Instrument family and an environment for remote monitoring through LabVIEW. Therefore, this platform presents an excessive cost for the students.
Currently, at the Faculty of Engineering of the Querétaro State University, Mexico, in courses such as Control systems and Microsystems of the fifth semester or in Digital systems with Reconfigurable Logic I (DSRL-I) of the sixth semester and DSRL-II of seventh semester, it is required that the students design a functional prototype in order to accredit the subjects mentioned before.
An FPGA Spartan-6 XC6SLX9 from the family XILINX was used for this article, as well as for data acquisition and tuning of the control signal. Furthermore, a graphic user interface (GUI) was developed in the LabVIEW where the controller is executed, and the direct current (DC) motor identification is obtained. It is possible to modify and tune the controller gains and get the root locus of the system, reaching an efficient view of the performance in real-world applications. Also, it is possible to access it remotely throughout a web page. So, the system can be considered as not expensive and reconfigured for future applications. Nevertheless, the article considers that students should start from the basic understanding of programming, digital design and response time systems, whereby, the use of reconfigurable hardware and software has helped students to experiment the theory in the learning process. Therefore, this project can be carried out in teams of four students, and each of them is responsible for different tasks.
The paper has been divided as follows: Section 1 presents the introduction of the paper. Section 2 deals with the control platform description based on FPGA. Section 3 depicts the practical sequence carried out. Sections 4 shows the qualitative and quantitative evaluation from the pedagogical point of view of including the control platform in DSLR-I course. Finally, Section 5 displays the conclusions obtained.

| METHODOLOGY
This paper aims to improve the performance of theory and practice from an academic view in students registered at the Department of Engineering of the Querétaro State University, throughout a multidisciplinary project, where students have to develop their skills to solve problems applying their practical and theoretical knowledge, contemporary technological tools, and software and hardware programming. The proposed model of this work consists of a position controller for a DC motor, which uses an FPGA for signal acquisition, and a communication protocol linked to a GUI developed in LabVIEW. Figure 1 depicts a graphical description of the proposed platform, which will be described in the next sections. Five practices were planned to fulfill the objectives of this project. Besides, Table 1 displays the distribution of 51 hr of theory and 34 hr of practice according to the DSRL-I course. It should be noted that the students at the automation and mechatronics labs have access to the required material such as power sources, FPGAs, DC motors and oscilloscopes to carry out the required practices. 1. Hardware description The student will perform the UART and PWM modules, the encoder driver and finally the finite state machine for the system synchronization and the sampling time. 18 2. GUI The student will develop a GUI for monitoring, control, and identification of the motor, as well as the web monitoring. 3. Identification of DC motor parameters The students will use the GUI and the modules described in the FPGA; they will identify the parameters needed with the theory seen in the previous classes. Finally, the student will use the GUI and the described modules in the FPGA to implement a PID controller with the knowledge acquired during the course.
communication with the FPGA to receive the position of the encoder and return the control signal that is applied to the motor, calculate the PID controller, and show in real time the graphs of the system's variances to evaluate its performance. It also has the option to run through a web page in Internet Explorer. The aim of this stage is to make the student apply previous knowledge for system identification and digital control in order to implement the least square method (LSM) by system identification and tune the controllers used for industrial purposes by applying the root locus technique. Furthermore, the internet of things concept was implemented to communicate the interface with a web page remotely. Figure 7 shows the frontal panel of the GUI. The acquisition stage has four modules of operation. The first one is the encoder reading. This module decodes the quadrature signal to PPR, which is monitored every 20 ns. The second is the universal asynchronous receiver-transmitter (UART) protocol. This sends PPR to the GUI and receives the control signal to apply to the DC motor. The pulse width modulation (PWM) module supplies the control signal to the power stage. Finally, a finite state machine oversees the synchronization of all modules mentioned before, ensuring a sample time of 5 ms.

| A dynamic model of DC motor
The dynamic model of a DC motor depends on electrical and mechanical characteristics, as resistance R, inductance L, and inertia J of armature, the counter-electromotive force e t ( ) a , and the friction B. Once mentioned the above characteristics, it is considered Figure 2 in order to obtain the mathematical model, where u t ( ) c is the applied voltage to the armature terminals, i t ( ) is the current of the armature, θ t ( ) is the angular position of the shaft, e t ( ) a is the counter-electromotive force, τ t ( ) is the torque generated, k b and k m are the constants of the counterelectromotive force and the torque, respectively [10].
Applying the Laplace transform to Equations (1)-(4) and solving these transfer functions, the block diagram of Figure 3 is obtained.  Figure 3 is determined by Equation (5).
A proportional controller (see Figure 4) is applied to perform the identification of the plant where s Θ ( ) d is the desired position, s Θ( ) is the angular position of the shaft, and k p is the proportional gain of the controller. The C k and C p can be calculated from Equations (6) and (7).
The TOP module of acquisition stage implemented in field-programmable gate array The model of the DC motor has a response of a second-order system, where ω n is the undamped frequency, ζ is the damping factor of the system, t r is the rise time and M (%) p the over step [10].

| Identification of systems using LSM
The LSM is one of the basic approaches and most used methods in the theory and practice of process identification.
where PT and z[k] are the vectors of the parameters and of the measurements, respectively.
The discrete model defined in Equation (11)  can be associated to the noise presented in the system. Equation (14), the persistent excitation condition, guarantees that the matrix Z t ( ) is full range and ensures that the estimation of model parameters by LSM is statistically consistent [2].

| PID controller
The PID controller is the most widely used control strategy in an industrial process, because of its remarkable effectiveness, simplicity of implementation and broad applicability [10,23,33]. Often, in practice, an experienced operator carries out the tuning through a "trial and error" procedure and some practical rules; this is usually a difficult and time-consuming activity. The PID controller plays an important role in controlling the system performance by minimizing the error and provides better system functional stability. The block diagram of the PID controller is shown in Figure 5. Below is presented the Equation of a PID controller (15) in continuous time [10].
where k p is the proportional gain, k i is the integral gain, k d is the derivative gain, e t ( ) is the error, and i t ( ) d is the control signal.
Using the Euler method backward, the discretization of the PID controller ( (16)

| PRACTICAL SEQUENCE
The GUI computes the control parameters and returns the control signal to the FPGA. The control signal is sent to the motor in the form of PWM signal; this signal does not present enough power to move the shaft of the motor so that it is necessary to send it to a power stage. The data from the encoder were read through a core developed in the FPGA. The FPGA measures the shaft position throughout an incremental encoder with a resolution of 1,024 PPR represented by a quadrature signal, which is monitored every 20 ns, and is stored in a register every 5 ms to send the data directly to the interface using UART communication. On the other hand, the communication between the FPGA and LabVIEW was made by a UART module that was embedded in the FPGA. The data are sent in a package of 8 bits. The encoder counts have a width of 16 bits, and the transmission speed is 9,600 bauds. The FPGA receives a control signal, with a length of one byte. The PWM module implemented in the FPGA was designed for a working frequency of 2 kHz. This core has an input parameter regarding the signal percentage, which is received by the FPGA through the UART module. The aim of the practical sessions designed is for students to get practical experience and knowledge of the principles of control of servo systems and related topics such as FPGA programming, motors management, communication protocols, graphical interfaces, and so forth. The laboratory activities were ordered as mentioned in Table 1 in the following subsections.

| Practical 1: Hardware description
Objective: To develop the modules required for the acquisition and management of the control signal. From the sequential logic, three modules are designed capable of measuring the quadrature signal of the encoder, another with a UART protocol implementation, and finally the PWM core. Finally, it is necessary to develop a state machine and a time base capable of synchronizing all the described modules and generating sample time, as shown in Figure 6. The UART protocol sends the PPR of the encoder and receives the control signal. Where DATA Tx _ is the data to send, compounded by 8 bits; for this case, the encoder counts have a bandwidth of 16 bits. Rx and Tx are the communication lines. It is important to configure the same speed at 9,600 bauds in the GUI. DATA Rx _ is a buffer where the control signal is received, eo Tx _ and eo Rx _ are flags that indicate the end of transmission and reception of 1 byte, respectively. The PWM module supplies the control signal to the power stage. Finally, a finite state machine oversees the synchronization of all modules mentioned before, ensuring a sampling time of 5 ms. The PWM module implemented in the FPGA was designed for a working frequency of 2 kHz. This core has as input parameterthe percentage of the signal (0-100%), which is received by the FPGA through the UART module, a start bit controlled by a state machine and PWM signal as output is sent to the H bridge to be applied to the motor. A good practice, as a check of the operation of the acquisition system, is to perform debugging. Table 2 shows the resources of FPGA used to develop the project.

| Practical 2: Graphical user interface
Objective: To develop a GUI that allows communication with the FPGA and perform the identification and control of a DC motor. The student starts from a GUI template, which only contains the writing and reading of the serial port and can be downloaded from [24], data conversion and PID controller execution according to Equation (16) as is shown in Figure 7. The student has to implement the LSM using Equations (12)- (14). Finally, it is necessary to configure the GUI in order to execute it throughout a web page. The flowchart of behavior and subtask of GUI is shown in Figure 8. The control system can be divided into subtasks that operate on different upgraded speed depending on the selected application. The GUI executes the process in real-time. Nevertheless, the identification and tuning of the controller can be set it to slower speeds.

| Practical 3: Identification of DC motor parameters
Objective: To make the parameters identification of the DC motor. A setpoint of radians and a gain k p = 1.64 was applied to determine the parameter of the plant under the scheme of proportional control, and a source of 12 V was applied to the terminals. The k p gain is selected in such a way that it is not too large to saturate the system. The response of the DC motor is shown in Figure 9. The results are M (%) p = 34.52% and the time in which the reference is reached for the first time at t r = 0.044 s. With the above data, the damping factor ζ and the underdamped frequency ω n are calculated from the Equations (8)- (10). Finally C k and C p can be calculated using Equations (6) and (7). The parameters obtained are C k = 1,264 and C = 29.2 p .
Using the LSM method with a voltage input of 90% and the angular velocity as output, the following vector P T was obtained P = [0 0.96 1.22] T . Making the discretization of the model of the DC motor with parameters found using a zero-order retainer, the following transfer function was obtained in the z domain The variations that occur are due to the nonlinearities of the motor; however, the values found are not so dispersed.  Objective: To find gains in the PID controller of position through the root locus method. The tuning of the PID controller has been done using the root locus technique. Also, the model of the plant obtained previously was introduced-two zeros and an integer, which are generated with the transfer function of the PID controller. These zeros move until finding the desired response. As shown in Figure 10

| Practical 5: Implementation of a PID position controller
Objective: To implement a PID controller and to verify the performance and response of the system. The PID controller was implemented according to Equation (16) with a sample time of 5 ms, and it was configured with three different setpoints, π 2 , π − 2 , and 0 radians with a length of 2 s, to test its performance. Figure 11a shows the setpoint, using a red line, that the system must achieve. A blue line represents the angular position of the shaft of the DC motor. The controller must be able to reach the setpoint in less than 400 ms with an overshoot no greater than 23%. Figure 11a displays the error and the control signal using black and red lines, respectively. The error in steady-state is zero, and the effort of the control signal acts correctly; it means, it has a large magnitude when the position presents the overshoot and for the rest of time, it keeps decreasing to zero till the setpoint has been reached. The results obtained prove the functionality of the controller and it can be applied to other systems.

| PROJECT EVALUATION
The Automation Engineering program at the Querétaro State University has had ABET accreditation since 2016, which helps improve the quality of technical and science education in the area. The control platform was introduced in the period 2017-II, in the course of DSRL of the fifth semester. In previous courses, students have already taken topics of Electrical Systems design, Electrical machines, Automatic control, Dynamics and statics, which means that students have the knowledge to work with motors, drivers, communication protocols, controllers, and circuits. The control platform allows reaching ABET criteria for student outcomes, such as the ability to design a system or process to satisfy the desired needs within realistic constraints and the ability to work in multidisciplinary teams.
The criteria were based on the rubric of evaluation, examining the abilities of the students to summarize the particular factors of an issue to propose simple solutions, document integrated solutions in engineering language, detect the knowledge that builds the answer, have another perspective to integrate other disciplines and play a successful role in teamwork. In addition to the official evaluation for the course, anonymous student polls were conducted at the end of the semester to determine if the learning outcomes were successful; the applied survey is shown in Table  3 where 5-S; the survey can also be found in [25]. A is Strongly agree; 4-A is Agree; 3-N is Neutral; 2-D is Disagree, and 1-SD is Strongly disagree. The criteria of the abilities to be evaluated in the project are presented in Table 4, similar to related works presented in [7,8,27], for further evaluations according to the standards placed by ABET. Figure 12 shows the averages of the survey applied to 19 students enrolled in the course of DSLR-I of the semester 2017-II, observing that the average score obtained for each question is higher than 4, which indicates that the students present positive participation to the learning experience using the proposed control platform. The questions with higher averages are Q5, Q3, and Q1, indicating that students found a better performance when the project has a multidisciplinary, allowing the development of new software and hardware skills. The survey recommends the inclusion of this type of projects to benefit the experience of previous knowledge with practice. The DSLR-I course was evaluated using the following ponderation according to the syllabus of the course brought to the students at the beginning of the period and using the rubric designed to meet the ABET criteria, as shown in Table 4.
• 10% The ability to participate in a multidisciplinary team.
For the DSLR-I course, according to Table 4, the specific indicator A was assessed using the test results of a written exam. B and C were evaluated according to the ability and performance of the students to lead and develop experiments, and D was based on the students' programming skills. Finally, E was assessed based on the writing of the final laboratory report. For a quantitative analysis of the effect of the control platform on the DSRL-I course, an analysis of the student results for the last 2 years (2016-2018) was addressed. Table 5 shows the grades of specific indicators that were evaluated during these periods based on the criteria in Table 4. It is The response of direct current motor when the PID controller is applied. PID, proportional-integral-derivative

| CONCLUSIONS
This paper has presented the modeling and analysis of a DC motor using dynamic equations. The students had the challenge to design a prototype based on a printed circuit board and signal conditioning circuits during the course. Furthermore, an FPGA was used for data acquisition, communication, and control of the DC motor instead of using a manufactured data acquisition board. The prototype was designed to cover new technologies and to motivate the interest of students in researching digital system and control theory and solutions in engineering problems. The prototype has three important aims: (a) To meet the criteria for international certification; (b) to provide multidisciplinary knowledge; and (c) to merge industrial applications with technological education. The proposed architecture and modular development for the prototype have been implemented in an FPGA. The system designed can be adapted for the implementation of future control strategies, such as those previously proposed for more robust algorithms, which are adapted to control systems using reconfigurable hardware and even extrapolate them to systems with more than one input and one output. For this case, an algorithm has been used for parameter identification and position control of a DC motor, which can be easily adapted to other interfaces for communication and control of systems. The students learned about the modeling of a physical system (DC motor) and applied the LSM and root locus method to estimate the parameters of the motor and perform the tuning of the controller, respectively, using a combination between the software and hardware design. The performance of the students during the course was evaluated using a survey; besides, at the end of the scholar period, a functional system and a written report of a detailed analysis of the general aspects of the device are evaluated. Considering the student outcomes regarding ABET criteria, one can conclude that the prototype aids students to enhance their abilities to design systems; acquire desired skills within realistic constraints; and learn to work in multidisciplinary teams. Finally, it is emphasized the development of didactic resource adapted to the needs of the teaching at an accessible cost, resulting in capable to be easily replicated and applied in other institutions.