household appliances control for disabled persons by zahraa taj
TRANSCRIPT
HOUSEHOLD APPLIANCES CONTROL FOR
DISABLED PERSONS
By
ZAHRAA TAJ ELSSIRMOHAMMED AHMED
INDEX NO. 074036
Supervisor
Dr. Abd-ElRahman Ali Karar
A thesis submitted to
University of Khartoum
Faculty of Engineering
In fulfillment of requirements for the award of the degree of
B.Sc. (HONS) Electrical and Electronic Engineering
(Communication Engineering)
Faculty of Engineering
Department of Electrical and Electronic Engineering
September 2012
Declaration of originality
I declare that this report entitled ― “HOUSEHOLD APPLIANCES CONTROL
FOR DISABLED PERSONS” is my own work except as cited in the references. The
report has not been accepted for any degree and is not being submitted concurrently
in candidature for any degree or other award.
Signature: _________________________
Name: Zahraa Taj Elssir Mohammed Ahmed
Date: _____________________________
Dedication
To my parents
To siblings
To my teachers
To my friends in 07 batch
Acknowledgement
Thanks to Allah the almighty for giving me health and power to
finish this dissertation … I would like to acknowledge my supervisor Dr. Abd-ElRahman
Ali Karrar who offered valuable comments and advises …
Thanks are extended to my colleague Ghada Suliman for her
cooperation and time sharing of her effort. Thanks are also due
to all the technicians in the department and for all my colleagues
and for everybody helped and encouraged me.
Abstract
Remote control is having a great impact in making life easier; it is a device has an
ability to control apparatus from a distance by means of signals. In this project we
presented design of a simple universal remote control that have the ability to control
multiple electrical devices.
The goal of this thesis is design low-cost device and easy to use for physically
disabled people with limited mobility who they cannot move to operate electrical
household appliances so they need a simple device that allow them to control these
appliances without needing help.
The universal remote control is the solution from this problem, this thesis discuss the
design and implementation of the universal remote control using USART protocol
that provide serial transmission of the commands that operate the electrical devices
from the transmitter to the receiver device, these commands are transmitted using
infrared radiation emitted by the IR led transmitter and received by IR sensor. The
system based on microcontrollers so sit offers the advantage of having small size,
light weight and portability which provide the simplicity and the ease of use. The
efficiency of this system could be improved by further optimizations. Also further
work is needed to improve the system and more devices can be added to be controlled
and operated.
المستخلص
هو جهاز له القدرة على التحكم في الأجهزة من مسافة , جهاز التحكم عن بعد له أثر كبير في تسهيل الحياة
قدمنا تصميم جهاز تحكم عن بعد عالمي له القدرة على التحكم في عدد من في هذا المشروع . باستخدام الإشارات
.الأجهزة الكهربائية
خفض التكلفة و سهل الإستعمال للأشخاص ذوي الإعاقة الجسدية الهدف من هذه الأطروحة هو تصميم جهاز من
لذا يحتاجون إلى جهاز بسيط , ومحدودي الحركة ولا يستطيعون التحرك للقيام بتشغيل العدد الكهربائية البيتية
.يمكنهم من التحكم في هذه العدد بدون الحوجة إلى المساعدة
هذه الأطروحة تناقش تصميم وتنفيذ جهاز التحكم , حل لهذه المشكلةجهاز التحكم عن بعد العالمي هو ال
الذي يزود بنظام إرسال تسلسلي للأوامرالتي تشغل الأجهزة الكهربائية من , USARTنظام عن بعد بإستخدام
ي الباعث هذه الأوامر يتم إرسالها بإستخدام الأشعة تحت الحمراء التي يتم بعثها بإستخدام الثنائ. المرسل للمستقبل
يعتمد عمل النظام على المتحكمات المنطقية مما . للضوء و يتم إستقبالها بإستخدام حساس للأشعة تحت الحمراء
يمكن تحسين كفاءة هذا . يكسبه حجماً صغيراً و وزناً خفيفاً و قابلية للنقل الذي يكسبه البساطة و سهولة الإستخدام
يحتاج إلى عمل مستقبلي لتحسين النظام و إضافة عدة أجهزة لتشغيلها و كذلك , النظام بإجراء عدة تحسينات عليه
.و التحكم بها
Table of Contents
DECLARATION OF ORIGINALITY ..................................................................... I
DEDICATION………………...……..………………………………………………II
ACKNOWLEDGMENT ......................................................................................... III
ABSTRACT .............................................................................................................. IV
.................................................................................................................... V المستخلص
LIST OF FIGURES .............................................................................................. VIII
1 INTRODUCTION ................................................................................................. 1
1.1 Overview................................................................................................................... 1
1.2 Problem Statement .................................................................................................... 1
1.3 Motivation ................................................................................................................. 2
1.4 Objective ................................................................................................................... 2
1.5 Thesis Layout ............................................................................................................ 3
2 Literature Review .................................................................................................. 4
2.1 Overview................................................................................................................... 4
2.2 Assistive technologies for Disabled people ................................................................ 4
2.3 Remote control evaluation .......................................................................................... 5
2.4 Remote-control Features .............................................................................................. 6
2.4.1 Universal capabilities ............................................................................................ 6
2.4.2 Learning ............................................................................................................... 7
2.4.3 Macro commands ................................................................................................. 7
2.4.4 PC connectivity .................................................................................................... 7
2.4.5 User Interfaces ...................................................................................................... 7
2.4.6 RF extenders ......................................................................................................... 7
2.4.7 Touch-screen remotes ........................................................................................... 8
2.5 Remote control Types .................................................................................................. 8
2.5.1 RF remote controls ............................................................................................... 9
2.5.2 IR remote control .................................................................................................. 9
2.6 Infrared Radiation ....................................................................................................... 9
2.6.1 Infrared characteristics ........................................................................................ 10
2.6.2 Usage of Infrared ................................................................................................ 11
2.7 Infrared emitters LED (Transmitter) .......................................................................... 11
2.8 Infrared sensor (receiver) ........................................................................................... 12
2.9 IR protocols............................................................................................................... 13
2.9.1 RC5 protocol ...................................................................................................... 14
2.9.2 SIRC Protocol .................................................................................................... 14
2.10 Modulation & Demodulation ................................................................................... 14
2.10.1 Modulation ....................................................................................................... 14
2.10.2 Demodulation ................................................................................................... 16
2.10.3 Infrared Modulation and Demodulation ............................................................ 16
2.11 Microcontrollers ...................................................................................................... 16
2.11.1 The 8, 16 and 32-Bit Microcontrollers ............................................................... 18
2.11.2 Embedded and External Memory Microcontrollers............................................ 18
2.11.3 CISC and RISC Architecture Microcontrollers .................................................. 19
2.11.4 Harvard and Princeton Memory Architecture Microcontrollers .......................... 20
2.12 Microcontroller interface ......................................................................................... 20
2.13 Keypad interface ..................................................................................................... 20
2.14 Serial Communication ............................................................................................. 21
2.15 The UART .............................................................................................................. 22
2.15.1 Serial Transmission 22
2.15.2 Asynchronous Serial Transmission ................................................................... 23
2.16 The ATmega32 USART .......................................................................................... 24
2.16.1 USART Clock Generator .................................................................................. 26
2.16.2 USART Transmitter .......................................................................................... 26
2.16.3 USART Receiver .............................................................................................. 27
2.16.4 USART Registers ............................................................................................. 27
3 Design and Implementation .............................................................................................. 29
3.1 Overview................................................................................................................... 29
3.2 High level Design ...................................................................................................... 29
3.3 Materials and tools ................................................................................................... 30
3.3.1 Software tools ..................................................................................................... 30
3.3.2 Hardware tools ................................................................................................... 30
3.4 Pre-Design Hardware tests ......................................................................................... 31
3.4.1 Sending light pulses using IR led and IR receptor................................................ 31
3.4.2 Generating the commands Using Microcontroller ............................................... 33
3.4.3 Generating the carrier signal ............................................................................... 34
3.4.4 USART .............................................................................................................. 34
3.5 Design of the system ................................................................................................. 35
3.6 Over all circuit Design ............................................................................................... 38
4 The Results and Discussion ............................................................................................. 40
4.1 RESULTS ............................................................................................................... 40
4.1.1 Simulation Results .............................................................................................. 40
4.1.2 Hardware results ................................................................................................ 44
4.2 Discussion ............................................................................................................... 50
4.2.1 Simulation Discussion ........................................................................................ 50
4.2.2 Hardware ........................................................................................................... 51
5 Conclusion .................................................................................................................. 53
5.1 Problems and limitations ........................................................................................... 53
5.2 Future work ............................................................................................................... 54
References ………………………………………………………………………………….55
Appendix A .............................................................................................................................A1
Appendix B ............................................................................................................................B1.
Appendix C ............................................................................................................................C1.
Appendix D ............................................................................................................................D1
Appendix E ............................................................................................................................E1
Appendix F .............................................................................................................................F1
Table of figures
Figure 2-1: Zenith Space Command ...................................................................................... 6
Figure 2-2 light spectrum diagram ...................................................................................... 10
Figure 2-3 IR LED .............................................................................................................. 12
Figure 2-4 IR receptor ......................................................................................................... 13
Figure 2-5 ASK Modulation. ............................................................................................... 16
Figure 2-6 MC Chip at PCB. B) ATmega32 pin out ........................................................... 17
Figure 2-7 MCU Architecture ............................................................................................. 17
Figure 2-8 4*4 keypad........................................................................................................ 21
Figure 2-9 Keypad interface with microcontroller................................................................ 21
Figure 2-10 USART Frame Format ..................................................................................... 25
Figure 2-11 Internal structure of USART. ........................................................................... 25
Figure 2-12 USART registers. ............................................................................................. 28
Figure 3-1 The high level design ......................................................................................... 29
Figure 3-2 IR LED .............................................................................................................. 30
Figure 3-3 TSOP1738 ......................................................................................................... 31
Figure 3-4 Sending and receiving IR radiation ..................................................................... 31
Figure 3-5 IR transmitter receiver circuit ............................................................................. 32
Figure 3-6 Generating command using microcontroller ....................................................... 33
Figure 3-7 generating many commands according to the keypad.......................................... 33
Figure 3-8 Generating the carrier using microcontroller ....................................................... 34
Figure 3-9 Sending the command using weird USART ....................................................... 35
Figure 3-10 Sending the modulated signal using IR led ....................................................... 36
Figure 3-11 Receiving the command using IR receptor ........................................................ 37
Figure 3-12 Sending the command and receiving it using IR led and IR receptor ................. 37
Figure 3-13 Sending the commands to the receivers ............................................................ 39
Figure 4-1 The modulating signal ........................................................................................ 40
Figure 4-2 The carrier signal ............................................................................................... 41
Figure 4-3 The modulated signal ......................................................................................... 41
Figure 4-4 The modulating signal. The carrier signal. The modulated signal ........................ 42
Figure 4-5 The command signal generated by microcontroller. ............. Error! Bookmark not
defined.
Figure 4-6 The carrier signal generated by microcontroller ..... Error! Bookmark not defined.
Figure 4-7 The modulated signal ......................................................................................... 43
Figure 4-8 The modulating signal. The carrier signal. The modulated signal ........................ 44
Figure 4-9 The wired USART ............................................................................................. 44
Figure 4-10 The modulating signal generated by function generator .................................... 45
Figure 4-11 The carrier signal generated by function generator ........................................... 45
Figure 4-12 The modulated signal ....................................................................................... 46
Figure 4-13 The received signal by TSOP1738 IR receptor ................................................. 46
Figure 4-14 The signal transmitted using wired USART ...................................................... 47
Figure 4-15 High level signal .............................................................................................. 47
Figure 4-16 Zero level signal ............................................................................................... 48
Figure 4-17 The command signal generated by microcontroller. .......................................... 48
Figure 4-18 The carrier signal generated by microcontroller ................................................ 49
Figure 4-19 the modulated signal........................................................................................ 49
Figure 4-20 Signal received by IR receptor .......................................................................... 50
[INTRODUCTION] Chapter1
Page 1
Chapter One
1 INTRODUCTION
1.1 Overview
Ever since the existence of mankind, the goal of humans has forever been to make
life simpler. Today, we are in the middle of what many are calling the Wireless Age,
there is tending to use wireless technology in all aspects of the life, environmental
control is one of the important issues in the world that allow controlling various
consumer electronics.
Research and development has been conducted on technology designed to incorporate
control systems to activate these consumer electronics, there is an abundance of work
A variety of operation devices have conducted on environmental control technology.
been developed but they are complex and expensive.
1.2 Problem Statement
Disability is a physical or mental impairment which has a substantial and long term
adverse effect on their ability to carry out normal day activities [1]. The number of
disable people is increasing rapidly for many reasons like accidents that could cause
injuries such as high level spinal injuries or they are naturally born with limited
abilities. People living with a severe disability suffer substantial personal and social
consequences that reduce quality of life. One potential negative impact on the life of
disabled person is the loss of the ability to control devices in their immediate
environment; they cannot be able to live their life like normal people because of their
limited mobility so they always need someone for help in small activities like,
switching ON and OFF lights, opening and closing doors turning ON and OFF water-
taps. For disabled people being dependent on others in every aspect of their lives
makes them feel that they are a burden on those around them, and lead to an increased
tensions in family/ partner relationships as a result of an almost complete dependence,
[INTRODUCTION] Chapter1
Page 2
so there exists a demand for finding a way to allow them to do these small activities
by themselves to enhance their quality of life.
1.3 Motivation
The provision of assistive technology that permits a disabled person to regain some
control over their living environment that they have lost due to their impairment to
allow them to be able to deal with household appliances by themselves without
needing their relatives to be with them all the time by providing a system that enable
them to control many kinds of domestic appliances and other functions by universal
remote control, it is a solution for enhancing rehabilitation outcomes of the severely
disabled is to reduce the level of their dependence or conversely, enhance their
independence.
. A great number of benefits would stem from the implementation of universal remote
control for disabled people:
Making life easier for those people with limited mobility.
Allowing independence to be maintained.
Saving time of their relatives and people around them.
Autonomy and self-steam, and consequently, better relationships with their
relatives.
1.4 Objective
The system design aims to provide solution to the problem of disabled people using a
simple and cheap technology so all disabled people can be able to use it. Infra red
holds great potential for enabling people with a variety of disabilities to technology
taps, television, and -Such as air conditioners, doors, light bulbs, watercontrol devices
video. Infra red has the advantages of portability and low installation costs. The
limitation of infra red is that the controlling device must broadly be pointing at the
appliance to be controlled.
The objective of the project is to design a universal remote control to operate many
types of household appliances using infrared radiation to transmit the commands to
the controlled device via USART protocol, and to provide the information and control
[INTRODUCTION] Chapter1
Page 3
necessary to allow people with different disabilities to access and use different
electronic appliances effectively, and to create the smallest and simplest set of
commands that will provide the greatest flexibility.
1.5 Thesis Layout
The thesis is decomposed into five chapters:
Chapter 2 (Literature review): this chapter reviews the history of the remote control
its evaluation and it's features, and the component used to implement it, and the
technologies used for physically disabled people. It also discusses the basic theories
applicable for this project. Discussion on these theories is based on the background
studies or literature reviews. It covers mainly on concept of transmitter, receiver and
USART protocol.
Chapter 3 (Design and implementation): This chapter begins to discuss the high
level design then the detailed design. All hardware and software design steps are
considered here including all requirements, tools, and implementation of the system
design plan.
Chapter 4 (results and discussion): This chapter describes the results obtained from
the design described in chapter 3 and the discussion and interpolation of the obtained
results.
Chapter 5 (Conclusions): this chapter contains a conclusion of system performance
and the problems faced when implementing the design, and recommended future
work.
INTRODUCTION Chapter1
Page1
Page2
Page3
Page4
Page5
[LITERATURE REVIEW] Chapter2
Page4
Chapter Two
2 Literature Review
2.1 Overview
No doubt, the comfort provided by remote controls is essential especially for disabled
person to allow him to control many aspects of his home environment from a single
unit
. Infrared (IR) remote controls have proven being a cost efficient solution for
controlling many kinds of electronic devices: Home entertainment, air condition,
home lighting. , door intercom, water taps, and domestic appliances such as
television, radio, and video recorder.
2.2 Assistive technologies for Disabled people
An "assistive technology device" is any item, piece of equipment, or product
ed to increase, maintain, or improve functional capabilities of system...that is us
An "assistive technology service" is any service that individuals with disabilities.
directly assists an individual with a disability in the selection, acquisition, or use of an
.]2[ chnology device"assistive te
Examples of Assistive technologies [2]:
Augmentative communication – manual and electronic communication aids to
help a nonverbal individual to communicate and socialize with other people.
Environmental controls – making a switch larger or a device easier to use can
increase the ability of people with physical disabilities to independently
control their environment. Examples include turning on the television, lights,
and appliances; answering the phone; opening doors; and steering an electric
wheelchair.
Custom seating systems designing a wheelchair insert that is fitted to the shape
of an individual (without compromising the ability to maximize trunk strength
[LITERATURE REVIEW] Chapter2
Page5
where applicable) can promote healthy body system functioning, prevent skin
breakdown, and improve learning/participation in all life areas.
Postural supports inserted into a power wheelchair to help a person sit in a
comfortable position and reduce abnormal muscle tone. The person can then
work at a desk or table along with friends and classmates, and generally
participate in more activities.
Independent mobility is a first step toward independent living. Many kinds of
power wheelchairs are available. The controls can be placed to match a
person's particular abilities.
2.3 Remote control evaluation
The first example of remote control was developed in 1898 by Nikola Tesla, named
Method of an Apparatus for Controlling Mechanism of Moving Vehicle or Vehicles.
It was a radio-controlled boat called "teleautomaton" [3].
In 1903, Leonardo Torres Quevedo presented the Telekino .The Telekino consisted
of a robot that executed commands transmitted by electromagnetic waves. It was a
pioneer in the field of remote control.
By the late 1930s, several radio manufacturers offered remote controls for some of
their higher-end models [4] . Most of these were connected to the set being controlled
by wires, but the Philco Mystery Control (1939) was a battery-operated low-
frequency radio transmitter [5], thus making it the first wireless remote control for a
consumer electronics device.
In the field of controlling televisions the first remote intended was developed by
Zenith Radio Corporation in 1950. The remote, called "Lazy Bones", it was
connected to the television by a wire. A wireless remote control was developed in
1955 called Flashmatic", It worked by shining a beam of light onto a photoelectric
cell [6].
In 1956, a wireless remote was developed called "Zenith Space Command" [7]. It
was mechanical and used ultrasound to change the channel and volume. When the
[LITERATURE REVIEW] Chapter2
Page6
user pushed a button on the remote control, it clicked and struck a bar ". Each bar
emitted a different frequency and circuits in the television detected this sound, figure
2.1 show Zenith space command.
Figure 2-1: Zenith Space Command
The invention of the transistor made possible cheaper electronic remotes that
contained a piezoelectric crystal that was fed by an oscillating electric current at a
frequency near or above the upper threshold of human hearing. The receiver contained
a microphone attached to a circuit that was tuned to the same frequency. Some
problems with this method were that the receiver could be triggered accidentally by
naturally occurring noises, and some people could hear the piercing ultrasonic signals.
There was an incident in which a toy xylophone changed the channels on such sets
because some of the overtones from the xylophone matched the remote's ultrasonic
frequency, figure 2.1 display Zenith Space Command.
2.4 Remote-control Features
The features on some of the higher-tech remote controls are [8]:
2.4.1 Universal capabilities
Different electronics brands use different command codes. Some IR remotes
are preprogrammed with more than one manufacturer's command codes so they can
operate multiple devices (sometimes up to 15) of different brands. If the home-theater
setup incorporates components from different manufacturers, multiple remotes are
used to operate the system, one for each component, or use one universal remote, to
add functions to a universal remote, the command codes for each component must be
known, so the universal remote control will be able to control all of these components.
[LITERATURE REVIEW] Chapter2
Page7
2.4.2 Learning
Learning remote can receive and store codes transmitted by another remote
control; it can then transmit those codes to control the device that understands them. If
there is a receiver with its own preprogrammed remote, and there is a universal
learning remote. The learning remote can pick up the signals that the other remote
sends out and remember them so it can control the receiver, we don't need to input the
command codes, the learning remote picks up and stores the signals another remote
sends out. All learning remotes are considered universal remotes because they can
control more than one device.
2.4.3 Macro commands
A macro is a series of commands that are programmed to occur sequentially at
the push of a single button. These macros can be anything, such as an "activity
command." You can set up a macro that lets you push one button to activate, in order,
everything that needs to happen for you to watch a movie or listen to a CD.
2.4.4 PC connectivity
There are remotes that connect to PC via the USB port so programming software
can be installed and command codes can be downloaded and graphic icons can be
personalized (for remotes with LCD screens).
2.4.5 User Interfaces
Most remotes still utilize the simple button-pushing method, but some have
more high-tech manners of inputting commands. There are remote controls that are
being operated via an LCD touch screen, a joystick (for directional commands) and
even voice commands.
2.4.6 RF extenders
Some IR remotes can send out both IR and RF signals. The RF signals aren't
meant to control RF devices (in fact, they can't control them). They're meant to extend
the operating range of the IR remote control from about 30 feet to about 100 feet and
allow the signal to penetrate walls and glass cabinet enclosures. The remote
[LITERATURE REVIEW] Chapter2
Page8
automatically transmits both IR and RF signals for every command. When an RF-to-
IR converter is hooked up (sometimes included with IR/RF remotes, sometimes sold
as add-ons) on the receiving end, it receives and converts the signal back into the
infrared pulses the device can understand.
2.4.7 Touch-screen remotes
These remotes feature an LCD screen that can be either monochrome or full
color. The "buttons" are actually images on the screen, which, when touched, will
send IR signals to controlled devices. Some models have multiple screens that are
accessed through virtual buttons on the touch-screen and other models have a
combination of the touch-screen and physical buttons.
Some models of the touch-screen remotes are programmed using a graphical interface
program on a PC, which allows the user to customize the screens, backgrounds,
buttons and even the "actions" the buttons perform. The "project" that is created is
then downloaded into the remote through a USB cable or, in the most recent models,
wirelessly by Bluetooth or Wi-Fi.
The newest touch-screen remotes, such as the Logitech 900 and 1100, include an RF
transmitter to allow signals to reach locations much farther than the usual range of IR
(approximately 6 meters). RF also does not require line of sight.
Most commercial remote controls at that time had a limited number of functions,
sometimes as few as three: next channel, previous channel, and volume/off. In 1970s
with the development of the Ceefax teletext service where pages were identified with
three-digit numbers. A remote control to select teletext pages would need buttons for
each numeral from zero to nine, as well as other control functions, such as switching
from text to picture, and the normal television controls of volume, channel,
brightness, color intensity, etc [9].
2.5 Remote control Types
There are two types of remote controls: IR remote controls and RF remote controls
[LITERATURE REVIEW] Chapter2
Page9
2.5.1 RF remote controls
Radio frequency communication uses electromagnetic waves as transmission
medium. Their propagation properties allow connections of extremely high distances.
Electromagnetic waves pass through non‐shielding materials to some extent (e.g.
concrete walls). This attractiveness demands some limitation enforced by world‐wide
regulations defined by standardization groups (e.g. ETSI, FCC …). For all regions of
the world there exist binding regulations covering following aspects [10]:
• Frequency bands (spectrum)
• Maximal power of emitted radio waves
• Bandwidth of emitted signal
• Duration of emissions (duty‐cycle)
• Purpose of emission (e.g. TV broadcast, mobile phone networks, authority’s
communication, general purpose)
• License fees.
2.5.2 IR remote control
Infrared remote controls use invisible light pulses below the visible wavelength
spectrum (approx. 950nm). In terms of its radiation behavior it is like any other
visible source of light.
2.6 Infrared Radiation
than those wavelengths with longer electromagnetic radiation (IR) light is Infrared
at visible spectrum edge of the red , extending from the nominalvisible light of
, figure 2.2 show the light spectrum diagram.]11[µm (µm) to 300 micro meters 0.74
Infrared light can be split into three categories [12]:
Near-infrared (near-IR) - Closest to visible light, near-IR has wavelengths that range
from 0.7 to 1.3 microns (µm), or 700 billionths to 1,300 billionths of a meter.
[LITERATURE REVIEW] Chapter2
Page10
Mid-infrared (mid-IR) - Mid-IR has wavelengths ranging from 1.3 to 3 microns. Both
near-IR and mid-IR are used by a variety of electronic devices, including remote
controls.
Thermal-infrared (thermal-IR) - Occupying the largest part of the infrared spectrum,
thermal-IR has wavelengths ranging from 3 microns to over 30 microns.
Figure 2-2 light spectrum diagram
2.6.1 Infrared characteristics
Infrared radiation has the following characteristics:
1- Invisible to human eyes: This is useful for security applications, but
sometimes makes measurements and optical system design difficult.
2- Small energy: Infrared radiation energy is equal to the vibration or rotational
energy of the molecules. This phenomenon makes it possible to identify
molecules.
3- Long wave length: This means infrared radiation is less scattered and offers
better transmission through various medium.
4- Emitted from all kinds of objects.
[LITERATURE REVIEW] Chapter2
Page11
2.6.2 Usage of Infrared
Infrared is used in a variety of wireless communications, monitoring, and
control applications. Here are some examples:
Home-entertainment remote-control boxes.
Wireless (local area networks).
Links between notebook computers and desktop computers.
Motion detectors.
Fire sensors.
Night-vision systems (Military).
Medical diagnostic equipment.
Geological monitoring devices.
2.7 Infrared emitters LED (Transmitter)
Transmitter = LED (Light Emitting Diode)
produces light light source that semiconductor (LED) is a emitting diode-light A
ceive an electric current, by converting the energy of electrons in the when they re
LEDs are used as indicator lamps in many devices and are electric current to light.
. Appearing as practical electronic components in lighting increasingly used for other
intensity red light, but modern versions are -early LEDs emitted low.]11[ 1962,
, with very high wavelengths infrared , andultraviolet ,visible available across the
brightness. Different types of LEDs produce different wavelengths of light. Infrared
mbol and Figure 2.3 shows electronic sy LEDs produce light in the range of infrared.
important parts of LEDs.
[LITERATURE REVIEW] Chapter2
Page12
Figure 2-3 IR LED
The purpose of the transmitter is to transform the information need to be sent into a
signal that can be propagated by the channel (air, fiber optics, coaxial wires, etc…).
cal create the infrared signal from an electri-Infrared signal emitters are used to re
signal. Most of them are designed to stick to the front of a consumer electronics
shelf, -the-device and blink the IR signal directly into the device. There are many off
commercially available, IR LED emitters that can be used for a discrete infrared
ansceiver circuit design. There are also a number of integrated transceivers that the tr
designer can choose as well.
In general, there are four characteristics of IR emitters that designers have to be ware
:]12[of
• Rise and Fall Time.
• Emitter Wavelength.
• Emitter Power.
angle.-• Emitter Half
2.8 Infrared sensor (receiver)
Receiver = Photodiode/IR Transistor
A photodiode is a diode that conducts only when light falls on it.
[LITERATURE REVIEW] Chapter2
Page13
A sensor is a device that produces a measurable response to a change in a physical
condition, such as temperature or thermal conductivity, or to a change in chemical
concentration. A sensor when coupled with an electronic circuit converts the physical
change into a signal which can be read by an observer or by an instrument. The most
common use of sensors is to get feedback from external environment figure 2.4 shows
.Infrared sensorthe
Figure 2-4 IR receptor
is a transducer of radiant energy, converting radiant infrared sensor (detector) An
energy in the infrared into a measurable form. The two main types of detectors are
thermal and photonic (Quantum).
of incoming radiation causing a change Thermal detectors operate by the absorption
in temperature of the detector and by the sensitivity of some measurable parameter
(ex. resistance) to that temperature. Thermal detectors are typically sensitive across a
etectors depend on the direct wide range of incident wavelengths. Quantum d
interaction of the incoming light with the detector materials, resulting, for example, in
generated carriers can be -hole pair creation in a semiconductor. Photo-electron
n integration period, by measured by directly measuring charge collected during a
measuring photocurrent, by a change in resistance (photoconductive), or by voltage
. ]13[ generation across a junction (photovoltaic)
2.9 IR protocols
[LITERATURE REVIEW] Chapter2
Page14
Different protocols are established, some of them are standards or at least de‐ facto
standards. All of them show a different number of information bits, different
modulation and coding, and different data rates.
2.9.1 RC5 protocol
The RC5 code is a 14-bit word, it uses bi-phase modulation (also called
Manchester coding) of a 36 kHz IR carrier frequency.
2.9.2 SIRC Protocol
bit word; it uses modulation of a 40 kHz IR carrier -The SIRC code is a 12
h pulse is a frequency. The SIRC protocol uses pulse distance encoding of the bits. Eac
600μs long 40 kHz carrier burst. A logical "1" takes 1.8 ms to transmit, while a
.]9[ logical "0 takes 1.2 ms to transmit
2.10 Modulation & Demodulation
Every communications link involves a transfer of energy from one point to
another. The energy originates from a transmitter, travels through the “channel” (air,
cables, fiber optics, etc…), and is ultimately detected by a receiver. The -coaxial
istinctive feature of a communications system is that the signal is encoded with some d
information in some fashion. This means that information needs to be transformed
into a modulated voltage level.
2.10.1 Modulation
-ing one or more properties of a highis the process of vary Modulation
modulating , with acarrier signal , called thewaveform frequency periodic
, telecommunications which typically contains information to be transmitted. In lsigna
modulation is the process of conveying a message signal, for example a digital bit
audio signal, inside another signal that can be physically analog or an stream
known as a modulator and a . A device that performs modulation is ]14[ transmitted
.demodulator device that performs the inverse operation of modulation is known as a
Modulation could be digital or analogue.
[LITERATURE REVIEW] Chapter2
Page15
2.10.1.1 Analogue Modulation
modulation, the modulation is applied continuously in response to analog In
the analog information signal.
2.10.1.2 Digital Modulation
modulation, an analog carrier signal is modulated by a discrete digital In
signal.
:keying The most fundamental digital modulation techniques are based on
phases are used., a finite number of shift keying)-PSK (phase In the case of
, a finite number of frequencies are used.shift keying)-FSK (frequency In the case of
, a finite number of amplitudes are usedshift keying)-ASK (amplitude In the case of
.]14[
Amplitude-shift keying (ASK) is a form of modulation that represents digital data as
variations in the amplitude of a carrier wave.
Any digital modulation scheme uses a finite number of distinct signals to represent
digital data. ASK uses a finite number of amplitudes, each assigned a unique pattern
of binary digits. Usually, each amplitude encodes an equal number of bits. Each
pattern of bits forms the symbol that is represented by the particular amplitude.
The modulating signal in the form of a square wave, or pulse train, so the carrier is
modulated by the pulse train. This is known as on-off ASK or on-off keying (OOK).
The presence of the modulating pulse is indicated by a carrier signal and the absence
of that pulse is indicated by a zero level signal.
For LED transmitters, binary 1 is represented by a short pulse of light and binary 0
by the absence of light.
Figure 2.5 show ASK modulated signal.
[LITERATURE REVIEW] Chapter2
Page16
Figure 2-5 ASK Modulation.
2.10.2 Demodulation
bearing signal from -is the act of extracting the original information Demodulation
computer (or electronic circuit is an demodulator . Acarrier wave a modulated
) that is used to recover the information content defined radio-software in a program
.]15[ carrier wave from the modulated
2.10.3 Infrared Modulation and Demodulation
Infrared modulation is a technique that involves modulating an Infrared led at a
certain frequency (ex. 38 KHz) to 'bypass' the IR radiation from ambient light. The IR
ly accepts 38 kHz modulation, filters out everything else, and gives a demodulator on
t is a cheap technology and could be easily interfaced with clean logic (0 or 1) output, i
microcontrollers/logic analyzers.
2.11 Microcontrollers
A microcontroller (µC or MCU) is a small computer on a single integrated
circuit containing a processor core, memory, and programmable input/ output
peripherals. Program memory in the form of NOR flash or OTP ROM is also often
included on chip, as well as a typically small amount of RAM. Microcontrollers are
designed for embedded applications, in contrast to the microprocessors used
in personal computers or other general purpose applications. See Figure 2.6.
[LITERATURE REVIEW] Chapter2
Page17
Microcontrollers are used in automatically controlled products and devices, such as
automobile engine control systems, implantable medical devices, remote controls,
office machines, appliances, power tools, toys and other embedded systems [16].
Figure 2-6 MC Chip at PCB. B) ATmega32 pin out
Figure 2.7 show the various types of microcontrollers. The microcontrollers are
classified in terms of internal bus width, embedded microcontroller, instruction set,
memory architecture, IC chip or VLSI core, file and family. For the same family,
there may be various versions with various sources.
Figure 2-7 MCU Types
[LITERATURE REVIEW] Chapter2
Page18
2.11.1 The 8, 16 and 32-Bit Microcontrollers
a) 8-bit microcontroller: When internal bus in an MCU is 8-bit bus and the ALU
performs the arithmetic and logic operations on a byte at an instruction, the
MCU is 8-bit microcontroller. Examples of 8-bit MCUs are Intel 8031/8051,
PIC1x and Motorola MC68HC11 families.
b) 16-bit microcontroller: When internal bus in an MCU is 16-bit bus and the
ALU performs arithmetic and logic operations on the operand words of 16 bits
at the instructions, the MCU is 16-bit microcontroller. Important 16-bit MCUs
are extended 8051XA, PIC2x, Intel 8096 and Motorola MC68HC12 families.
16-bit MCU provides greater precision and performance as compared to the 8-
bit MCU.
c) 32-bit microcontroller: When internal bus for the data transfer operations in an
MCU is 32-bit bus and the ALU performs arithmetic and logic operations on
operand words of 32 bits at the instructions, the MCU is 32-bit
microcontroller. Important 32-bit MCUs are Intel/Atmel 251 family, PIC3x,
Motorola M683xx and ARM 7 or 9 or 11 processor-based microcontroller
families [17]. These provide greater precision and performance compared to
the 16-bit MCUs. They find applications in embedded computing systems for
applications (ex. mobile phones, MP3 audio systems, MPEG processing,
image-processing-based products and aerospace systems).
2.11.2 Embedded and External Memory Microcontrollers
a) Embedded microcontroller:
When an embedded system has an MCU that has all the hardware and software units
in a single unit, the MCU is called embedded microcontroller. Very few or no other
external unit or system is present for processing during the control or use of the
external devices. For example, a telephone handset circuit uses an embedded
microcontroller.
b) External memory microcontroller:
[LITERATURE REVIEW] Chapter2
Page19
When an embedded system has an MCU that has all the hardware and software units
present not as a single unit and has all or part of the memory unit externally interfaced
using an interfacing circuit which is called the glue circuit, the MCU is called an
external memory microcontroller. For example, 8031 has the program memory which
is interfaced externally to it. The 8051 has both internal as well as external program
memory.
2.11.3 CISC and RISC Architecture Microcontrollers
a) Complicated Instruction Set Computer (CISC) architecture microcontroller:
When an MCU has an instruction set that supports many addressing modes for the
arithmetic and logical instructions and when there are the memory accesses during the
ALU operations and the data transfer instructions, the MCU is said to be possessing
CISC-architecture.
CISC provides flexibility in choosing various ways of performing the data transfer,
arithmetic and other operations.
b) Reduced Instruction Set Computer (RISC) microcontroller:
c) When an MCU has an instruction set that supports a few addressing modes for
the arithmetic and logical instructions and just a few (load, store, push and
pop) instructions for the data transfer, the MCU is said to be of RISC
architecture. RISC provides no flexibility in choosing the many different ways
of performing the arithmetic and logic operations. These operations are
performed after the load of operands in the registers, and the results of these
operations are placed in registers. The register contents are later on stored in
the memory. RISC implements each instruction in a single cycle using a
distinct hardwired control. It uses a lesser amount of circuitry. It has less
power dissipation. There is reduced instruction set. Instructions are of fixed
number of bytes and take a fixed amount of time for execution. It has many
registers. Therefore, operations can be performed using them. The RISC
provides a higher performance in computing than the CISC. This is because
little need of the external fetches, which takes a significant amount of
processor time. High performance is also because of hardwired
implementation of instructions [17]
. These days most microprocessor and
[LITERATURE REVIEW] Chapter2
Page20
microcontroller designs are based on RISC core, because the CISC features
can always be provided for programming with an appropriate on-chip
compiler or internal circuit which translates the codes for the RISC core.
2.11.4 Harvard and Princeton Memory Architecture
Microcontrollers
a) Harvard memory architecture microcontroller:
When an MCU has a distinct memory address space for the program and data
memory, the MCU has Harvard memory architecture in the processor. The MCU has
separate instructions, and hence separate control signal(s), for the data transfers from
these two memories.
b) Princeton memory architecture microcontroller:
When an MCU has a common memory address space usable for the program memory
and data memory, the MCU has Princeton memory architecture in the processor. It
has no separate instructions, and hence no separate control signal(s) for data transfers
from and to these two sets of memories. (Program and data can be stored on the same
memory chip or unit within same address block) [17].
2.12 Microcontroller interface
Micro-controllers are useful to the extent that they communicate with other devices,
such as sensors, motors, switches, keypads, displays, memory and even other micro-
controllers.
Many interface methods have been developed over the years to solve the complex
problem of balancing circuit design criteria such as features, cost, size, weight, power
consumption, reliability, availability, manufacturability.
2.13 Keypad interface
Keypad is an input device, sometimes part of a standard computer keyboard,
consisting of a separate grid of numerical and function keys arranged for efficient data
entry. See Figure 2.8 & 2.9.
[LITERATURE REVIEW] Chapter2
Page21
Figure 2-8 4*4 keypad.
Figure 2-9 Keypad interface with microcontroller
2.14 Serial Communication
Microcontrollers must often exchange data with other microcontrollers or peripheral
devices.
They are two techniques to exchange data:
1- Parallel techniques: an entire byte of data is typically sent simultaneously from
the transmitting device to the receiver device. Although this is efficient from a
time point of view, it requires eight separate lines for the data transfer.
2- Serial input: The bits are sent one after another on a line and each bit separates
by a time interval. The receiver for serial inputs receives these bits and gets the
received byte into a buffer. The processor then reads the byte from the receive
buffer.
[LITERATURE REVIEW] Chapter2
Page22
In serial communications, the transmitter and receiver must be synchronized to one
another and use a common data rate and protocol. Synchronization is required to
allow both the transmitter and receiver to be expecting data transmission/reception at
the same time.
2.15 The UART
The Universal Asynchronous Receiver/Transmitter (UART) controller is the key
component of the serial communications. The UART takes bytes of data and transmits
the individual bits in a sequential fashion. At the destination, a second UART re-
assembles the bits into complete bytes.
The ATmega32 is equipped with a host of different serial communication subsystems,
including the Universal Synchronous and Asynchronous Serial Receiver and
Transmitter (USART), the Serial Peripheral Interface (SPI), and the Two-Wire Serial
Interface (TWI), all of these systems have in common The serial transmission of data
[18].
There are two primary forms of serial transmission: Synchronous and Asynchronous.
Depending on the modes that are supported by the hardware, the name of the
communication sub-system will usually include a’ A’ if it supports Asynchronous
communications and a’s S’ if it supports Synchronous communications. Both forms
are described below.
Some common acronyms are:
UART Universal Asynchronous Receiver/Transmitter
USART Universal Synchronous-Asynchronous Receiver/Transmitter
2.15.1 Synchronous Serial Transmission
Synchronous serial transmission requires that the sender and receiver share a clock
with one another, so that the receiver knows when to “read” the next bit of the data. In
most forms of serial Synchronous communication, if there is no data available at a
[LITERATURE REVIEW] Chapter2
Page23
given instant to transmit, a fill character must be sent instead so that data is always
being transmitted.
Synchronous communication is usually more efficient because only data bits are
transmitted between sender and receiver. Data bits are sent and received on the edge
of the clock this allows high data transfer rates. but synchronous communication can
be more costly if extra wiring and circuits are required to share a clock signal between
the sender and receiver because it requires two lines for data and clock, to connect
the receiver and transmitter.
2.15.2 Asynchronous Serial Transmission
Asynchronous transmission allows data to be transmitted without the sender having to
send a clock signal to the receiver. Instead, the sender and receiver must agree on
timing parameters in advance and special bits are added to each word to maintain
synchronization between the sending and receiving units.
When a word is given to the UART for Asynchronous transmissions, a bit called the
"Start Bit" is added to the beginning of each word that is to be transmitted. The Start
Bit is used to alert the receiver that a word of data is about to be sent, and to force the
clock in the receiver into synchronization with the clock in the transmitter. These two
clocks must be accurate enough to not have the frequency drift by more than 10%
during the transmission of the remaining bits in the word.
After the Start Bit, the individual bits of the word of data are sent, with the Least
Significant Bit (LSB) being sent first. Each bit in the transmission is transmitted for
exactly the same amount of time as all of the other bits, and the receiver “looks” at the
wire at approximately halfway through the period assigned to each bit to determine if
the bit is a 1or a 0. For example, if it takes two seconds to send each bit, the receiver
will examine the signal to determine if it is a 1 or a 0 after one second has passed,
then it will wait two seconds and then examine the value of the next bit, and so on.
The sender does not know when the receiver has “looked” at the value of the bit. The
sender only knows when the clock says to begin transmitting the next bit of the word.
[LITERATURE REVIEW] Chapter2
Page24
When the entire data word has been sent, the transmitter may add a Parity Bit that the
transmitter generates. The Parity Bit may be used by the receiver to perform simple
error checking. Then at least one Stop Bit is sent by the transmitter.
When the receiver has received all of the bits in the data word, it may check for the
Parity Bits (both sender and receiver must agree on whether a Parity Bit is to be used),
and then the receiver looks for a Stop Bit. If the Stop Bit does not appear when it is
supposed to, the UART considers the entire word to be garbled and will report a
Framing Error to the host processor when the data word is read. The usual cause of a
Framing Error is that the sender and receiver clocks were not running at the same
speed, or that the signal was interrupted.
Regardless of whether the data was received correctly or not, the UART automatically
discards the Start, Parity and Stop bits. If the sender and receiver are configured
identically, these bits are not passed to the host.
If another word is ready for transmission, the Start Bit for the new word can be sent as
soon as the Stop Bit for the previous word has been sent.
Because asynchronous data is “self synchronizing”, if there is no data to transmit, the
transmission line can be idle [19].
2.16 The ATmega32 USART
The ATmega32 USART is quite flexible. It has the capability to be set to a variety of
data transmission rates known as the baud (bits per second) rate. The USART may
also be set for data bit widths of 5 to 9 bits with one or two stop bits. See Figure 2.10.
Furthermore, the ATmega16 is equipped with a hardware-generated parity bit (even
or odd) and parity check hardware at the receiver [18].
[LITERATURE REVIEW] Chapter2
Page25
Figure 2-10 USART Frame Format
The block diagram for the USART is provided in Figure 2.11.
There are four basic pieces to the diagram: the clock generator, the transmission
hardware, the receiver hardware, and three control registers (UCSRA, UCSBR, and
UCSRC) [18].
Figure 2-11 Internal structure of USART.
[LITERATURE REVIEW] Chapter2
Page26
2.16.1 USART Clock Generator
The USART Clock Generator provides the clock source for the USART system
and sets the baud rate for the USART. The baud rate is derived from the overall
microcontroller clock source. The overall system clock is divided by the USART
baud rate registers UBRR [H: L] and several additional dividers to set the baud rate.
For the asynchronous normal mode (U2X bit = 0), the baud rate is determined using
the following expression:
Baud rate= (system clock frequency)/(2(UBRR + 1))
Where UBRR is the content of the UBRRH and UBRRL registers (0--4095). Solving
for UBRR yields:
UBRR= ((system clock generator)/ (16 × baud rate)) - 1
2.16.2 USART Transmitter
The USART transmitter consists of a Transmit Shift Register. The data to be
transmitted are loaded into the Transmit Shift Register via the USART I/O Data
Register (UDR). The start and stop framing bits are automatically appended to the
data within the Transmit Shift Register. The parity is automatically calculated and
appended to the Transmit Shift Register. Data are then shifted out of the Transmit
Shift Register via the TxD pin a single bit at a time at the established baud rate. The
USART transmitter is equipped with two status flags: the USART Data Register
Empty (UDRE) and the transmit complete (TXC) flags. The UDRE flag sets when the
transmit buffer is empty, indicating it is ready to receive new data. This bit should be
written to a zero when writing the USART Control and Status Register a (UCSRA).
The UDRE bit is cleared by writing to the UDR. The TXC flag bit is set to logic 1
when the entire frame in the Transmit Shift Register has been shifted out and there are
no new data currently present in the transmit buffer. The TXC bit may be reset by
writing a logic1 to it.
[LITERATURE REVIEW] Chapter2
Page27
2.16.3 USART Receiver
The USART Receiver is virtually identical to the USART Transmitter except
for the direction of the data flow, which is reversed. Data are received a single bit at a
time via the RxD pin at the established baud rate. The USART receiver is equipped
with the receive complete (RXC) flag. The RXC flag is logic 1 when unread data exist
in the receive buffer.
2.16.4 USART Registers
The URSEL bit (bit 7 of both registers) determines which register is being
accessed. The URSEL bit must be 1 when writing to the UCSRC register and 0 when
writing to the UBRRH register. See Figure 2.12.
UCSRA: This contains the RXC, TXC, and the UDRE bits.
UCSRB: This contains the receiver and transmitter enable bits (RXEN and TXEN,
respectively). These bits are the ‘‘on/off’’ switch for the receiver and transmitter,
respectively. The
UCSRB register also contains the UCSZ2 bit. The UCSZ2 bit in the UCSRB register
and the
UCSZ [1:0] bits contained in the UCSRC register together set the data character size.
UCSRC: This allows the user to customize the data features to the application at hand.
It should be emphasized that both the transmitter and receiver be configured with the
same data features for proper data transmission. The UCSRC contains the following
bits:
• USART mode select (UMSEL): 0, asynchronous operation; 1, synchronous
operation.
• USART parity mode (UPM [1:0]): 00, no parity; 10, even parity; 11, odd parity.
• USART stop bit select (USBS): 0, one stop bit; 1, two stop bits.
• USART character size (data width) (UCSZ [2:0]): 000, 5 bits; 001, 6 bits; 010; 7
bits; 011,
8 bits; 111, 9 bits [17].
[LITERATURE REVIEW] Chapter2
Page28
Figure 2-12 USART registers
[DESIGN AND IMPLEMENTATION] Chapter3
Page29
Chapter Three
3 Design and Implementation
3.1 Overview
This chapter is about the most important stage in the life cycle of each project, thus it
represents the biggest effort that takes the longest time among all project stages. This
chapter begins to discuss the high level design then the detailed design. All hardware
and software design steps are considered here.
3.2 High level Design
Figure 3-1 The high level design
Figure 3.1 show the overall design of the project. The first microcontroller is the
transmitting unit, it is connected with keypad which its buttons are pressed according
to the receiver device that must be operated, the transmitter generates the command
which is multiplied by a carrier (modulation) and then sent using the IR led. The IR
receptor captures the command and sends it to the microcontroller in the receiving
side which performs the required action in the application device.
[DESIGN AND IMPLEMENTATION] Chapter3
Page30
3.3 Materials and tools
The project design was implemented with aid of software and hardware tools. These
tools are discussed in this section as follows:
3.3.1 Software tools
Code vision AVR4
Code vision AVR C compiler is used in this project to compile microcontrollers'
codes before using as a reference for proteus program.
Proteus
Proteus is software for microprocessor simulation, schematic capture, and printed
circuit board (PCB) design. In this project, this program is used to simulate the
performance of the programmed microcontrollers before the hardware
implementation.
Pony-prog 2000
Pony-Prog is serial device programmer software with a user friendly GUI framework.
Its purpose is reading and writing every serial device [20]. SI-Prog is the programmer
hardware interface for Pony-Prog. They are used in this project for programming the
microcontrollers.
3.3.2 Hardware tools
The Transmitter (IR LED)
The infrared Led is used as a transmitter. It receives an electric current and converts
The and emit the light pulses. the energy of electrons in the electric current to light
blink the IR LED is designed to stick to the front of a consumer electronics device and
signal directly into the device. Figure 3.2 show IR led.
Figure 3-2 IR LED
[DESIGN AND IMPLEMENTATION] Chapter3
Page31
The receiver (IR receptor)
transmits.Infrared radiation receptor is used to capture the light pulses that the IR led
The IR receptor produces a measurable response to change in a physical condition
(receiving the infrared radiation). It converts the physical change into a signal which
can be read by an observer or by an instrument. It has improved immunity against
ambient light. Figure 3.3 show the IR receptor.
Figure 3-3 TSOP1738
Infrared remote have a range of only about 30 feet (10 meters), and it require line-of-
match the receiver for optimal , and the infrared LED's wavelength mustsight
Figure 3.4 show the transmission of the infrared radiation. performance.
Figure 3-4 Sending and receiving IR radiation
3.4 Pre-Design Hardware tests
3.4.1 Sending light pulses using IR led and IR receptor
there many other sources of light pulses like sun, light Infrared light is so ubiquitous,
can be a problem with IR remotes. interferencethat , and the human bodybulbs, fire
To avoid interference caused by other sources of infrared light, the infrared receiver
only responds to a particular wavelength of infrared light. There are filters on the
receiver that block out light at other wavelengths. Still, sunlight can confuse the
receiver because it contains infrared light at that wavelength. To address this issue, the
[DESIGN AND IMPLEMENTATION] Chapter3
Page32
light from an IR remote control is typically modulated to a frequency not present in
sunlight, and the receiver only responds light modulated to that frequency.
As a testing step, the signal that which is about to be transmitted have been generated
using a function generator and have been multiplied with a square wave carrier which
is also generated by a function generator, the modulation is performed using AND
gate (ASK Amplitude Shift Keying) , the frequency of the carrier is 38 KHz and the
frequency of the modulating signal is about 500 Hz. the carrier is being tuned
signals being the result is bursts of 38KhzON/OFF with the modulating signal,
transmitted.
The infrared Led is used as a transmitter, it received the electric current (modulated
and emit signal) and converted the energy of electrons in the electric current to light
the light pulses.
they are transmitted by the IR led, and converted it It captured the light pulses which
to an electrical signal.
which simply removed the 38 The IR receptor that have been used is TSOP1738
KHz carrier signal and gave clean pulses that are used for device control.
tion is illustrated in Figure 3.5.The simulation implementa
Figure 3-5 IR transmitter receiver circuit
[DESIGN AND IMPLEMENTATION] Chapter3
Page33
3.4.2 Generating the commands Using Microcontroller
The atmega32 microcontroller has been loaded with a code so it generated the
command that must be transmitted to the receiving side using USART protocol1.
Figure 3.6 show the generation of the command using microcontroller.
Figure 3-6 Generating command using microcontroller
Figure 3.7 show the microcontroller have been connected with a keypad to generate
many commands.
Figure 3-7 generating many commands according to the keypad
1See appendix A
[DESIGN AND IMPLEMENTATION] Chapter3
Page34
3.4.3 Generating the carrier signal
The atmaega32 microcontroller also generated the carrier signal according to the code
that has been loaded.2 Figure 3.8 show generating the carrier signal using the
microcontroller.
Figure 3-8 Generating the carrier using microcontroller
3.4.4 USART
The UART takes bytes of data and transmits the individual bits in a sequential
fashion. At the destination, a second UART re-assembles the bits into complete bytes.
The form of serial transmission that is used here is the asynchronous mode so there is
no common clock between the transmitter and the receiver, to maintain
synchronization between the transmitter and receiver, "Start Bit" is added to the
beginning of each frame that is to be transmitted. The Start bit alerts the receiver that
a frame is about to be sent, and forces the clock in the receiver to be synchronized
with the clock in the transmitter, so the receiver knows that there is a frame of data is
about to be sent by the transmitter and will be ready to receive it, then the individual
bits of the word of data are sent, Regardless of whether the data was received
correctly or not, the UART automatically discards the Start, Parity and Stop bits.
When the entire data word has been sent, then one Stop Bit is sent by the transmitter,
when the receiver has received all of the bits in the data word and then it looks for a
Stop Bit. If the Stop Bit does not appear when it is supposed to, the UART considers
the entire word to be garbled and will report a Framing Error to the host processor
2 See appendix A
[DESIGN AND IMPLEMENTATION] Chapter3
Page35
when the data word is read regardless of whether the data was received correctly or
not, the UART automatically discards it all.
The commands that the atmega32 microcontroller generates have been sent using
USART protocol.
3.4.4.1 Wired USART (Serial transmission)
First the wired serial transmission must be performed , the transmitting
microcontroller is loaded with a code so it generates a command signal that must be
sent to the receiving microcontroller using wired USART , the receiving
microcontroller receive this signal and output it through the pins according to the code
that have been loaded in it.3
The atmega32 microcontroller generated a command and it has been sent by USART
protocol using a wire to the microcontroller in the receiving side. This is shown in
figure 3.9.
Figure 3-9 Sending the command using weird USART
3.5 Design of the system
USART protocol using IR led and IR receptor
3 See appendix B and appendix C
[DESIGN AND IMPLEMENTATION] Chapter3
Page36
The IR led and the IR receptor are used to transmit the command, there is a
microcontroller in the transmitting side and another microcontroller in the
receiving side. the transmitting microcontroller is loaded with a code so it
generated the command that must be sent and generated the carrier signal that has
been modulated by the command signal to prevent interference with the other
sources of infrared radiation then the modulated signal has been sent to the IR led
that received the signal and converted the energy of electrons in the signal to light
and emit the light pulses, this is shown in figure 3.10.
Figure 3-10 Sending the modulated signal using IR led
In the other side the TSOP1738 IR receptor will capture the light pulses and convert it
signal, it demodulates the received signal by removing the 38 KHz into an electrical
There must be a carrier signal and gave clean pulses that are used for device control.
line of sight between the transmitter (light source) and the receiver (light detector),
this is shown in figure 3.11.
[DESIGN AND IMPLEMENTATION] Chapter3
Page37
Figure 3-11 Receiving the command using IR receptor
The IR led has been pointed to the IR receptor to allow it to be able to capture the
ide pointed to the receiver side.light pulses. Figure 3.12 show that the transmitter s
Figure 3-12 Sending the command and receiving it using IR led and IR receptor
Sending IR pulses and receiving it by the IR receptor cannot be performed using the
simulation; the IR pulses just can be transmitted in reality so it just has been
performed using hardware components. So figure 3.12 that show the modulated signal
being emitted by the IR led and received by the IR receptor is for clarification, this
4is performed using hardware components. stage
4 See appendix E
[DESIGN AND IMPLEMENTATION] Chapter3
Page38
3.6 Over all circuit Design
Controlling multiple receivers
. The transmitting microcontroller is connected with a keypad, it generates many
commands according to the buttons in the keypad. The number of buttons in the
keypad is equal to the number of receivers that the remote must be used to control so
according to the bit that have been pressed in the keypad, the microcontroller must
this is ,generate a specified command, this command is related to specified receiver
specified in the USART code that have been loaded in the transmitting
microcontroller, so when remote control is pointed to this receiver and press it's
related button the receiver capture the command and send it to the microcontroller on
the receiver side which is loaded by Rx USART code that take the command and
decide if it is the right command that have been selected for this receiver if it is the
right command it will perform the required action on the application device.5 This is
shown in figure 3.13.
5 See appendix D
[DESIGN AND IMPLEMENTATION] Chapter3
Page39
Figure 3-13 Sending the commands to the receivers
[RESULTS AND DISCUSSION] Chapter4
Page40
Chapter Four
4 The Results and Discussion
4.1 RESULTS
The project is implemented in two ways: using simulation programs and hardware.
The results obtained from both types of implementations are shown and discussed in
this chapter.
4.1.1 Simulation Results
4.1.1.1 Sending light pulses using IR led and IR receptor
Figure 4.1 show the modulating signal generated by function generator
The amplitude = 5V. The frequency = 500Hz.
Figure 4-1 The modulating signal
Figure 4.2 show the carrier signal generated by function generator.
The amplitude = 5V. The frequency = 40 KHz.
[RESULTS AND DISCUSSION] Chapter4
Page41
Figure 4-2 The carrier signal
Figure 4.3 show the modulated signal
The amplitude = 5V. The frequency = 500Hz.
Figure 4-3 The modulated signal
Figure 4.4 show the modulating signal, carrier signal and the modulated
signal:
[RESULTS AND DISCUSSION] Chapter4
Page42
Figure 4-4 The modulating signal. The carrier signal. The modulated signal
4.1.1.2 Generating the commands Using Microcontroller
Figure 4.5 show the command signal that the microcontroller generated
(11001100)
The amplitude = 5 volts.
Figure 4-5 The command signal generated by microcontroller.
4.1.1.3 Generating the carrier Using Microcontroller
Figure 4.6 show the carrier signal generated by microcontroller.
The amplitude = 5 volts. The frequency = 38 KHz.
[RESULTS AND DISCUSSION] Chapter4
Page43
Figure 4-6 The carrier signal generated by microcontroller
Figure 4.7 show the modulated signal.
The amplitude = 5 volts.
Figure 4-7 The modulated signal
Figure 4.8 show the USART signal (modulating signal), carrier signal and
modulating signal.
[RESULTS AND DISCUSSION] Chapter4
Page44
Figure 4-8 The modulating signal. The carrier signal. The modulated signal
4.1.1.4 Sending the command by wired USART (Serial transmission)
Figure 4.9 show the signal that is received by wired USART.
Figure 4-9 The wired USART
4.1.2 Hardware results
4.1.2.1 Sending light pulses using IR led and IR receptor
Figure 4.10 show the modulating signal generated by function generator.
The amplitude = 12V (before adding it to the AND gate), VOLT/DIV= 5V
The amplitude = 6V (after adding IT to the AND gate)
Frequency= 500Hz. TIME/DIV = 1ms. The
[RESULTS AND DISCUSSION] Chapter4
Page45
Figure 4-10 The modulating signal generated by function generator
Figure 4.11 show the carrier signal generated by function generator.
The amplitude = 4V (before adding to AND gate).
The amplitude = 2V (after adding to AND gate) VOLT/DIV = 5V.
The frequency is 38 KHz, TIME/DIV =10µs.
Figure 4-11 The carrier signal generated by function generator
Figure 4.12 show the modulated signal.
Amplitude= 6V, VOLT/DIV = 3V.
Frequency= 500 Hz, TIME/DIV = 1ms.
[RESULTS AND DISCUSSION] Chapter4
Page46
Figure 4-12 The modulated signal
Figure 4.13 show the signal that was received by the IR receptor.
The amplitude = 4V. : VOLT/DIV=2V.
The frequency = 500 Hz, TIME/DIV=1ms.
Figure 4-13 The received signal by TSOP1738 IR receptor
4.1.2.2 Sending the command by wired USART (Serial transmission)
The atmega32 microcontroller generated a command and it has been sent by
USART protocol using a wire to the microcontroller in the receiving side, the
command is 01010101.
Figure 4.14 display the signal that is received by wired USART.
[RESULTS AND DISCUSSION] Chapter4
Page47
Baud rate = 600
Frequency=900 Hz. TIME/DIV= 0.5 ms
Figure 4-14 The signal transmitted using wired USART
The output of the command is illustrated using the oscilloscope, the 1
command appear as high level signal. This is shown in figure 4.15.
High =2V
Figure 4-15 High level signal
The 0 is appeared on oscilloscope as zero level signal. Figure 4.16 show how 0
appear on oscilloscope.
[RESULTS AND DISCUSSION] Chapter4
Page48
Figure 4-16 Zero level signal
4.1.2.3 Generating the commands Using Microcontroller
Figure 4.17 show the command signal generated by microcontroller.
The amplitude = 4V.
The frequency = 900 Hz TIME/DIV=0.2 ms Baud Rate= 600.
Figure 4-17 The command signal generated by microcontroller.
4.1.2.4 Generating the carrier Using Microcontroller
Figure 4.18 show the carrier signal generated by microcontroller.
The amplitude = 4V (before adding to AND gate)
The amplitude = 2.5V (after adding to AND gate), VOLT/DIV = 5V.
The frequency is 38 KHz, TIME/DIV =10µs.
[RESULTS AND DISCUSSION] Chapter4
Page49
Figure 4-18 The carrier signal generated by microcontroller
4.1.2.5 USART protocol using IR led and IR receptor
The amplitude = 3.5 V.
Frequency = 900Hz TIME/DIV = 0.5 ms
Figure 4.19 show the modulated signal.
Figure 4-19 the modulated signal.
Figure 4.20 show the command that have been received by the IR receptor:
The amplitude = 3.2 V. VOLT/DIV= 2V.
The frequency = 900 Hz, TIME/DIV = 0.2 ms
[RESULTS AND DISCUSSION] Chapter4
Page50
Fig
Figure 4-20 Signal received by IR receptor
4.2 Discussion
4.2.1 Simulation Discussion
By looking at the modulated signal in figure 4.3, the modulating signal and the
carrier signal are generated using the function generator, it is obvious that the amplitude
of the modulated signal is equal to the amplitude of the modulating signal but the
frequency and phase of the carrier remain constant.
The presence of the modulating pulse is indicated by a carrier signal, and the absence
of the modulating pulse is by a zero level signal.
Figure 4.7 show the modulated signal that generated from multiplication of the
command signal and the carrier signal which they have been generated using
microcontroller, the amplitude of the modulated signal is equal to the amplitude of
the modulating signal which is 5 volts, the frequency of the carrier remain
unchanged when the modulating signal is present, and when the modulating signal is
absent, it is indicated by a zero level signal.
The modulated signal is sent to the receiving side using the IR led, transmitting of
infrared radiation cannot be performed in simulation programs, it is just can be
transmitted in hardware.
[RESULTS AND DISCUSSION] Chapter4
Page51
Figure 4.9 show the serial transmission of wired USART, the command that is
transmitted is 11001100, the output appears in the pins, the ON pins represent '1's and
the OFF pins represent the '0's.
4.2.2 Hardware Discussion
Figure 4.10 show the modulating signal, Figure 4.11 show the carrier signal which
they are generated using function generators, the amplitude of modulating signal was
12V before adding it to the AND gate, but when it has been added to the AND gate,
its amplitude is reduced to 6V, and the amplitude of the carrier was 4V before adding
it to the AND gate, when added to the AND gate it's amplitude is reduced to 2V
because the signals are square waves so the AND gate suppress(cut) the negative side
of the square wave so the amplitude is reduced.
Figure 4.12 show the modulated signal that resulted from multiplication of the carrier
signal and the modulating signal, they are generated using function generators, the
amplitude of the carrier was 4V,after modulation it changed to be equal to 6V which it
is the amplitude of the modulating signal, the carrier is being tuned ON/OFF with the
modulating signal.
The testing step of sending the light pulses through IR led and IR receptor was
performed to ensure that light pulses are transmitted properly.
Figure 4.13show the signal received by the IR receptor which is similar to the
modulating signal (baseband signal), it is frequency is 500 Hz which it is the
frequency of the base band signal because the TSOP1738 has internal demodulator so
it removed the 38 KHz carrier signal and gave clean pulses. Due to some interference
caused by other light sources, the received signal by the IR receptor has amplitude of
4 V instead of 6V (the amplitude of baseband signal).
Figure 4.14 show the signal generated by the transmitting microcontroller and sent
to the receiving microcontroller using a wire. The signal transmitted is the same as
the signal that entered the receiving microcontroller. The command transmitted is
01010101 it is received successfully at the output pins, the 1 appears on oscilloscope
as a DC high voltage, and the 0 appears as zero level signal.
Figure 4.19 show the modulated signal, its amplitude is 3.5V, the amplitude of the
command signal was 4V, this difference is caused because of some little noise.
[RESULTS AND DISCUSSION] Chapter4
Page52
Figure 4.20 show the signal received by TSOP1738 IR receptor, its frequency is
900Hz which it is equal to the frequency of the baseband signal (command signal
generated by microcontroller), because the TSOP1738 has internal demodulator so it
removed the 38 KHz carrier signal and gave clean pulses. Its amplitude is 3.2V; the
amplitude of the signal transmitted by IR led is 3.5 so due to little interference
caused by other light sources the amplitude received is 3.5V instead of 3.2V.
[CONCLUSION] Chapter5
Page53
Chapter Five
5 Conclusion
Using universal remote control that use infrared technology is the simplest and
easiest way for the disabled people, that it can provide highly reliable and user-
friendly device control, it allow them to control all the devices by one component
instead of buying different component for each different device, it is cheap
component that all disabled people can have it because of its low cost, and low
power consumption, also it is small size make it easier for them to deal with it.
5.1 Problems and limitations
Throughout the project life cycle several problems and difficulties were
encountered from several internal and external causes. The following is brief
description of most problems encountered:
The light emitted by the LED is weak, so we had to find a LED with
reasonable strength of infrared radiation.
The sensitivity of the IR detector must be taken into account so it can detect
the infrared radiation from a reasonable distance; the IR detector we used
here can receive the IR radiation from 20 cm.
Other sources of infrared radiation can affect transmission and cause
interference to the light emitted by the LED so we used modulation to avoid
the interference.
Line of sight requirement, transmitter and receiver must be almost directly
aligned to communicate
Using infrared remote control is blocked by common materials: people,
walls, plants, etc. can block transmission.
[CONCLUSION] Chapter5
Page54
5.2 Future work
This project need further work after submitting the command to the
receiver, the output of the receiving microcontroller is modified to be able
to operate the circuits of the consumer electronic devices.
This system can be reprogrammed to allow adding more devices to be
controlled.
The universal remote control in this project can be upgraded to have the
feature of being learning universal remote control and store codes
transmitted by another remote control; it can then transmit those codes to
control the device that understands them.
This prototype must be upgraded before manufacturing by using real IR led
and IR detectors to achieve larger distances.
To overcome the problem of the short range of IR remote control, RF
extenders can be used, they are meant to extend the operating range of the IR
remote control from about 30 feet to about 100 feet and allow the signal to
penetrate walls and glass cabinet enclosures.
Page55
References
[1] http://www.equalityni.org/archive/pdf/DefinitionofDisability,.
[2] http://www.ddc.wv.gov/Training/PartnersinPolicymaking/PIPCurriculum/Pages/Technol
ogy.aspx,.
[3] Jill. Empires of Light ISBN 0-375-75884-4. Page 355, referencing O'Neill, John J., Prodigal
Genius: The Life of Nikola Tesla (New York: David McKay, 1944), p. 167. Jonnes,.
[4] November 1930, Popular Science "Radio Aims At Remote Control",.
[5] "Philco Mystery Control".,.
[6] 2008. Retrieved December 3, 2008. "Five Decades of Channel Surfing: History of the TV
Remote Control". Archived from the original on January 16,.
[7] Paul. "The Inventor Who Deserves a Sitting Ovation." Washington Post. February 17,
2007. Farhi,.
[8] Julia. "How Remote Controls Work" 10 November 2005. Layton,.
[9] "SB-Projects: IR remote control: ITT protocol".,.
[10
]
Infineon Technologies AG, 2010 RF2 IR Whitepaper by Martin Gotschlich,.
[11
]
Sensing and Processing. Retrieved 2006-10-27. Dr. S. C. Liew. "Electromagnetic Waves".
Centre for Remote Imaging,.
[12
]
Fundamentals of the Infrared Physical Layer- Author: Paul Barna Microchip Technology
Inc. Steve Schlanger Aegi,.
[13
]
Visible, and Infrared Detectors Fundamentals of Ultraviolet,.
Page56
[14
]
//en.wikipedia.org/wiki/Modulation,.
[15
]
"Demodulator - Definitions from Dictionary.com". dictionary.reference.com.,.
[16
]
http://en.wikipedia.org/wiki/Microcontroller,.
[17
]
Programming, Interfacing and System Design, Second Edition By: Raj Kamal
Microcontrollers: Architecture,.
[18
]
Atmel_AVR_Microcontroller_Primer_-_Programming_and_Interfacing,.
[19
]
Frank Durda Serial and UART Tutorial January 1996,.
[20
]
http://www.ddc.wv.gov/Training/PartnersinPolicymaking/PIPCurriculum/Pages/Technol
ogy.aspx,.
[21
]
Jonnes, Jill. Empires of Light ISBN 0-375-75884-4. Page 355, referencing O'Neill, John J.,
Prodigal Genius: The Life of Nikola Tesla (New York: David McKay, 1944), p. 167.
[22
]
Programming, Interfacing and System Design, Second Edition By: Raj Kamal
Microcontrollers: Architecture,.
[23
]
Jr. 2004 Lemelson-MIT Prize Winner". Lemenson-MIT Program. Retrieved 2007-08-13.
"Nick Holonyak,.
[24
]
Fundamentals of the Infrared Physical Layer- Author: Paul Barna Microchip Technology
Inc. Steve Schlanger Aegi,.
[25
]
Visible, and Infrared Detectors Fundamentals of Ultraviolet,.
[26
]
Atmel_AVR_Microcontroller_Primer_-_Programming_and_Interfacing,.
A-1
Appendix A
This appendix contains the micro-controller code written at the transmitter side
to generate USART signal and carrier signal.
/*****************************************************
This program was produced by the
CodeWizardAVR V2.04.6 Evaluation
Automatic Program Generator
© Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project : House Hold Appliance-USART AT THE RECEIVER
Date : 8/13/2012
Author : Freeware, for evaluation and non-commercial use only
Company : U of K
Chip type : ATmega32
Program type : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 512
*****************************************************/
#include <mega32.h>
//Standard Input/Output functions
#include <stdio.h>
A-2
#include <delay.h>
//Declare your global variables here
void main(void(
{
//Declare your local variables here
//Input/Output Ports initialization
//Port A initialization
//Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
//State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
//Port B initialization
//Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
//State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
//Port C initialization
//Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
//State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
A-3
//Port D initialization
//Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
//State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
//Timer/Counter 0 initialization
//Clock source: System Clock
//Clock value: 8000.000 KHz
//Mode: CTC top=OCR0
//OC0 output: Toggle on compare match
TCCR0=0x19;
TCNT0=0xc8;
OCR0=0x35;
//Timer/Counter 1 initialization
//Clock source: System Clock
//Clock value: Timer1 Stopped
//Mode: Normal top=FFFFh
//OC1A output: Discon.
//OC1B output: Discon.
//Noise Canceler: Off
//Input Capture on Falling Edge
//Timer1 Overflow Interrupt: Off
//Input Capture Interrupt: Off
//Compare A Match Interrupt: Off
//Compare B Match Interrupt: Off
A-4
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
//Timer/Counter 2 initialization
//Clock source: System Clock
//Clock value: Timer2 Stopped
//Mode: Normal top=FFh
//OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
//External Interrupt(s) initialization
//INT0: Off
//INT1: Off
//INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
A-5
//Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
//USART initialization
//Communication Parameters: 8 Data, 1 Stop, No Parity ,1 start
//USART Receiver: Off
//UsART Transmitter: On
//USART Mode: Asynchronous
//USART Baud Rate: 600
UCSRA=0x00;
UCSRB=0x08;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x19;
//Analog Comparator initialization
//Analog Comparator: Off
//Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
while (1(
{
putchar(0b00110011 );
delay_ms(600(
B-1
Appendix B
This appendix contains the micro-controller code written at the
transmitter side to generate USART signal and transmit it using wiring
serial transmission.
/*****************************************************
This program was produced by the
CodeWizardAVR V2.04.6 Evaluation
Automatic Program Generator
© Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project : House Hold Appliance-USART AT THE RECEIVER
Date : 8/13/2012
Author : Freeware, for evaluation and non-commercial use only
Company : U of K
Chip type : ATmega32
Program type : Application
AVR Core Clock frequency: 4.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 512
*****************************************************/
#include <mega32.h>
B-2
// Standard Input/Output functions
#include <stdio.h>
#include <delay.h>
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
B-3
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
B-4
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
B-5
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity ,1 start
// USART Receiver: Off
// UsART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 600
UCSRA=0x00;
UCSRB=0x08;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x19;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
while (1)
{
putchar(0b01010101) ;
delay_ms(600);
}
C-1
Appendix C
This appendix contains the micro-controller code written at the receiver side to
receive the USART signal and project the result at one of the boards.
/*****************************************************
This program was produced by the
CodeWizardAVR V2.04.6 Evaluation
Automatic Program Generator
© Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project : House Hold Appliance-USART AT THE RECEIVER
Date : 8/13/2012
Author : Freeware, for evaluation and non-commercial use only
Company : U of K
Chip type : ATmega32
Program type : Application
AVR Core Clock frequency: 4.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 512
*****************************************************/
#include <mega32.h>
// Standard Input/Output functions
#include <stdio.h>
C-2
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
C-3
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
C-4
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: Off
// USART Mode: Asynchronous
C-5
// USART Baud Rate: 600
UCSRA=0x00;
UCSRB=0x10;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x19;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
while (1)
{
getchar(); //To receive the signal from Rx pin
PORTC=UDR; //To display the results on PORTC
}
}
D-1
Appendix D
This appendix contains the micro-controller code written at the transmitter side
to transmit multiple USART signals depending on the key pushed at the keypad.
This code was implemented to control different receivers (devices).
/*****************************************************
This program was produced by the
CodeWizardAVR V2.04.6 Evaluation
Automatic Program Generator
© Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project : House Hold Appliance-USART AS TRANSMITTER
Date : 8/13/2012
Author : Freeware, for evaluation and non-commercial use only
Company : U of K
Chip type : ATmega32
Program type : Application
AVR Core Clock frequency: 4.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 512
*****************************************************/
#include <mega32.h>
// Standard Input/Output functions
D-2
#include <stdio.h>
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In
Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In
Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In
Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
D-3
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In
Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
D-4
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
D-5
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: Off
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 600
UCSRA=0x00;
UCSRB=0x08;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x19;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
D-6
while (1)
{ PORTA.0=1;
PORTA.1=0;
{ if (PINA.2)
{ putchar(‘1’); } // To transmit this char using Tx pin(i.e. shift register).
{ if (PINA.3)
{ putchar(‘2’); }
PORTA.0=0;
PORTA.1=1;
{ if (PINA.2)
{ putchar(‘3’); }
}
E-1
Appendix E:
Snapshots for the implemented project.
E-2
F-1
Appendix F
Cost analysis
Part #
Qty
Manufacturer
Unit Cost
(SDG)
Total Cost
(SDG)
ATmega32 2 Atmel
production
75 150
IR LED 1 Shop 5 5
IR
transceiver
1 Shop 150 150
74LS08 1 Lab
component
- -
Resistors 1 Lab
component
- -
Capacitors 1 Lab
component
- -
Total 305
Based on the table that shown the parts list and their costs, the total cost for this
device is 305 SDG. This is a reasonable price; however, it might be a bit expensive
for the users in mind. But these components were purchased individually so it can be
cheaper if we purchase large numbers totally for production.
F-1