# Project-Based Learning Laboratory for Teaching Embedded Systems

Authors: Marcelo A. C. Fernandes
Journal: Mathematical Problems in Engineering
 (2015)

---

## Abstract

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.


---

## Body

## 1. 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–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–4, 6–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–4, 10]. The studies presented in [11–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. Section2 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.


## 2. The Laboratory Project

Figure1 provides a detailed schematic illustration of the proposed laboratory project. The industrial drier consists of a PVC tube of length L and internal diameter d, coated internally with aluminum foil in order to improve heat transfer. The flow of air, at a rate Q(t) (in m3/s), is produced by a fan located within the tube, and the heat flow rate, Pin(t) (in cal/s), is generated by a resistor, R1, also fixed within the tube. As shown in Figure 1, the flow of air enters the system at a temperature of Tin(t) and arrives at the end of the tube at a temperature of Tout(t). The heating process occurs by convection from resistor R1 [19–21].Figure 1
Architecture of the laboratory project presented to the students.The function of the embedded system is to control the temperature,Tout(t), and the air flow, Q(t), at the output of the tube. The temperature control is performed by a closed-loop system with a PID controller [19] that uses a temperature sensor, A1, at the output of the tube to control the heat flow rate, Pin(t). Control of the air flow is performed using an open-loop system that acts on the fan speed.The resistor drivers,Dr1 and Dr2, whose circuits are shown in Figures 2(a) and 2(b), respectively, act as bridges between the modules related to power (fan and resistor R1) and control (embedded in the uC). Decoupling of the power modules is achieved using the photocouplers PH1 and PH2. The power modules are actuated proportionally by the drivers, using pulse width modulation (PWM) signals S1(t) and S2(t), which are generated by the ES in the uC [22]. The drivers Dr1 and Dr2 are fed independently by the sources V1(t) and V2(t), respectively.Figure 2
Schematics of the circuits for driversDr1 and Dr2.
(a)
DriverDr1
(b)
DriverDr2The 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, Tout(t). The RCDAS can also alter the control system parameters in real time.


## 3. Modeling of the System

The dynamics of the design [20, 21], shown in Figure 1, can be described by the following equation: (1)ρSVdTouttdt=Pint-Pat+ρSQtTint-Toutt,where(i)
Pin(t) is heat flow rate generated by resistor R1, in cal/s;(ii)
Pa(t) is losses by conduction in the aluminum foil walls (inside the tube), in cal/s;(iii)
Q(t) is air flow, in m3/s;(iv)
Tin(t) is input temperature, in °C;(v)
Tout(t) is output temperature, in °C;(vi)
V is volume of the tube, in m3;(vii)
ρ is density of the fluid (air), in kg/m3;(viii)
S is specific heat of the fluid (air), in cal/(kg°C). The heat flow rate generated (cal/s) can be characterized as (2)Pint=γV2t2R1=γPinWt,where γ is the value of the factor used to convert watts (or J/s) to cal/s (1watt=0.239005736cal/s) and PinW(t) 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 (3)Ht=CaTint-Toutt.Supposing that Tin(t) is constant, the heat loss flow rate (in cal/s) can be described by (4)Pat=dHtdt=γmaSadTouttdt,where Ca is the heat capacity of aluminum, ma is the mass of aluminum used, and Sa is the specific heat of aluminum.Since the heat flow rate generated,Pin(t), will be adjusted using PWM, it can be characterized as (5)Pint=Pmax⁡at100=γPmax⁡Wat100,where a(t) is the value of the size of the PWM pulse, in % (0–100%), and Pmax⁡W is the maximum flow rate of heat generated (in watts), described by (2). The air flow, Q(t), is also controlled using PWM and can be described by (6)Qt=Qmax⁡βt100,where β(t) is the value of the size of the PWM pulse, in % (0–100%), and Qmax⁡ is the maximum air flow generated by the fan. Using (4), (5), and (6), (1) can be rewritten as (7)ηdTouttdt=γPmax⁡Wat100+ρSQmax⁡βt100Tint-Toutt,where (8)η=ρSV+γmaSa.Figure3 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.Figure 3
Dynamic model of the design of the industrial drier (see (7)), developed in Scilab/Xcos.


## 4. Functional Requirements

Using the definitions presented in Sections2 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 (ma) can be obtained from the density of the foil and the internal area of the tube with diameter d.Table 1
Parameters and values used as initial conditions in the industrial drier project.
Parameters
Value
Input temperature (Tin(t))
25°C
Tube length (L)
0.4 m
Density of air (ρ)
1.184 kg/m3
Specific heat of air (S)
241 cal/kg°C
Internal diameter of the PVC tube (d)
0.067 m
Density of aluminum foil
40 g/m2
Fan dimensions
80 × 80 × 25 mm
Maximum fan air flow (Qmax⁡)
0.0132 m3/s (28 CFM)
Driver (Dr1) feed voltage (V1(t))
12 V (0.15 A)


### 4.1. Operational Range of the Industrial Drier

By setting the derivative of the output temperature,Tout(t), equal to zero in (7), and substituting the values presented in Table 1, the following expression is obtained: (9)Pmax⁡Wat100=1193.8793-29846.9824Qmax⁡βt100.Supposing that the minimum working air flow rate of the drier is 1% of Qmax⁡ and that at this flow rate the maximum output temperature, Tout(t), is 100°C, (9) can be used to obtain the maximum power, Pmax⁡W, 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 R1 (48 Ω) and predict the values of source V2(t) (24 V and 0.5 A) associated with Dr2. 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 Qmax⁡. Table 2 provides a list of the components that can be used.Table 2
List of components used in the industrial drier project.
Component
Value/specification
Resistance of driverDr1 (R2)
330 Ω
Transistor for driverDr1 (TR1)
BD 139
Diode for driverDr1 (D1)
1N4007
Resistance of driverDr2 (R3)
330 Ω
Transistor for driverDr2 (TR2)
TIP 41
Driver photocouplers
4N25
Temperature sensor
LM 35


### 4.2. Simulations Requirements

Figure4 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 (Qmax⁡) attainable by the fan. It can be seen that the critical response time of the system, tc, is around 12 seconds (with the flow at 7.5% of Qmax⁡). 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 Kp, Ki, and Kd [19].Figure 4
Simulation results for the industrial drier (open-loop system).Figure 5
Simulation results for the industrial drier (closed-loop system).


### 4.3. 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.Figure 6
Summary layout of the Atmega328p chip, showing the pins to be used.The embedded system (to be developed) should be subdivided into four modules, here denoted byM1, M2, M3, and M4. Module M1 is responsible for receiving the data (via the USART protocol) from the RCDAS and updating the control parameters. Module M2 performs the transmission, in real time, of the output temperature (Tout(t)) data. The control algorithms are implemented in modules M3 and M4, where M3 implements the closed-loop control system for the output temperature, Tout(t), via a PID controller, and M4 implements the open-loop control of the air flow, Q(t). As illustrated in Figure 7, the algorithms for modules M1 and M2 must be executed in the main loop of the ES. Modules M3 and M4 (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 M1 and M2. The interruption time, ti, should be sufficient to execute M3 and M4 and is N times shorter than the critical response time, tc. The value of N and ti must be specified by the students. The variables declaration and configuration register should be implemented in module M0. It is important to emphasize that the global variables shared between the main program and the interruptions must be of the volatile type.Figure 7
Positioning of the modules in encoding the ES.


### 4.4. Flow Data Control Requirements

Figures8(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 Tout(t) by means of module M2. 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.Figure 8
Flow of data between the RCDAS and the uC.
(a)
C
o
d
e
=
255
(b)
C
o
d
e
≠
255


### 4.5. PID Control Algorithm

The PID should be implemented in a discrete manner, following parallel topology as presented in [19] and expressed by (10)ak=Kpek+KieIk+KdeDk,where a(k) is PID output and Kp, Ki, and Kd are the proportional, integral, and derivative gains, respectively. The variable e(k) could be expressed by (11)ek=Trefk-Toutk,where Tref(k) is the temperature set point. The integral error of the temperature, eI(k), could be characterized as (12)eIk=eIk-1+tiek.Finally, the derivative error, eD(k), could be expressed by (13)eDk=ek-ek-1ti.The kth values are sampled in interruption time, ti, and the variables a(k) and Tout(k) are the discret version of the a(t) and Tout(t) variables, respectively.


## 4.1. Operational Range of the Industrial Drier

By setting the derivative of the output temperature,Tout(t), equal to zero in (7), and substituting the values presented in Table 1, the following expression is obtained: (9)Pmax⁡Wat100=1193.8793-29846.9824Qmax⁡βt100.Supposing that the minimum working air flow rate of the drier is 1% of Qmax⁡ and that at this flow rate the maximum output temperature, Tout(t), is 100°C, (9) can be used to obtain the maximum power, Pmax⁡W, 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 R1 (48 Ω) and predict the values of source V2(t) (24 V and 0.5 A) associated with Dr2. 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 Qmax⁡. Table 2 provides a list of the components that can be used.Table 2
List of components used in the industrial drier project.
Component
Value/specification
Resistance of driverDr1 (R2)
330 Ω
Transistor for driverDr1 (TR1)
BD 139
Diode for driverDr1 (D1)
1N4007
Resistance of driverDr2 (R3)
330 Ω
Transistor for driverDr2 (TR2)
TIP 41
Driver photocouplers
4N25
Temperature sensor
LM 35


## 4.2. Simulations Requirements

Figure4 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 (Qmax⁡) attainable by the fan. It can be seen that the critical response time of the system, tc, is around 12 seconds (with the flow at 7.5% of Qmax⁡). 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 Kp, Ki, and Kd [19].Figure 4
Simulation results for the industrial drier (open-loop system).Figure 5
Simulation results for the industrial drier (closed-loop system).


## 4.3. 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.Figure 6
Summary layout of the Atmega328p chip, showing the pins to be used.The embedded system (to be developed) should be subdivided into four modules, here denoted byM1, M2, M3, and M4. Module M1 is responsible for receiving the data (via the USART protocol) from the RCDAS and updating the control parameters. Module M2 performs the transmission, in real time, of the output temperature (Tout(t)) data. The control algorithms are implemented in modules M3 and M4, where M3 implements the closed-loop control system for the output temperature, Tout(t), via a PID controller, and M4 implements the open-loop control of the air flow, Q(t). As illustrated in Figure 7, the algorithms for modules M1 and M2 must be executed in the main loop of the ES. Modules M3 and M4 (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 M1 and M2. The interruption time, ti, should be sufficient to execute M3 and M4 and is N times shorter than the critical response time, tc. The value of N and ti must be specified by the students. The variables declaration and configuration register should be implemented in module M0. It is important to emphasize that the global variables shared between the main program and the interruptions must be of the volatile type.Figure 7
Positioning of the modules in encoding the ES.


## 4.4. Flow Data Control Requirements

Figures8(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 Tout(t) by means of module M2. 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.Figure 8
Flow of data between the RCDAS and the uC.
(a)
C
o
d
e
=
255
(b)
C
o
d
e
≠
255


## 4.5. PID Control Algorithm

The PID should be implemented in a discrete manner, following parallel topology as presented in [19] and expressed by (10)ak=Kpek+KieIk+KdeDk,where a(k) is PID output and Kp, Ki, and Kd are the proportional, integral, and derivative gains, respectively. The variable e(k) could be expressed by (11)ek=Trefk-Toutk,where Tref(k) is the temperature set point. The integral error of the temperature, eI(k), could be characterized as (12)eIk=eIk-1+tiek.Finally, the derivative error, eD(k), could be expressed by (13)eDk=ek-ek-1ti.The kth values are sampled in interruption time, ti, and the variables a(k) and Tout(k) are the discret version of the a(t) and Tout(t) variables, respectively.


## 5. 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. Figure9 illustrates the projects undertaken by the students during the 2012.2 semester, when the PRBL project described here was used. All the projects were developed by groups of up to four students.Figure 9
The projects undertaken by the students.
(a)
(b)
(c)
T
out
(
t
)
= 40°C
(d)
T
out
(
t
)
= 100°CIn order to validate the PRBL proposal, a survey was conducted of the opinions of the students in the 2012.2 class. 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 3
Statements sent to the students.
Number
Statement
1
The hands-on lab helped me develop software development skills in embedded systems.
2
It was important to build the plant with the driver circuits and sensors, because this way I can better understand the design of real problems with embedded systems.
3
I was pleased with the laboratory projects.
4
I understand the structure and functions associated with the ATmega microcontroller.
5
I am able to develop projects in embedded systems.Table 4
Formats of the responses associated with each of the five statements.
Grades
1
2
3
4
5
Disagree
AgreeTable5 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.2 semester, 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.Table 5
Statements results.
Grades
1
2
3
4
5
Statement 1
0%
0%
0%
18%
82%
Statement 2
9%
0%
0%
9%
82%
Statement 3
9%
0%
0%
18%
73%
Statement 4
0%
0%
9%
18%
73%
Statement 5
0%
0%
0%
27%
73%Figure 10
Bar chart of the statements results.The replies for statements 1 and 2 (Table5 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 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.


## 6. 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.



---

*Source: 236749-2015-07-08.xml*