Project-Based Learning Laboratory for Teaching Embedded Systems

This paper presents a project-based learning laboratory for the teaching of embedded systems. The main objectives are to encourage students studying the embedded systems course in developing hardware solutions for real engineering problems and to include aspects of other courses studied within the academic programmes. One of the aims of project-based learning (PRBL) is to integrate different courses in the achievement of a common objective, within a multidisciplinary course of the academic programme. In the present case, this module is the final project of the embedded systems course. The project in question concerns a temperature control system for an industrial drier, equipped with a remote system for configuration and data acquisition. The design of the drier, as well as elaboration of the entire electronic system involving drivers and sensors, was undertaken by the students using a kit with a microcontroller specific for the development of embedded systems. The results of opinion surveys conducted with the students following implementation of the PRBL proposal were used to validate the procedure. Full details of the development and results of the project are provided, with the aim of assisting professors and students of similar courses.


Introduction
The development of solutions for embedded systems (ES) is a strategic area of research in Brazil.New postgraduate programmes are being offered, and existing undergraduate programmes are updating courses in order to incorporate recent developments in the area of ES.Many of these courses are by nature interdisciplinary, since the development of embedded systems involves aspects of diverse areas including automation, robotics, and telecommunications, amongst others [1].For this reason, traditional learning techniques are often inappropriate for use in these courses of the postgraduate and undergraduate programmes [2][3][4][5].
Project-based learning (PRBL) is a pedagogical strategy of learning, where the students work on a complex project for an extended length of time leading to deeper knowledge about the subjects associated with the project.PRBL uses practical techniques to deliver a set of fundamental concepts that the student must be able to learn, understand, and apply in order to complete the project [1][2][3][4][6][7][8][9].The methodology employed in PRBL enables the student to visualize concepts, collect and interpret data, and connect theory with the real world.The set of competencies associated with PRBL provides an incentive for the student to learn.Several engineering courses already include PRBL in the curriculum, employing a variety of delivery strategies.A feature in common is the integration of one or more courses of the academic programme during the development of the project [1][2][3][4]10].The studies presented in [11][12][13][14][15][16][17][18] describe various methodologies for the application of PRBL in the teaching of ES.The results of opinion surveys conducted in these works demonstrated greater motivation of the students as well as qualitative improvements in learning.
The objective of this paper is therefore to present a PRBL proposal for a laboratory-based project designed to teach basic and more advanced concepts related to ES involving microcontrollers (uCs), employing a real control problem.The problem chosen is the development of an industrial drier.In order to solve the problem, groups of students are required to elaborate the design of the system, including an embedded  control system based on a previously established set of functional requirements.The ES implements a closed-loop system for temperature control and an open-loop system for control of the air flow.In addition to the concepts associated with the embedded systems course, the student is encouraged to develop the project using a variety of tools and techniques already studied in other related courses, emphasizing the interdisciplinary nature of the project.
This paper presents details of the proposed project, together with results obtained following its implementation within the Digital Systems course of the Computer Engineering programme of the Federal University of Rio Grande do Norte (Brazil).The results of student opinion surveys are also presented as a means of validating the proposal.
The work is divided into separate parts.Section 2 provides a description of the proposed project.Section 3 presents the modeling related to the project design, and Section 4 presents details of the embedded system.Implementation of the proposal by the students is described in Section 5, together with the results of questionnaire surveys.The conclusions of the work are provided in Section 6.

The Laboratory Project
Figure 1 provides a detailed schematic illustration of the proposed laboratory project.The industrial drier consists of a PVC tube of length  and internal diameter , coated internally with aluminum foil in order to improve heat transfer.The flow of air, at a rate () (in m 3 /s), is produced by a fan located within the tube, and the heat flow rate,  in () (in cal/s), is generated by a resistor,  1 , also fixed within the tube.As shown in Figure 1, the flow of air enters the system at a temperature of  in () and arrives at the end of the tube at a temperature of  out ().The heating process occurs by convection from resistor  1 [19][20][21].
The function of the embedded system is to control the temperature,  out (), and the air flow, (), at the output of the tube.The temperature control is performed by a closedloop system with a PID controller [19] that uses a temperature sensor,  1 , at the output of the tube to control the heat flow rate,  in ().Control of the air flow is performed using an open-loop system that acts on the fan speed.
The resistor drivers, Dr 1 and Dr 2 , whose circuits are shown in Figures 2(a) and 2(b), respectively, act as bridges between the modules related to power (fan and resistor  1 ) and control (embedded in the uC).Decoupling of the power modules is achieved using the photocouplers PH 1 and PH 2 .The power modules are actuated proportionally by the drivers, using pulse width modulation (PWM) signals  1 () and  2 (), which are generated by the ES in the uC [22].The drivers Dr 1 and Dr 2 are fed independently by the sources  1 () and  2 (), respectively.
The ES is governed by a remote computational system called the RCDAS (remote configuration and data acquisition system).The RCDAS communicates with the ES by means of a USART protocol (universal synchronous asynchronous receiver transmitter) [22], collecting the output temperature,  out ().The RCDAS can also alter the control system parameters in real time.

Modeling of the System
The dynamics of the design [20,21], shown in Figure 1, can be described by the following equation: where (i)  in () is heat flow rate generated by resistor  1 , in cal/s; (ii)   () is losses by conduction in the aluminum foil walls (inside the tube), in cal/s; (iii) () is air flow, in m 3 /s; (vii)  is density of the fluid (air), in kg/m 3 ; (viii)  is specific heat of the fluid (air), in cal/(kg ∘ C).
The heat flow rate generated (cal/s) can be characterized as where  is the value of the factor used to convert watts (or J/s) to cal/s (1 watt = 0.239005736 cal/s) and   in () is the flow rate in watts.
The loss of heat by conduction [20,21] in the aluminum foil walls (within the tube), in Joules, is given by ( Supposing that  in () is constant, the heat loss flow rate (in cal/s) can be described by where   is the heat capacity of aluminum,   is the mass of aluminum used, and   is the specific heat of aluminum.Since the heat flow rate generated,  in (), will be adjusted using PWM, it can be characterized as where () is the value of the size of the PWM pulse, in % (0-100%), and   max is the maximum flow rate of heat generated (in watts), described by (2).The air flow, (), is also controlled using PWM and can be described by where () is the value of the size of the PWM pulse, in % (0-100%), and  max is the maximum air flow generated by the fan.Using (4), ( 5), and ( 6), (1) can be rewritten as where Figure 3 presents the model developed using the Xcos dynamic simulation platform [23].With this model, the students can obtain experimental data for the design, prior to its construction, which minimizes the wastage of material and helps to optimize the control system project.With this theoretical information, the students use the knowledge acquired in the previous courses (modeling of dynamic systems and control systems) to develop their project.

Functional Requirements
Using the definitions presented in Sections 2 and 3, each group of students is required to develop the design of the industrial drier, the drivers, the embedded application, and the remote configuration and data acquisition system.This section presents the details of the project's functional requirements presented to students during the course.The parameter values employed are shown in Table 1.In the case of the aluminum foil, the mass (  ) can be obtained from the density of the foil and the internal area of the tube with diameter .

4.1.
Operational Range of the Industrial Drier.By setting the derivative of the output temperature,  out (), equal to zero in (7), and substituting the values presented in Table 1, the following expression is obtained: Supposing that the minimum working air flow rate of the drier is 1% of  max and that at this flow rate the maximum output temperature,  out (), is 100 ∘ C, (9) can be used to obtain the maximum power,   max , necessary for operation of the drier, which in the case of this project is 12 watts.Using this information, it is simple to calculate the valor of resistance  1 (48 Ω) and predict the values of source  2 () (24 V and 0.5 A) associated with Dr 2 .Considering the power of 12 watts and a minimum working temperature equal to 25 ∘ C, it is also possible to calculate the value of the maximum flow supported by the system, which in this case is 7.5% of  max .Table 2 provides a list of the components that can be used.

Simulations Requirements. Figure 4 presents the results
obtained for simulation of the open-loop system, with air flows set at 1% and 7.5%, respectively, of the maximum value ( max ) attainable by the fan.It can be seen that the critical response time of the system,   , is around 12 seconds (with the flow at 7.5% of  max ).This information will be used to configure the time for interruption of execution of the PID controller, as shown in the next section.Figure 5 shows the results obtained for simulation of the closed-loop system in  order to tune the PID controller and obtain the parameters   ,   , and   [19].

Embedded System
Requirements.The embedded system must be developed using an ATmega328p chip [22] and an Arduino Uno kit [24].The ATmega328p is an 8-bit uC that operates at 1 MIPS/MHz and possesses 32 Kbytes of program memory and 2 Kbytes of RAM memory.The Arduino Uno is a development kit that combines an ATmega328p chip and a programmer circuit in a single hardware kit, hence facilitating the development process.The ES must be developed in C language, using the Atmel Studio 6 development environment, available from Atmel (the manufacturer of the ATmega328p chip).Figure 6 presents the layout of the ATmega328p chip, showing only the pins to be used in the project.
The embedded system (to be developed) should be subdivided into four modules, here denoted by  1 ,  2 ,  3 , and  4 .Module  1 is responsible for receiving the data (via the USART protocol) from the RCDAS and updating the control parameters.Module  2 performs the transmission, in real time, of the output temperature ( out ()) data.The control algorithms are implemented in modules  3 and  4 , where  3 implements the closed-loop control system for the output temperature,  out (), via a PID controller, and 4 implements the open-loop control of the air flow, T out (t)

𝑄(𝑡).
As illustrated in Figure 7, the algorithms for modules  1 and  2 must be executed in the main loop of the ES.Modules  3 and  4 (Figure 7) must be executed with an internal interrupt (using the timer TIMER1) to ensure that the control system can function independently of the data communication system governed by modules  1 and  2 .The interruption time,   , should be sufficient to execute  3 and  4 and is  times shorter than the critical response time,   .The value of  and   must be specified by the students.The variables declaration and configuration register should be implemented in module  0 .It is important to emphasize that the global variables shared between the main program and the interruptions must be of the volatile type.

Flow Data Control Requirements. Figures 8(a) and 8(b)
illustrate the minimum requirement for flow data control associated with the the RCDAS.At each instant, the RCDAS sends a code of 1 byte to the uC.When the code value is 255, the RCDAS sends no further information, and the uC returns the value of  out () by means of module  2 .For code values that differ from 255, the RCDAS also sends the value of one of the configuration parameters.All the values concerning the parameters are fixed at 1 byte.

PID Control Algorithm.
The PID should be implemented in a discrete manner, following parallel topology as presented in [19] and expressed by where () is PID output and   ,   , and   are the proportional, integral, and derivative gains, respectively.The variable () could be expressed by where  ref () is the temperature set point.The integral error of the temperature,   (), could be characterized as Finally, the derivative error,   (), could be expressed by The th values are sampled in interruption time,   , and the variables () and  out () are the discret version of the () and  out () variables, respectively.

Project Evaluation
The project proposed here was implemented as part of the Digital Systems (DS) course, in the Computer Engineering programme at the Federal University of Rio Grande do Norte.This 60-hour course, taught every semester, currently presents the concepts of DS for programmable hardware platforms that employ uCs. Figure 9 illustrates the projects undertaken by the students during the 2012.2semester, when the PRBL project described here was used.All the projects were developed by groups of up to four students.In order to validate the PRBL proposal, a survey was conducted of the opinions of the students in the 2012.2class.The survey was conducted on a voluntary and anonymous basis, using the electronic forms tool of Google.Based on the methodology employed in earlier work [3,5,11,14], the electronic form contained five statements (shown in Table 3), each with five possible responses that corresponded  to five levels of agreement.This format type, known as a psychometric response scale, is widely used in questionnaires where the interviewee is required to grade items according to their degree of importance.Table 4 shows the formats of the responses associated with each of the statements given in Table 3. Table 5 and Figure 10 present the results of the survey conducted exclusively to analyze the PRBL proposal.The questionnaire was sent to a total of 27 students registered during the 2012.2semester, of which 11 students (41%) responded.It should be noted that the questionnaires were sent to the students independent of their degree of success in the discipline.
The replies for statements 1 and 2 (Table 5 and Figure 10) indicated that the methodology involving hands-on lab and building the plant with the driver circuits and sensors received a positive response, with grades 4 or 5 given in around 90% of the replies.For statements 3 and 4 (results presented in Table 5 and Figure 10), which concerned the views of the student regarding his/her learning, grade 4 or 5 was obtained in around 91% of the responses (for both statements).Statement 5 (results presented in Table 5 and   In this case, 100% of the students gave grades 4 or 5. Finally, considering the replies obtained for all the statements, it could be concluded that the proposed methodology was well received, since grade 4 or 5 was given in more than 90% of the responses.

Conclusion
This paper presents the development of a laboratory project suitable for teaching the principles of embedded systems.Using PRBL methodology, the aim of the project is to encourage students to develop solutions to problems in the area of embedded systems.The detailed description provided of the development of a closed-loop control system for an industrial drier should enable the proposal to be more widely adopted in other similar courses and academic programmes.The results of a questionnaire survey of students were encouraging and indicated that the proposal could be successfully used for learning purposes.

Figure 1 :
Figure 1: Architecture of the laboratory project presented to the students.

Figure 4 :
Figure 4: Simulation results for the industrial drier (open-loop system).

Figure 5 :
Figure 5: Simulation results for the industrial drier (closed-loop system).

Figure 6 :
Figure 6: Summary layout of the Atmega328p chip, showing the pins to be used.

Figure 7 :
Figure 7: Positioning of the modules in encoding the ES.

Figure 8 :
Figure 8: Flow of data between the RCDAS and the uC.

Figure 9 :
Figure 9: The projects undertaken by the students.

Figure 10 :
Figure 10: Bar chart of the statements results.

Figure 10 )
Figure 10) aimed to summarize the opinion of the student regarding the entire methodology employed in the training.In this case, 100% of the students gave grades 4 or 5. Finally, considering the replies obtained for all the statements, it could be concluded that the proposed methodology was well received, since grade 4 or 5 was given in more than 90% of the responses.
Schematics of the circuits for drivers Dr 1 and Dr 2 .

Table 1 :
Parameters and values used as initial conditions in the industrial drier project.

Table 2 :
List of components used in the industrial drier project.

Table 3 :
Statements sent to the students.

Table 4 :
Formats of the responses associated with each of the five statements.