You are on page 1of 6

Teaching Human Computer Interaction Methods in

Embedded System Design


Ismail Al Kamal, Baslan Asad Alaa Al Bashar
Electrical and Computer Engineering Department Dept. of Electrical Engineering and Computer Science
American University of Beirut University of Siegen
Beirut, Lebanon Siegen, Germany
(ima16, bga03)@aub.edu.lb aalbashar@hotmail.com

Abstract—This paper presents our work at the faculty of


Electrical and Electronic Engineering in Aleppo where we
developed a new embedded systems design lab which was the
first of its kind in the faculty. The paper illustrates the plan that
was followed to highlight the importance of embedded system
design for the public, namely it will present Nawatt as an open-
source e-learning project for embedded systems. Nawatt provides
an Arabic reference for students and hobbyists to learn about
microcontroller design and its applications. A detailed
description of the locally built development boards and a series of
lab experiments that were developed on these kits to teach the
principles of embedded system design are given. Finally, a
number of advanced projects are depicted as examples of the
students’ experience in developing embedded systems.

Keywords-embedded systems, microcontrollers, education,


human computer interaction.

I. INTRODUCTION
Embedded systems design is an active field of research and
teaching students the intricate details of the design process is a
challenging task. The right combination of theory and practice
must exist for students to benefit from a course in embedded
systems [1]. Microcontrollers are extensively used in these
Figure 1. Digital design, computer organization and architecture curriculum
courses due their fast implementation time and abundance of at Aleppo University.
features and peripherals. We propose a lab of 12 sessions to
teach students embedded system design through interfacing. the Microprocessor design course in the fifth year and would
Human Computer Interaction (HCI) is very important for be a hands-on experience for students to delve into the design
designs to be simple and user-friendly. and implementation of microcontroller based circuits and to
The embedded system lab was proposed as an integral part of learn different methods of interfacing.
teaching digital design, computer organization and
architecture to an undergraduate class of students. A bachelor
of engineering in electronics at Aleppo University takes 5 II. HARDWARE LAB TOOLS
years to complete, each year comprises of two semesters.
A. Nawatt Development Board
Digital Circuits and Systems is taught in the first semester of
the fourth year followed by Computers(1) in the second Nawatt development board is a microcontroller based
semester. Finally, in the first semester of the fifth year educational kit. One of the main factors of the kit is its
Computers(2) and Microprocessor Design are taught. extremely low cost of 30$ which makes it an attractive tool for
Computers(1) focuses on computer organization and students and hobbyists. The system is based on an ATMEL
Computers(2) on architecture. The two courses in the fourth AVR ATmega8 clocked at 10 MHz. ATmega8 is an 8 bit
year are supplemented with a Digital and Z80 Assembly Lab microcontroller containing 8 KB of in-system programmable
(Fig. 1). These two labs aren’t sufficient to introduce students flash memory, 512 bytes of EEPROM and 1KB of SRAM. It
to embedded systems design. The embedded systems design has an extensive set of peripherals that include two 8bit timers
lab would be introduced as a lab for Computers(2) and and one 16bit timer, 8 channel Analog-to-Digital converters
(ADC), serial peripheral interface (SPI), universal
synchronous and asynchronous serial receiver and transmitter pulse width modulated (PWM) signal. PWM signals can be
(USART), two wire serial interface (I2C), one analog generated by the AVR microcontroller timers and so motor
comparator and a watchdog timer. The microcontroller also control is reduced to a matter of timer configuration.
includes 23 I/O pins. The abundance of features present in the
ATmega8 does not deprive the learner from experiencing the
features usually available in more sophisticated and expensive
microcontrollers.
The board contains a 1 line 24 character LCD, a three 7-
segment display, two buttons connected to the interrupt pins, a
16 button keypad, 4 LEDs, and two variable resistors. The kit
also has an expansion connector to add-on new components to
the proposed design. The kit includes a self-programmer for
in-system programming. An RS-232 interface serves two
purposes, one for programming and the other for hardware
emulation. The system is transferred from programming to
emulation mode using the “programming switch”. Twelve
experiments were developed on the board that demonstrate the
basic functionality of the different peripherals and connected
components. The board is depicted in Fig. 2.
B. Accessories
A set of accessories were put together for more advanced
Figure 2. Nawatt Microcontroller Development Kit
experiments. The extensive set includes a number of graphic
LCDs based on the Samsung KS108 and Toshiba T6963C III. SOFTWARE LAB TOOLS
controllers as examples of graphic LCDs extensively utilized
in the industry especially for programmable logic units (PLC), A. BASCOM Integrated Development Environment (IDE)
automated machinery and assembly lines. Another is the Studying an introductory course on embedded systems
graphics LCD based on the Philips PCD8544 controller used design can be challenging and the different tools involved in
in the Nokia 3310 mobile phones. These LCDs are easily building these systems can be confusing. BASCOM is a
interfaced to microcontrollers and their programming is easy simple and easy-to-use BASIC compiler with an integrated
and ultimately fun. terminal emulator, simple simulator and a microcontroller
USB to serial converters are also one of the most popular programming application. The extensive libraries available
accessories. Adding USB connectivity to one’s application is make it an ideal starting point for any student or hobbyist to
appealing. The FTDI 245BM chips are one of the easiest to start developing applications. A demo version of the software
use and provide connectivity at 1.5 Mbps which are quite can be downloaded from the company’s website [2].
suitable for low end applications developed with 8 bit BASCOM includes built-in commands to interface to
microcontrollers. The chip automatically converts the USB character and graphics LCDs, SPI, I2C, 1wire, keyboards and
transfer protocols to RS232 which is easily interfaced to a keypads, timers, interrupts as well as arithmetic and logic
microcontroller. The most exciting feature of the chip is the instructions and many other different commands. The software
add-on EEPROM that stores a brand name defined by the user. has the ability to program AVR microcontrollers directly from
When connecting the chip to a PC, operating systems install the programming environment and simulate and emulate
the detected hardware and give the device the name stored in programs to verify their functionality.
the EEPROM. This name is later visible in the control panel or Fig. 3 illustrates a simple counter program from 0 to
set of hardware devices. 65535. A variable is incremented and displayed on both the
A keyboard, mouse or joystick provides an excellent input LCD and terminal emulator every 100ms. The LCD
device for different types of applications. Keyboards and mice configuration is a matter of defining the pin positions and then
use a PS/2 connector which is a simple serial connection writing a simple print command.
easily interfaced to a microcontroller. By writing a few simple
lines of code, the developer can integrate these devices into a B. Labcenter Proteus VSM Simulator
new design. A strong simulation program is an essential tool to provide
Multimedia (MMC) and Secure Digital (SD) cards provide learners with a fast method to test their programs especially
an ideal removable storage solution. Mobile phones, MP3 when a microcontroller development kit is not available. The
players and a great number of systems use these cards. SPI Proteus VSM simulator is a very powerful tool that does not
ports are very popular in microcontrollers and both MMC and only simulate analog or digital circuitry but also
SD cards support SPI interface so integrating them in one’s microcontrollers and microprocessors. The hex code generated
design is a matter of sending the right commands to the card. from the software compiler which is usually downloaded to
Finally, motor control is an essential embedded system the microcontroller’s flash memory can be loaded to the
application. Speed in DC motors can be controlled with a

This work was supported by Nawatt for engineering solutions group.


$regfile "m8def.dat"

$crystal = 1000000

Config Lcdpin = Pin , Db4 = Portb.2 , Db5 = Portb.3 , Db6 =


Portb.4 , Db7 = Portb.5 , E = Portb.1 , Rs = Portb.0

Baud = 2400
Config Lcd = 16 * 1
Dim A As Word

Cls

For A = 0 To 65535

Home
Lcd "No:" ; A
Print A Figure 4. Nawatt Educational Website.
Waitms 100
1. The first experiment is usually an introduction to the
Next A software, hardware and web based tools needed in the lab.
A first example is given to turn a LED on and off. This is
End
done by introducing the students to BASCOM where they
Figure 3. BASIC counter program displaying numbers on LCD and terminal
emulator. write their first program in BASIC. The program is
compiled and then the hex file is transferred to the Proteus
simulator and the simulated version of the microcontroller VSM simulator. The students add the components needed
functions as the real one. for the design: ATmega8 microcontroller, a quartz crystal,
A character LCD can be added to the microcontroller and
a resistor and a LED. When the electronic components are
different characters can be displayed. A demo version can be
downloaded from the company’s website [3]. correctly placed and connected, the hex file is
downloaded onto the simulated microcontroller and a test
and verification of the code is performed. The purpose of
C. Nawatt Educational Website
using the simulator first is to make sure that the students
A supplementary website was launched to aid in the perfectly understand how the electronics work which is
learning process of students and hobbyists. One of the goals of
the website is to make electronics appealing to a large number usually hidden in a microcontroller starter kit. After that,
of people and by writing about experiences and projects in the code is downloaded onto the Nawatt development kit
Arabic; the site was able to attract a great number of visitors. and the students can verify that their program actually
The main page hit rate increased by 150 times in a short works. The last 10 minutes of the lab session are most
period of 3 month and the site became the number 1 Arabic interesting. An open discussion is initiated on the use of
reference in electronics and microcontrollers. A section of the LEDs, a list of advantages and disadvantages is written
site contains a research section. This includes extensive
and what are the best and worst applications of
research projects on basic analog and digital electronics,
communications and control. A section on technology news implementing LEDs. This discussion encourages students
and another for a step-by-step course in microcontroller circuit not only to think of the technicalities of a design but also
design. The site turned into a hub for students, hobbyists and about the methods humans interact with these designs and
professionals to meet and discuss different topics in how different interfaces attract or annoy users. Homework
electronics and microcontrollers. The feedback was is given to the students to evaluate their performance; this
encouraging and the website turned out to be a really is usually given after each lab session and is due in the
important tool in the design of the embedded systems design
following session. One of the questions usually asked of
lab. Fig. 4 illustrates the Nawatt educational website.
the students is to investigate and report different
IV. LAB STRUCTURE embedded systems that rely on the certain peripheral that
The lab is based on the tools described above. It is divided was introduced in the session and comment on the
into 12 experiments. Each one introduces the student to a successfulness of its implementation.
different component, peripheral or algorithm.
2. The second experiment introduces the student to a more resistors are connected to the analog comparator pins.
complex system comprised of four LEDs and a button. Each resistor works as a 5V voltage divider. The program
The user is not passive anymore and is expected to includes displaying the number of the variable resistor
interact with the system. The program is simple and is with the largest voltage (result of the comparison) on the
expected to turn one of the LEDs on sequentially each LCD screen. In the second part of the session, students try
time the button is pressed. The code can be written in two to convert the voltage on one pin to a digital value and
styles, a loop or as an interrupt service routine (ISR). The then apply a transformation to change this value into
student is asked to experiment with the two methods and temperature, humidity or any other physical unit. This
then simulate and emulate the design. A discussion is then explains the basics of interfacing microcontrollers to
opened to evaluate the effect of adding a user input to the analog sensors and how these readings can be easily
design. acquired.
3. This session is concerned with interfacing the 7. Lab seven requires the students to work with timers and
microcontroller to a number of 7-segment displays. The counters. This session implements a number of
students are introduced to binary coded decimal (BCD) applications such as a product counter. Each time a button
implementation in microcontrollers using look-up tables is pressed the counter value is incremented and displayed
to display the right numbers on the 7-segments. They on the terminal emulator screen. When the counter
experiment with displaying a series of digits on three 7- overflows an interrupt occurs and a message is displayed
segment displays by understanding the timing constraints on-screen. Another application is implementing a stop-
involved in such a design and the concept of sweeping. watch. The microcontroller clock cycle has to be exactly
The application given to the students is a counter from 0 defined in order to use timers to calculate seconds and
to 999. minutes. Such an application teaches students both
4. Students try to develop applications using a keypad in this hardware and software tips and tricks for exact time
session. The identity of the pressed button is detected by calculation and lets them think at the machine code level.
scanning the rows of buttons. The students therefore have 8. DC motor speed control is an interesting application.
to integrate a keypad into their design by correctly Speed in DC motors can be controlled using a variable
calculating the debounce and scanning effects. A small voltage source. Although, speed control is simple in
calculator application is given to the students. The analog electronics. Digital circuitry presents a challenge
microcontroller must store the first number which is and so PWM comes in handy. PWM signals have a
displayed on the 7-segment display and then add, subtract, variable average voltage related to the width of the pulse.
multiply or divide it with a second number and the result The wider the pulse, the larger the average voltage is and
is displayed on the 7-segment display. The lab project is so the faster the motor. The ATmega8 microcontroller has
challenging but introduces the students to some very a built-in PWM capability which can be important in such
important concepts in human machine interfacing (HMI). an application. The students are responsible to write the
5. LCDs are one of the most important and fun components code necessary to control the speed of a DC motor then
to use in any embedded design. Mobile phones, MP3 simulate and implement the design in class.
players, printers, and a great number of other systems use 9. Graphic LCDs are much harder to use due to the complex
LCDs. Character LCDs are controlled via a set of circuitry and advanced controllers involved in their design
predefined commands that initialize, clear and shift the but nevertheless they are the most popular displays in
characters on screen as well as for displaying characters. heavy machinery, assembly lines, photocopying machines
BASCOM has a library of built-in commands to control and PLCs. The ability to display graphics on the screen
the LCD but as an embedded system designer, knowing adds tremendous advantages to a design and makes user
how a component works is essential. Therefore, the first interface an easier and enjoyable experience. BASCOM
part of the experiment focuses on sending native has built-in commands to interface microcontrollers to
commands to the LCD. After the students become graphic LCDs. Students learn in this session to display
comfortable using LCDs, an application is presented to both text and graphics on these screens. The students are
shift a number of displayed words on the screen from one then given a project to implement and display animations
end to the other and back again. This exercise forces the on the screen.
students to use the internal character LCD commands. 10. This session involves interfacing a keyboard and mouse to
6. The students in this session are responsible to get the the design. The compiler has built-in commands for that.
analog comparator and the ADC working. Two variable The challenge here is to design a simple word processor.
The mouse controls a cursor on the graphics LCD. On
click, the user can write any letter he types on the
keyboard and it is then displayed on the screen.
11. USB connectivity is necessary in a lot of applications.
The FTDI USB chips are easy to use and have a
straightforward implementation of the USB transmission
protocols. The chip is interfaced to the microcontroller’s
serial port which transmits and receives data to the PC. In
this session embedded and PC programming is necessary.
A simple Visual Basic application is built to receive data
from the microcontroller and display it on the PC. The
students are responsible for building the transmitting
program on the microcontroller and the receiving
application on the PC. Figure 5. Data Acquistion System.
12. Finally, adding a removable storage unit to an embedded
system may prove advantageous. Building MP3 players The driver provided by the manufacturer creates a virtual
requires that songs be stored on an MMC card. Interfacing serial COM port that can be easily used in programming
MMC cards to microcontrollers can be a challenging task. languages.
For simplifying the interaction between the user and the
MMC are interfaced to the ATmega8 microcontroller
system a Visual Basic for Application (VBA) macro was used
using the SPI port. Students are faced with this final task in MS. Excel to automate the synchronization process and
before setting out to develop their own applications. The configure the DAQ system. This method allows all Excel
microcontroller must store a series of temperature functions and graphs to be used and the known spreadsheet
readings in the MMC and later display them on a graphics format allows data transfers to other applications.
LCD. As can be seen from the sequence of experiments, The storage unit used is a Multimedia Card (MMC). They
are widely available in the market at very low prices. Large
every session depends on the one before it to build a fully
storage areas up to 8 GB in a small compact package, low
functional application in the end. power consumption plus a simple interface, all deliver
superiority over other storage methods used today. The
V. PROJECTS microcontroller connects to the MMC card using a serial
The previous lab sessions enabled students to begin peripheral interface (SPI) with a maximum speed of 20 MHz
building projects on a larger scale. A few of these projects Sensor values plus dates and times of these readings are stored
were an industrial data acquisition system, 1.5-30V power sequentially in 512 byte packets in the flash memory array.
supply and an automatic telephone switch (ATS) system. MMC cards can be separately connected to the PC after the
data has been written on them. This method provides another
way to transfer data to the PC. The capacity of the system
A. Industrial Data Acquisition (DAQ) System
memory can be increased using larger MMCs.
The heart of the DAQ system is the ATMEL Atmega128 All these features, when put together deliver a good
microcontroller [4]. It's programmed to get the sensor readings combination of speed, performance and functionality. The
and store them in the MMC card at predefined intervals. These system was tested using a maximum clock frequency of 16
intervals are generated using the real-time clock unit built-in MHz. The sampling rate was set to one second intervals, the
the microcontroller. The system can be configured using the ADC to a resolution of 10bits, a CDS cell and temperature
user interface which consists of a 240x128 graphics LCD and sensors were used as inputs to the system (Fig. 5).
a set of four input buttons. These buttons provide a simple
way to navigate the menus on the graphical user interface B. 1.5-30V DC Power Supply
(LCD). Date/Time, Sampling Rate, A/D Conversion factors This power supply is able to provide DC voltages between
and Data synchronization with the PC can all be configured (1.5 - 30 Volts) with user defined current limit (0.01 – 5
using these menus. In addition, the user can watch the sensor Amps). The output power will be switched off as soon as the
readings on the LCD in real time. The final task done is the drawn current exceeds the predefined current limit. The
transfer of data from the MMC card to the PC using a USB Voltage regulator used in this power supply is LM350.
module. ATmega8 microcontroller was also used to measure the output
The USB interface is implemented using a FT245BM voltage, the flowing current, and to determine the current
module which supports USB 1.1 and 2.0. Data throughput limit. The previous measurments can be performed using the
reaches 300 Kbyte/s. (10 bit built-in ADC) in the ATmega8 microcontroller.
A measurment error correction algorithm was applied, in
order to make sure that changes in the temperature due to the
current flow through resistors will not cause any changes in
the accuracy of voltage and current measurements. it is well
known that the higher the current through the resistor, the
larger the power dissipated through the resistor. Thus, its
resistance will change. The change of the resistance will
introduce a multiplicative error in the measurement of the
voltage and the current in the microcontroller. The block
diagram shown in the Fig. 6 provides one method to get rid of
the multiplicative error.
The algorithm can be explained as follows: if the system is
measuring the real value (X) and the multiplicative error is
(α). The microcontroller will then read the value as:

Figure 7. Automatic Telephone Switch.


(1)
Finally the Power Supply was provided with a character
The processor will feed the measured value (αX) into the LCD to show the output voltage, the current limit, and the
feedback loop to measure it again. current drawn from the supply. It is very stable and safe to
use, and its price range is extremely competitive when

compared with its commercial equivalents.
(2)
′′ ′ C. Automatic Telephone Switch (ATS) system
In the second iteration the microcontroller will use (Y'') in This switcher provides eight internal lines, and one
the feedback loop, this will result in the following: external line. It can also serve both pulse and tone dialing
schemes. ATmega8515 was used as a main control unit. This
′′′ ′′
(3) system can serve two users simultaneously (they can dial at
the same time). Voice messaging was also implemented in the
system, where the external caller can leave a voice message
The output of the second iteration is then: for any one of the eight users in the system. A caller
identification circuit was also implemented such that the
′′ ′′′
(4) switcher can detect the caller ID that the public switching
For example if (X=1) and the multiplication factor is (α = telphone network (PSTN) sends (Fig. 7).
0.9). the first measurment will be (Y = 0.9) this value will be VI. CONCLUSIONS
fed back into the system and (Y' = 0.9*0.9 = 0.81) and the
Both peer and student feedback was inspiring and
correction after the first iterration is (Y'' = 1.8 – 0.81 = 0.99).
extremely positive. The authors hope that this lab be a positive
After the second iteration we get (Y''' = 0.891) and the step in developing a complete embedded systems curriculum
final value is (Y= 0.999). It is clear that the error was greatly at local universities.
decreased after two iterations only.
ACKNOWLEDGMENT
The authors would like to thank Rami Zakaria for
maintaining the Nawatt website and Ahmed Banah, Munzer
Dabaa, Nasro Salem, Muhammed Horani and Dr. Ahmed
Rajeb Boshnaq for their contributions to this work.
REFERENCES
[1] Torroja, Y.; Garcia, O.; Riesgo, T.; de la Torre, E., "Teaching embedded
systems and microcontrollers using scale models," Industrial Electronics
Society, 2005. IECON 2005. 31st Annual Conference of IEEE , vol., no.,
pp. 4 pp.-, 6-10 Nov. 2005.
[2] BASCOM AVR Basic compiler. http://www.mcselec.com .last accessed
14 February 2008.
[3] Proteus VSM Simulator. http://www.labcenter.co.uk . last accessed 14
Febraury 2008.
Figure 6. DC Power Supply Block Diagram. [4] Salem, Z.; Al Kamal, I.; Al Bashar, A., "A Novel Design of an Industrial
Data Acquisition System," Information and Communication
Technologies, 2006. ICTTA '06. 2nd , vol.2, no., pp. 2589-2594, 2006.

You might also like