Final Report On Remote Sensing and Control
Final Report On Remote Sensing and Control
Kupondole, Lalitpur
(Affiliated to Tribhuvan University)
BY
Lalitpur, Nepal
March, 2009
Advanced College of Engineering and Management
Kupondole, Lalitpur
(Affiliated to Tribhuvan University)
In the
Department of Computer and Electronics Engineering
Advanced College of Engineering and Management
BY
Basu Dev Aryal ([email protected]) Exam Roll No: 16204
Mohan Nepal ([email protected]) Exam Roll No: 16212
Saroj Adhikari ([email protected]) Exam Roll No: 16228
Suvas Koirala ([email protected]) Exam Roll No: 16232
Lalitpur,Nepal
March, 2009
Approval Letter
The undersigned certify that they have read and recommended to the Department of Computer
and Electronics Engineering, final year project work entitled, Remote Sensing and Control for
Hi-Fi Home, submitted by Mr. Basu Dev Aryal, Mr. Mohan Nepal, Mr. Saroj Adhikari and Mr.
Suvas Koirala in partial fulfillment of requirement for the degree of Bachelor in Electronics
Engineering.
--------------------------------
Er. Binod Chandra Shrestha
Project Co-Ordinator
Department of Computer and Electronics Engineering
ACEM, Lalitpur
Project Supervisor
CERTIFICATE
We have pleasure in forwarding the project of Basu Dev Aryal, Mohan Nepal, Saroj Adhikari,
Suvas Koirala entitled “Remote Sensing and Control for Hi-Fi Home” for the completion of
Bachelor of Engineering in Electronics and Communication of this institute.
Basu Dev Aryal, Mohan Nepal, Saroj Adhikari, Suvas Koirala have completed the project work
for the full prescribed period under the curriculum, and the project embodied the result of their
investigations conducted during the period they worked as a full time student of this department.
---------------------------------- -------------------------
Er. Binod Chandra Shrestha Er. Sharad Ghimire
Project Co-ordinator Asst. Professor
ACEM M.Sc. Program Co-Ordinator
Project Supervisor IOE, Pulchok Campus
External Examiner
-------------------------------------
Er. Dhaneshwar Sah
Deputy Head of Department
Department of Computer and
Electronics Engineering, ACEM
Acknowledgement
First of all we would like to express our sincere thanks to the Department of Computer
and Electronics Engineering, ACEM, for providing us the environment to carry out our
projects smoothly.
We would like to record our appreciation to our D.H.O.D. Er. Dhaneshwor Sah, for his
valuable encouragement throughout the project. His efforts created an environment and
infrastructure to our project.
We express our gratitude to our project Supervisor Er. Binod Chandra Shrestha who
seriously helped us from the very beginning and managed his precious time, suggestions
and continuous effort to support us. We are extremely obliged to record our heartfelt
thanks to Er. Barun Koirala for his valuable support and priceless help and guidance.
We extend our sincere thanks to I.O.E which has given us the opportunity to do this
project which will help us enhance our career.
We would like thank Er. Amit Kumar Tamang and Er. Kiran Sharma for cooperating
us in various ways.
We are also thankful to all the teachers and staffs of our college for their support and help
in various sectors.
Last but not the least, we would like to appreciate all of our classmates for their
encouragement, help and co-operation during project works.
iii
Abstract
Our project entitled “Remote Sensing and Control for Hi-Fi Home” is designed
especially to meet the requirements of those who are willing to control their home
appliances through a hand held remote device that is portable within the periphery of the
house. It is designed in such a way that provides the effective and secure system of
control providing the information about the status of the house periodically. The title
Remote Sensing is to focus on the reception of the remote status using RF and Control is
done through the same transceiver. A Hi-Fi home is well equipped with modern
electronics appliances with high level of security. It also has the facility of controlling the
available appliances through the portable remote control device. We have chosen Hi-Fi
home as our application field because it is the major demand in the present time. If we
will be able to implement it successfully then we will be proceeding towards the
industrial applications. Just to modularize the project work, we have taken the three
different types of input parameters. One is we have controlled the door locking and
unlocking system with open and close facility. Next one is to sense the room temperature
and perform the necessary actions including the detection of abnormal temperature due to
fire and thus alerts us through alarming. The next sensor detects the light intensity and
provides the automatic light switching facility. The data is converted to corresponding
digital values by Analog to Digital Converter so that it could be analyzed effectively in
the Micro Controller Unit (MCU). The transmission and reception of the encrypted data
is carried out through the RF module RF12B which supports dual communication with
operating frequency of 868 MHz. We have adopted Advanced Encryption Standard
(AES) to encrypt and decrypt the data for secure communication. This data is now
analyzed by Microcontroller, AT89C52 and the appropriate control signal is fed to the
remote device that controls the appliances. The portable remote device consists of keypad
that facilitates the manual control of the appliances. The microcontroller programming is
carried out in C programming language and is compiled by SDCC to convert the program
to hex file required for the microcontroller. This hex file is then written to the
microcontroller through the burner and this machine language serves as a brain to control
the whole system.
ŝǀ
List of Figures
27 Structure of 2X16 LCD 59
28 Physical structure of Keypad 64
29 Flowchart for keypad programming 65
30 Snapshots 67
TABLE OF CONTENTS
1. Introduction 1
1.1 Background 1
1.2 Problem Statement 2
1.3 Objectives 2
2. Literature Review 3
2.1 Previous works 3
2.2 Related Theory 4
2.2.1 Radio Frequency 4
2.2.2 Advanced Encryption Standard 4
3. Description of Project 6
3.1 System Architecture 6
3.1.1 Sensors 7
3.1.2 ADC 7
3.1.3 Display 7
3.1.4 Wireless Module 8
3.1.5 Keypad 8
3.2 Description of Components 8
3.2.1 8051 Microcontroller 8
3.2.2 555 Timer IC 15
3.2.3 LM 35 17
3.2.4 Light Dependent Resistor 18
3.2.5 LCD 19
3.2.6 RF Module 19
3.2.7 Relay 19
3.2.8 TIP 122 21
3.2.9 IR Light Emitting Diode 21
3.2.10 IR Receiver 22
3.2.11 Diode 23
3.3 Circuit Explanation 24
3.3.1 Circuit Diagram 24
3.3.2 Remote Section 26
3.3.3 Control Section 27
3.4 Flow Chart 28
3.4.1 Remote section 28
3.4.2 Control section 29
3.4.3 AES Encryption process 30
3.5 Serial Communication 39
3.6 Software & Equipments 41
3.6.1 Proteus 6 Professional 41
3.6.2 MCU programming in C 44
3.6.3 SDCC Compiler 45
3.6.4 Oscilloscope 46
3.6.5 Digital Multimeter 47
4. Epilogue 48
4.1 Problem faced 48
4.2 Limitations 49
4.3 Future Enhancements 49
4.4 Conclusion 50
Bibliography and References 51
Appendix A: Transceiver Module RF12B 52
Appendix B: Analog to Digital Converter 55
Appendix C: Liquid Crystal Display 58
Appendix D: Keypad interfacing with MCU 63
Appendix E: Costing 66
Appendix F: Snapshots 67
1. Introduction
1.1 Background
The development in the field of science and technology occurred so rapid that even
the developing countries are not being able to implement it completely. It is so
because the newer technologies overcome the older one. The main point to be
considered here is the level of human desire i.e. they are unsatisfied to any luxury
they acquire. After the industrial development, world directed towards the information
age with the development of computer during 1950s. The invention of ICs in 1980s
led the electronics world to the peak by its compact size weight, cost with increased
quality and reliability. With the launching of communication satellite in 1962, the
world converted into the global village.
To dedicate an individual in technological field, almost all countries have their own
sort of education and curriculum pattern. We, the final year students of Bachelor in
Electronics and Communication Engineering, have also tried our best to implement
the knowledge we acquired during our course period to assist this technological world
through the final year project entitled “Remote Sensing and Control for Hi-Fi Home”.
This is a microcontroller based project with emerging wireless and data security
system. It is designed to facilitate the high level people to assist their luxury through
the control of each and every home appliance from any place they desire with the high
level of security. Different input sensors are used to sense the existing conditions of
the appliances and P89V51RD2 is used as MCU. The system consists of RF wireless
modules for the data transmission from the remote control device to the application
device and vice versa.
1.3 Objectives:
The main objectives of our project are as follows:
2. Literature Review
2.1 Previous works
Nothing is perfect in this world. So, the development in the field of science and
technology never goes to the saturation limit. Being an engineer, our contribution
should also be dedicated in the field of technology. Thus, with the knowledge we gain
during our 4 year course and studying the existing situation, we came up with our
project entitled “Remote Sensing and Control for Hi-Fi Home”. Several other
projects related partially with our projects helped us get idea that assisted us to create
more features in our project.
We came to study the reports from our seniors to know about the attempts made in the
past. We came across the report “Room Automation using IR” which used the
control of home appliances through Infra Ray (IR). It was capable to control the
devices within few meters and the necessary condition is that both the transmitter and
the receiver should follow line of sight principle. We came across next report entitled
“Long Range Remote Control” which used transmission of control signals though
radio frequency wave but no any data security system was adopted. It was the project
without using MCU. We came across the report “Wireless Ultrasound Flood
Monitoring System” which also used RF wave and somewhat used security systems
using password facility. But only simplex communication was possible and data
communication system was not secure. Next we came across a project work entitled
“Wireless PC to PC communication Using IR Modulation” which was limited to
the text files only. It used data transfer in asynchronous mode to transfer text files
from one PC to another. It used IR modulation and demodulation techniques and the
data transfer rate was limited up to maximum rate of 2400bps. The text file was
transferred on polling basis rather than the in interrupt basis. “Device Control Using
IR” was also a project in which 555 timer was used in modulating the ASCII value
pulses and decoding those pulses to perform specified action depending upon the
characters sent at the same rate of 2400 bps.
Thus, we became ready to overcome all the challenges that project faced and create
the project work with more features, more accurate values, and longer range of
operation. The use of various types of sensors with the feedback control system has
made our project more effective. The duplex communication system with data
encryption and decryption made more secure and reliable communication method.
The availability of automatic sensing and control has made the project carrying out
some level of intelligence. The facility of LCD display which displays each and every
information regarding the normal operations and changes occurred in the system has
made the project more friendly and effective.
It is a frequency or rate of oscillation within the range of about 3 Hz to 300 GHz. This
range corresponds to frequency of alternating current electrical signals used to
produce and detect radio waves. Since most of this range is beyond the vibration rate
that most mechanical systems can respond to, RF usually refers to oscillations in
electrical circuits. Electrical currents that oscillate at RF have special properties not
shared by direct current signals. One such property is the ease with which they can
ionize air to create a conductive path through air. This property is exploited by 'high
frequency' units used in electric arc welding. Another special property is an
electromagnetic force that drives the RF current to the surface of conductors, known
as the skin effect. Another property is the ability to appear to flow through paths that
contain insulating material, like the dielectric insulator of a capacitor. The degree of
effect of these properties depends on the frequency of the signals.
The Advanced Encryption Standard, in the following referenced as AES, is the winner
of the contest, held in 1997 by the US Government, after the Data Encryption
Standard was found too weak because of its small key size and the technological
advancements in processor power. Fifteen candidates were accepted in 1998 and
based on public comments the pool was reduced to five finalists in 1999. In October
2000, one of these five algorithms was selected as the forthcoming standard: a slightly
modified version of the Rijndael. The Rijndael, whose name is based on the names of
its two Belgian inventors, Joan Daemen and Vincent Rijmen, is a Block cipher, which
means that it works on fixed-length group of bits, which are called blocks. It takes an
input block of a certain size, usually 128, and produces a corresponding output block
of the same size. The transformation requires a second input, which is the secret key.
It is important to know that the secret key can be of any size (depending on the cipher
used) and that AES uses three different key sizes: 128, 192 and 256 bits. To encrypt
messages longer than the block size, a mode of operation is chosen, which I will
explain at the very end of this tutorial, after the implementation of AES. While AES
supports only block sizes of 128 bits and key sizes of 128, 192 and 256 bits, the
original Rijndael supports key and block sizes in any multiple of 32, with a minimum
of 128 and a maximum of 256 bits.
3. Description of Project
3.1 System Architecture
The system consists of the two separate devices namely Remote Section and Control
Section, connected wirelessly through Radio Frequency as the transmitting medium.
A pair of RF modules is used as a bridge to communicate between these two devices.
Figure below shows Block Diagram of the two sections.
We have used both the remote and control devices for two way communication, so
both the sections operate as transceiver. But the module is able to communicate only
half duplex communication with the baud rate of 9600 bps.
3.1.1 Sensors
The various sensors like temperature sensor (LM35), light sensor(LDR) and IR
sensors are have been used in our project.
Temperature Sensor
Light Sensor
Light Dependent Resistor (LDR) is used as a simple light sensor. The commercially
available LDR has varying resistance ranging from about 5K to 100K. So, another
variable resistor of 100K is used in series with LDR to obtain the required voltage
drop across the LDR so that we can easily analyze the change in intensity of light.
IR Sensor
It is a sensor using infra ray which is emitted by IR led and the supply to the IR led is
given through output of astable multivibrator. 555 timer IC is used to generate the
pulse of 38KHZ and TSOP of same frequency is used as IR receiver.
3.1.2 ADC
It facilitates us upto eight multiplexed inputs and the selection of each input can be
carried out through the selector pins. The output of ADC is always eight bit digital
data which is fed to the microcontroller for further processing.
3.1.3 Display
A 2*16 character display LCD is used to display the message regarding the status of
the home as well as the command given from the control section. The display system
is managed in such a way that the user can obtain the information periodically.
Wireless module is used to achieve the wireless communication between the remote
section and the control section. It facilitates user providing the portable remote control
device which the user can carry with him and operates within the range that the
wireless module supports.
3.1.5 Keypad
The Keypad used in our project is Hex Keypad. It consists of keys of 4*4 matrix
where each four terminals of row are connected to one port of microcontroller and
that of column are connected to the next port of the microcontroller.
Introduction to Microcontroller
The automotive market has been a major driver of microcontrollers, many of which
have been developed for automotive applications. Because automotive
microcontrollers have to withstand harsh environmental conditions, they must be
highly reliable and durable. Nonetheless, automotive microcontrollers, like their
counterparts, are very inexpensive and are able to deliver powerful features that
would otherwise be impossible, or too costly to implement.
The microprocessor contains no RAM, ROM and Input/Output ports on the chip
itself. On the other hand microcontroller has CPU, RAM and ROM, input/output
ports, timer, interrupts and serial ports on a single chip.
8051 Microcontroller
• Register implicit
• Direct
• Indirect or immediate
Operands reside in one of the five memory spaces of the 8051. The five memory
spaces of the 8051 are:
• Program memory
• External Data Memory
• Internal data Memory
• Special Function Registers
• Bit Memory
architecture with two levels, full duplex serial port, on-chip oscillator and clock
circuitry. In addition, the AT89C52 is designed with static logic for operation down to
zero frequency and supports two software selectable power saving modes. The Idle
Mode stops the CPU while allowing the RAM, timer/counters, serial port and
interrupt system to continue functioning. The Power-down mode saves RAM contents
but freezes the oscillator disabling all other chip functions until the next hardware
reset.
Features of AT89C52:
• 8K bytes of In-system reprogrammable Flash Memory.
• Endurance: 1,000 Write/Erase cycles
• Fully static operation: 0 Hz to 24 MHz.
• Three level program memory lock.
• 32 programmable I/O lines
• 128x 8-Bit Timer/counters.
• Six Interrupt Sources.
• Programmable Serial Channel.
• Low power Idle and Power Down Modes.
Pin Description:
Vcc
Supply voltage
Gnd
Ground
Port 0
Port 0 is an 8-bit open-drain bi-directional I/O port. So, it requires external pull up
resisters when used as simple I/O port. It is also designed as AD0-AD7 i.e. it can be
used for both address and data bus. When ALE = 0, it acts as data bus D0 –D7, but
when ALE = 1, it acts as address bus A0-A7. In our system, we have used Port 0 as
the data bus for the LCD.
Port 1 / Port 2
Port 1 / Port 2 both are an 8-bit bi-directional I/O port with internal pull-ups. Port 1 /
Port 2 both acts as simple I/O when 8051 used with no external memory connection.
But, with the system with external memory connection, Port 2 acts as higher order
address bus along with the Port 0 to provide the 16-bits address for the external
memory. Port 1 is dedicated for the keypad while in case of Port 2, pin 2.1 used to
enable the 555 timer, pin 2.2 used to enable/disable the latch in the circuit, pin2.7, 2.6
& 2.5 used for the control signaling of the LCD.
Port 3
Port 3 is also an 8-bit bi-directional I/O port with internal pull-ups. The port 3 output
buffers can sink/source four TTL inputs. When 1s are written to port 3 pins they are
pulled high by internal pull-ups and can be used as inputs. As inputs, Port 3 pins that
are externally being pulled low will source current because of the internal pull ups.
Port 3 also serves the function of various special features of the AT89C52 as listed
below; Port 3 also receives some control signals for Flash programming and
verification. Port 3 also serves the functions of various special features of the
AT89C52 as listed below:
ALE/PROG
ALE (address latch enable) is an output pin and is active high, while connecting to an
external memory.
RST
RESET pin (i.e. pin 9) is an input pin and active high (normally low) where the high
pulse must last for minimum of the two machine cycles before it goes to low. Upon
application of the high pulse, the MCU will be reset such that all the values of its
register will reset and program counter will be set to 0s.Infact, it is also referred to as
reset interrupt among the six interrupts available in 8051 MCU.
PSEN
“Program store Enable” is read strobe to external program memory. When the
AT89C52 is executing code from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each access
to external data memory.
EA/VPP
External Access Enable, EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.
This pin also receives the 12-volt programming enable voltage during Flash
programming for two parts that require 12-volt VPP.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2
Output from the inverting oscillator amplifier.
Oscillator Characteristics
XTAL l and XTAL2 are the input and output, respectively, of an inverting amplifier,
which can be configured for use as an on-chip oscillator. Either a quartz crystal or
ceramic resonator may be used. To drive the device from an external clock source
XTAL2 should he left unconnected while XTALl is driven. There are no requirements
on the duty cycle or me external clock signal, since the input to the internal clocking
circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage
high and low time specifications must be observed.
The NE 555 timer is a TTL digital logic circuit that is used in the controller circuit to
produce a periodic square wave signal. The period and duty cycle of the square signal
are determined by the resistor and capacitor connected to the timer. A square wave
with a 50% duty cycle is desired. In order to obtain exactly a 50% duty cycle from
timer two resistor of identical value are required.
• Precision timing
• Sequential timing
• Time delay generator
• Pulse generator
The designed formula for the frequency of the pulses in astable mode of operation is,
F=1.44/ (R1+2*R2)*C
The high and low time of each pulse can be calculated as
High time=0.69*(R1+R2)*C
Low time=0.69*R2*C
The duty cycle of the wave form, usually expressed as a percentage and is given by
Duty cycle = (High time)/ (Pulse period time)
Figure below shows the astable mode of operation of NE555 timer IC.
3.2.3 LM 35
The LM35 series are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35
thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as the
user is not required to subtract a large constant voltage from its output to obtain
convenient Centigrade scaling. The LM35 does not require any external calibration or
trimming to provide typical accuracies of ±¼°C at room temperature and ±¾°C over a
full -55 to +150°C temperature range. Low cost is assured by trimming and
calibration at the wafer level. The LM35's low output impedance, linear output, and
precise inherent calibration make interfacing to readout or control circuitry especially
easy. It can be used with single power supplies, or with plus and minus supplies. As it
draws only 60 µA from its supply, it has very low self-heating, less than 0.1°C in still
air. The LM35 is rated to operate over a -55° to +150°C temperature range, while the
LM35C is rated for a -40° to +110°C range (-10° with improved accuracy). The
LM35 series is available packaged in hermetic TO-46 transistor packages, while the
LM35C, LM35CA, and LM35D are also available in the plastic TO-92 transistor
package. The LM35D is also available in an 8-lead surface mount small outline
package and a plastic TO-220 package.
It is a light activated resistor whose resistance varies with the intensity of light. The
property of varying resistance may be in two modes. We have used the resistor with
resistance inversely proportional to the intensity of light i.e. when the light falls on the
LDR, its resistance decrease
decreases.
s. This varying resistance is then used to obtain the
t
varying potential difference across the resistor and
an is used to turn on the transistor to
obtain the logic level required for further processing.
process
LDR can be used in two modes namely light activated mode and dark activated mode.
The connection diagram for these modes is shown in the figure below:
3.2.5 LCD
The LCD used in our project is a 16*2 matrix type LCD which means it consists of 2
columns of display each supporting of 16 characters. It is used for displaying the
information both in the fixed control module as well as the portable remote device. It
displays the information regarding the present status of the house periodically and the
certain changes that occurred in the system. It is used instead of the LED display
because just by the LED identification, the message won’t seem friendly to all users
so couldn’t be effective method. So, the provision of the LCD display provides clear
information regarding the room condition. For further information, see Appendix C
3.2.6 RF Modules
We used RF12B as transceiver module to transmit and receive the data through RF
wave. It is a single chip, low power, multi-channel FSK transceiver designed for use
in applications requiring FCC or ETSI conformance for unlicensed use. The RF12B
transceiver produces a flexible, low cost, and highly integrated solution that does not
require production alignments. The chip is a complete analog RF and baseband
transceiver including a multi-band PLL synthesizer with PA, LNA, I/Q down
converter mixers, baseband filters and amplifiers, and an I/Q demodulator. All
required RF functions are integrated. Only an external crystal and bypass filtering are
needed for operation. It works on the signal ranges from 433/868/915 MHz. The SPI
interface is used to communicate with the microcontroller for the various parameter
settings like baud rate, clock rate, modes, carrier frequency etc. The RF modules are
shown in the figure 3.17 below. For further information, see Appendix A
3.2.7 Relay
The simple
mple transistor driver circuit is very low in cost, and is generally fine for
driving most relays. However there may be occasions, such as when our control
circuit is based on CMOS logic (obtained from the microcontroller), where the base
current needed by these circuits is a bit too high.
TIP 122 (TIP 120/121) is a Darlington pair transistor with higher VCBO and VCEO
(100VDC). A Darlington pair is used to amplify weak signal so that they can be
clearly detected by another circuit or a computer/microcontroller.
ȕ = ȕ1* ȕ2
Figure below shows the configuration and equivalent circuit of TIP 122.
Fig (a): - pin description of TIP 122 Fig (b): - Equivalent circuit of TIP 122
A light-emitting diode (LED) is a semiconductor device that emits visible light when
an electric current passes through it. The light is not particularly bright, but in most
LEDs it is monochromatic, occurring at a single wavelength .The output from an LED
can range from red (700nm)to blue-violet(400nm).Some LEDs emit infrared energy
(830nm or longer); such a device is known as an infrared-emitting diode(IRED).
Every semiconductor has a different energy gap. The wavelength that describes the
color of the radiated light depends upon the magnitude of the energy gap. It is given
by the relation
Ȝ = h*c/E
where,
h=Plank’s constant
c=Velocity of light
E=Band gap energy
The basic principle of photo detection is that when the light falls on the detector
surface it absorbs it; the photon energy is transferred to its electron some of which
gain enough energy to escape from the cathode forming a complete current path.
There are various types of photo detectors like phototransistor, semiconductor,
phototransistors etc. Special receiver modules tuned for particular frequency receive
the modulated infrared signal. We have employed receiver module TSOP for 38 KHz.
Features
• Very low supply current
• Photo detector and preamplifier in one package
• Internal filter for PCM frequency
• Improved shielding against EMI
• Supply voltage: 2.5 V to 5.5 V
• Improved immunity against ambient light
• Insensitive to supply voltage ripple and noise
3.2.11 Diode
Consist of MCU unit, ADC, Display unit, sensor input and load control unit.
MCU Unit:
Display Unit:
For display the local information as well as the control information in the remote side.
The control information is given from the control side. Here we have used 16*2 LCD
to display the information. The pin detail of the 16*2 LCD is given in appendix.
The control signal from the MCU is used to drive the relay through Darlington pair
transistor TIP 122. TIP 122 is a high current and high VCBO, VCEO (100VDC).
The temperature sensor gives the temperature of the Home to the ADC. Depending
upon the temperature the user determines whether heater or fan ON. Here we used the
temperature sensor LM35 which is linear with degree centigrade.
The light sensor determines the intensity of the room in the Home. Depending upon
the intensity user decides to turn ON the light or OFF the light.
To determine the status of the door whether it is open or closed, IR sensor is used. It
sends the status of the door to the MCU unit. The user decides to the action.
The control section has a major function of controlling the load in the remote section.
It consists of keypad, display and MCU unit.
Display unit:
MCU Unit:
As in the remote section the same microcontroller is used in MCU unit. It decodes the
information from the control side and send to the LCD. Also the control information
from the keypad is displayed in the LCD as well as it is encoded to transmit to control
side. P1.0 through P1.3 are used as the columns of keypad and P3.4 through P3.7 are
used as the rows of keypad. P3.0 and P3.1 are used as Rx and Tx for serial
communication. Port 0 is used for transmitting display data to the LCD. P2.0, P2.1and
P2.2 are used as control lines to LCD.
Keypad:
For identification of the key pressed firstly all the columns are high and rows are
made low. Once the key is pressed the value of columns is read and the pressed
column is determined. After that one row is made high and column is read. Check
whether the current row is pressed or not. If not go to next row otherwise read the key
value from the look up table. The keypad detail is given in the appendix.
Start
Any command
from control? Read ADC data
No
Yes
Decrypt the command
Send data to serial port
Fig: - Flow chart of remote section
The remote section operates on interrupt basis. When any control command is
detected in the serial line, the control automatically call the decryption function.
Analyzing the detected command it controls the load. In the other time it continuously
observes the data in the input line from the ADC. Encrypt it and send it to the serial
line. At the same time it displays the message in the local LCD screen. All the input
sensors are connected to ADC. So by selecting the multiplex input of the ADC
through the microcontroller we can obtain the sensor data directly. Further the
obtained data are processed and used to encrypt, which is sent through the serial line
of microcontroller.
Start
No
Fig: - Flow chart of Control section
In the control section, user analyzes the received data. So the program
control always monitors the data input whether received or not.
Whenever the data is received it decrypts the data and display in the LCD
display. Another function is to take the command through the keypad. It
is done upon interrupt basis. Whenever it detects interrupt in the interrupt
line it automatically jumps to keypad function to input the command data.
Now the data is encrypted and sends through the serial line to the remote
area.
Start
Input text
AddRoundkey operation
Count =0
SubByte operation
Count++
ShiftRow operation
MixColumns operation
AddRoundkey operation
Is Count < 9? No
Yes
SubByte operation
ShiftRow operation
AddRoundkey operation
Stop
AES is an iterated block cipher with a fixed block size of 128 and a variable key
length. The different transformations operate on the intermediate results, called state.
The state is a rectangular array of bytes and since the block size is 128 bits, which is
16 bytes, the rectangular array is of dimensions 4x4. (In the Rijndael version with
variable block size, the row size is fixed to four and the number of columns vary. The
number of columns is the block size divided by 32 and denoted Nb). The cipher key
is similarly pictured as a rectangular array with four rows. The number of columns of
the cipher key, denoted Nk, is equal to the key length divided by 32.
A state:
-----------------------------
| a0,0 | a0,1 | a0,2 | a0,3 |
| a1,0 | a1,1 | a1,2 | a1,3 |
| a2,0 | a2,1 | a2,2 | a2,3 |
| a3,0 | a3,1 | a3,2 | a3,3 |
-----------------------------
A key:
-----------------------------
| k0,0 | k0,1 | k0,2 | k0,3 |
| k1,0 | k1,1 | k1,2 | k1,3 |
| k2,0 | k2,1 | k2,2 | k2,3 |
| k3,0 | k3,1 | k3,2 | k3,3 |
-----------------------------
It is very important to know that the cipher input bytes are mapped onto the the state
bytes in the order a0,0, a1,0, a2,0, a3,0, a0,1, a1,1, a2,1, a3,1 ... and the bytes of the
cipher key are mapped onto the array in the order k0,0, k1,0, k2,0, k3,0, k0,1, k1,1,
k2,1, k3,1 ... At the end of the cipher operation, the cipher output is extracted from the
state by taking the state bytes in the same order. AES uses a variable number of
rounds, which are fixed: A key of size 128 has 10 rounds. A key of size 192 has 12
rounds. A key of size 256 has 14 rounds. During each round, the following operations
are applied on the state:
1. SubBytes: every byte in the state is replaced by another one, using the Rijndael
S-Box
2. ShiftRow: every row in the 4x4 array is shifted a certain amount to the left
3. MixColumn: a linear transformation on the columns of the state
4. AddRoundKey: each byte of the state is combined with a round key, which is a
different key for each round and derived from the Rijndael key schedule
In the final round, the MixColumn operation is omitted. The algorithm looks like the
following (pseudo-C):
AES(state, CipherKey)
{
KeyExpansion(CipherKey, ExpandedKey);
AddRoundKey(state, ExpandedKey);
for (i = 1; i < Nr; i++)
{
Round(state, ExpandedKey + Nb*i);
}
FinalRound(state, ExpandedKey + Nb * Nr);
}
Observations:
The cipher key is expanded into a larger key, which is later used for the actual
operations.
The roundKey is added to the state before starting the with loop
The FinalRound() is the same as Round(), apart from missing the MixColumns()
operation. During each round, another part of the ExpandedKey is used for the
operations. The ExpandedKey shall ALWAYS be derived from the Cipher Key and
never be specified directly.
AES operations: SubBytes, ShiftRow, MixColumn and AddRoundKey
In this operation, a Round Key is applied to the state by a simple bitwise XOR. The
RoundKey is derived from the Cipher Key by the means of the key schedule. The
Round Key length is equal to the block key length (=16 bytes).
----------------------------- ----------------------------- ---------------------------------------------------------
| a0,0 | a0,1 | a0,2 | a0,3 | | k0,0 | k0,1 | k0,2 | k0,3 | | b0,0 | b0,1 | b0,2 | b0,3 |
| a1,0 | a1,1 | a1,2 | a1,3 | XOR | k2,0 | k2,1 | k2,2 | k2,3 | = | b2,0 | b2,1 | b2,2 | b2,3 |
| a2,0 | a2,1 | a2,2 | a2,3 | | k1,0 | k1,1 | k1,2 | k1,3 | | b1,0 | b1,1 | b1,2 | b1,3 |
| a3,0 | a3,1 | a3,2 | a3,3 | | k3,0 | k3,1 | k3,2 | k3,3 | | b3,0 | b3,1 | b3,2 | b3,3 |
----------------------------- ----------------------------- ---------------------------------------------------------
In this operation, each row of the state is cyclically shifted to the left, depending on
the row index.
The 1st row is shifted 0 positions to the left.
The 2nd row is shifted 1 positions to the left.
----------------------------- -----------------------------------
-----
| a0,0 | a0,1 | a0,2 | a0,3 | | a0,0 | a0,1 | a0,2 | a0,3 |
| a1,0 | a1,1 | a1,2 | a1,3 | -> | a1,1 | a0,2 | a1,3 | a1,0 |
| a2,0 | a2,1 | a2,2 | a2,3 | | a2,2 | a2,3 | a2,0 | a2,1 |
| a3,0 | a3,1 | a3,2 | a3,3 | | a3,3 | a3,0 | a3,1 | a3,2 |
----------------------------- -----------------------------------
-----------------------------
Please note that the inverse of ShiftRow is the same cyclically shift but this time to the
right. It will be needed later for decoding.
a(i,j) = SBox[a(i,j)]
Please note that the inverse of SubBytes is the same operation, using the inversed S-
Box, which is also precalculated.
I will keep this section very short since it involves a lot of very advance mathematical
calculations in the Rijndael's finite field. All you have to know is that it corresponds to
the matrix multiplication with:
2 3 1 1
1 2 3 1
1 1 2 3
3 1 1 2
and that the addition and multiplication operations are a little different from the
normal ones.
The Key Schedule is responsible for expanding a short key into a larger key, whose
parts are used during the different iterations. Each key size is expanded to a different
size:
There is a relation between the cipher key size, the number of rounds and the
ExpandedKey size. For an 128-bit key, there is one initial AddRoundKey operation
plus there are 10 rounds and each round needs a new 16 byte key, therefor we require
10+1 RoundKeys of 16 byte, which equals 176 byte. The same logic can be applied to
the two other cipher key sizes. The general formula is that:
ExpandedKeySize = (nbrRounds+1) * BlockSize
The Key Schedule is made up of iterations of the Key schedule core, which works on
4-byte words. The core uses a certain number of operations, which are explained here:
Rotate:
Rcon:
Just note that the Rcon values can be pre-calculated, which results in a simple
substitution (a table lookup) in a fixed Rcon table (again, Rcon can also be calculated
on-the-fly if memory is a design constraint.)
S-Box:
The Key Schedule uses the same S-Box substitution as the main algorithm body.
The Key Schedule Core:
Now that we know what the operations are, let me show you the key schedule core (in
pseudo-C):
keyScheduleCore(word)
{
Rotate(word);
SBoxSubstitution(word);
word[0] = word[0] XOR RCON[i];
}
In the above code, word has a size of 4 bytes and i is the iteration counter from the
Key Schedule.
First, let me show you the keyExpansion function as you can find it in the Rijndael
documentation (there are 2 version, one for key size 128, 192 and one for key size
256):
The implementation of the key schedule is pretty straight forward, but since there is a
lot of code repetition, it is possible to optimize the loop slightly and use the modulo
operator to check when the additional operations have to be made.
AES Decryption
The data I/O of the PC depend upon the Microprocessor Architecture. It can employ
Memory Mapped I/O or I/O Mapped I/ O. In I/O Mapped I/O, the devices are
identified with the separate I/O address. The maximum numbers of devices in this
approach that can be well addressed depends upon the number of data bits in the
Microprocessor Architecture Design. For example 8 bit architecture in 8085 can
address up to 256 devices using this approach. The data transfer for this approach is
faster than the Memory Mapped I/O because there is no need to go to memory address
to fetch operands time and again. However, the number of devices that can be
addressed is limited and small range than the Memory mapped I/O. The instructions
such as IN and OUT are used. In Memory Mapped I/O, the devices are treated like the
memory locations. The addressability of I/O devices is much high and is determined
by the number of Bits in the Address Bus. The memory instructions such as LDA,
STA, LDAX, STAX, are used for data I/O in such approach.
Here in our project, we have used serial data transfer in asynchronous mode.
Asynchronous mode is often used in data communication between PC and the
peripherals because of higher speed of the processor than the peripheral devices in
general. The synchronous data transfer takes place bitwise or character wise. The start
bit, stop bit, parity bit are used for baud rates that is fixed to be same at the both
transmitting side and receiving side. UART such as Motorola’s MC6850 is used for
asynchronous data communication.
In serial data transfer, a single line is used to transfer a bit at a time. This technique is
slower than parallel data transfer however highly economical. It is used for long
distance communication such as in internet. Most of the time serial data
communication is of interest. The signal high is indicated by MARK and the signal
low level is called SPACE.
MCU 1 MCU 2
This section is intended to give some basic introduction and useful information about
the software and tools that we employed in to develop our system.
Many CAD users dismiss schematic capture as a necessary evil in the process of
creating PCB layout but Proteus 6 Professional has always disputed this point of view.
With PCB layout now offering automation of both component placement and track
routing, getting the design into the computer can often be the most time consuming
element of the exercise. And if you use circuit simulation to develop your ideas, you
are going to spend even more time working on the schematic.
ISIS has been created with this in mind. It has evolved over twelve year research and
development and has been proven by thousands of users worldwide. The strength of
its architecture has allowed us to integrate first conventional graph based simulation
and now – with PROTEUS VSM - interactive circuit simulation into the design
environment. For the first time ever it is possible to draw a complete circuit for a
micro-controller based system and then test it interactively, all from within the same
piece of software. Meanwhile, ISIS retains a host of features aimed at the PCB
designer, so that the same design can be exported for production with ARES or other
PCB layout software. The Proteus Professional v 6.9, Lab Center Electronics 1990-
2005, has been used for the simulation and PCB layout designed purpose in our
system. And this software proved to be the most comprehensive tool for testing many
microcontroller based circuitry with MCU coding, of course and it has also helped to
give professional look to our circuit.
We have used the Proteus ISIS professional to carry out the simulation of our design
and checking the correctness of the coding done in C language. The library of the ISIS
was rich in the commercially available ICs, which proved to be fruitful for us to check
the output of circuit at various conditions and to check the feasibility of any new
components to be added in the systems. During the simulation of our system, ISIS had
been very useful to test the code from the very beginning. As the Proteus ISIS
professional don’t have simulation facility for RF transmission, we have carried the
wired communication procedure to verify the coding. Figure below shows the
simulation of the system displaying the temperature:
Figure: Snap shot of simulation circuit to test the code in Proteus ISIS professional
We have used the Proteus ARES professional for the PCB design. The design of PCB
was employed manually rather than using the self routing tool ELECTRA available in
ARES.
When compliers complies the code written in C language to produce Hex files that
loaded into the ROM of MCU. The size of HEX file is larger with respect to the Hex
file produced by the program written in assembly language. As MCU has limited on
chip ROM, for example AT89C51 MCU has only 4KB of ROM. Moreover, memory
can only be extended up to 64KB as address bus used is of 16 bits. Hence, the size of
HEX file produced by the complier is the major issue while writing the code in MCU.
In spite of the problem explained above while doing the MCU programming in C
language, we chose C language because the assembly language is tedious and time
consuming while the C language is much easier and less time consuming to write
program. Furthermore, program in C sis easier to modify, update and more
importantly to debug. C language also allows us to use codes available in function
libraries.
This sections attempts to review some of the widely used C data types in MCU. The
section explain how the proper use of C data types is carried out, such that the
programmer would be able to produce small size of HEX file as much as possible.
Unsigned char:
The unsigned char is an 8 bit data types that takes the value in the range of 0-255 (00-
FFH). It is most widely used data types for MCU. By default, C compilers assume as
signed char if we don’t put keyword unsigned in front of char. it is also used for the
ASCII character as genuinely used in C language.
Signed char:
It is also an 8 bit data type using D7 among (D7-D0) of 1 byte data to represent the
‘+’ or ‘-‘ sign of the magnitude, such that there are only 7 bits for the magnitude of
signed numbers giving range of (-128 to 127). This data types is used where the sign
of the magnitude becomes vital.
Unsigned int:
When the values of variables exceed 256 then the unsigned int comes into play. This
is 16 bits data type giving the range of 0 – 65535 (0000 – FFFFH), it occupies 2 bytes
of RAM space of MCU. Hence, misuse of this data type will result in unnecessary
increase in size of HEX file.
Signed int:
It uses D15 bit of (D15 – D0) data to represent sign as described in case of signed
char, giving the magnitude range of (-32,768 to +32767) Finally, it can be concluded
that when the variables are declared during programming the MCU in C language,
• The programmer should drag his/her attention to the size of the data types & its
intention of use.
• There should not be unnecessary declaration of variables, i.e. no redundant
declaration or optimum use of the declared variable. If one takes care of the above
mentioned point then s/he will be able to mitigate the size of HEX files effectively.
SDCC (Small Device C Compiler) is free open source, retarget table; optimizing
ANSIC compiler by Sandeep Dutta designed for 8 bit Microprocessors. The current
version targets Intel MCS51 based Microprocessors (8031, 8032, 8051, 8052, etc.),
Dallas DS80C390 variants, Freescale (formerly Motorola) HC08 and Zilog Z80 based
MCUs. It can be retargeted for other microprocessors, support for Microchip PIC,
Atmel AVR is under development. SDCC has extensive language extensions suitable
for utilizing various microcontrollers and underlying hardware effectively. The
Supported data-types are: bool, char, short, int ,long, float
Compiling in SDCC
For single source file 8051 projects the process is very simple. Compile your
programs with the following command "sdcc sourcefile.c". This will compile,
assemble and link your source file. Output files are as follows: sourcefile.asm,
sourcefile.lst, sourcefile.rst, sourcefile.sym, sourcefile.rel or sourcefile.o,
sourcefile.map, sourcefile.mem, sourcefile.ihx, sourcefile.adb, sourcefile.cdb,
sourcefile.-(no extension).
In most cases this won’t be needed but the Intel Hex file which is generated by SDCC
might include lines of varying length and the addresses within the file are not
guaranteed to be strictly ascending. If your tool chain or a boot loader does not like
this you can use the tool packihx which is part of the SDCC distribution: packihx
sourcefile.ihx >sourcefile.hex. Now the Sourcefile.hex is loaded in the ROM of
MCU using the software EZ Downloader v4.1.
3.6.4 0scilloscope
Once the faulty stage is found, further probing can usually tell a skilled technician
exactly which component has failed. Once the component is replaced, the unit can be
restored to service, or at least the next fault can be isolated.
Another use is for software engineers who must program electronics. Often a scope is
the only way to see if the software is running the electronics properly. Another use is
to check newly designed circuitry. Very often a newly designed circuit will
misbehave because of design errors, bad voltage levels, electrical noise etc. Digital
electronics usually operate from a clock, so a dual-trace scope which shows both the
clock signal and a test signal dependent upon the clock is useful. "Storage scopes" are
helpful for "capturing" rare electronic events that cause defective operation.
4. Epilogue
Nothing is perfect in this world. So this completely implies to our activities as well.
During the project activities, we faced different problems even from simpler to more
complex. Some of the problems are described below:
Problem in Hardware
As hard to theoritize any concept, much harder is to realize the system with electronic
component. The commercially available ICs and other components don’t operate with
expected reliability. The simplicity in the circuitry seems that it is a single day work
to complete the project. But after starting, one will experience what obstacles might
one face in the course of making a system synchronizing hardware and software. It is
simple to realize the circuitry module wise rather than to realize the whole circuit. But
assembling and working on the whole circuit would cause a lot of problems.
We first tried to connect the circuit in the bread board. So, we faced a lot of problem.
The serious problem caused due to the loose connection and difficult to find the fault.
We could not obtain the output so we plan to design PCB directly. After PCB design
was completed and all the components were assembled, we took only some hours to
make it work.
Next problem we faced is due to power supply fault. We were completely dependent
on the regulated power supply that we have in the electronics lab. Before we had not
faced such problems but after our final circuit was ready and during our testing, we
found that the regulated power supply had supplied larger current due to which some
microcontrollers get damaged during switching.
Our work was delayed due to the unavailability of power supply facility. We suffered
a lot due to load shedding. This directly affects us during software and hardware
works as both works need power supply. College supported us to some extent by
providing the alternative source. The unavailability of all the components in time is
the second major problem to us to start the work in time.
Problems in Software:
4.2 Limitations
Even a perfect device available in the market has its limitation. Similarly, our project
has also passed through some of the limitations. Due to the short range of RF module,
it could not control the devices from very far distance. The type of communication
carried out through the module is also half duplex and of slow speed supporting the
maximum baud rate of 9600. Because of the unavailability of the free ports in the
microcontroller, we used only few inputs which may be insufficient to precisely
define the Hi-Fi Home. We could solve this problem using multiplexing system if we
had sufficient time.
Our project is just the approach to control the remote devices wirelessly with higher
precision. So, this application field covers wide range. The further enhancement could
be the fruitful in the industrial sectors as well those sectors consisting of risky works
like as in mining and chemical works.
The recommendation for the future enhancements in the project can be:
¾ To control the devices with long range capability
¾ To use the system as secure local area data communication
4.4 Conclusion
The designed system has overcome the normal control devices using the
IR system and also normal code locking system which has less or no any
secure system of control. The system was designed that could take the various
inputs required for home security as well as normal operation and could transfer to the
remotely device wirelessly. The remote is capable of controlling the devices within
the periphery of the house. The data security has also been carried out successfully.
So, the project is proposed for the application.
APPENDIX A
Hope’s RF12B is a single chip, low power, multi-channel FSK transceiver designed
for use in applications requiring FCC or ETSI conformance for unlicensed use in the
433, 868 and 915 MHz bands. The RF12B transceiver produces a flexible, low cost,
and highly integrated solution that does not require production alignments. The chip is
a complete analog RF and baseband transceiver including a multi-band PLL
synthesizer with PA, LNA, I/Q down converter mixers, baseband filters and
amplifiers, and an I/Q demodulator. All required RF functions are integrated. Only an
external crystal and bypass filtering are needed for operation.
The RF12B features a completely integrated PLL for easy RF design, and its rapid
settling time allows for fast frequency-hopping, bypassing multi-path fading and
interference to achieve robust wireless links. The PLL’s high resolution allows the
usage of multiple channels in any of the bands. The receiver baseband bandwidth
(BW) is programmable to accommodate various deviation, data rate and crystal
tolerance requirements. The transceiver employs the Zero-IF approach with I/Q
demodulation. Consequently, no external components (except crystal and decoupling)
are needed in most applications.
The RF12B dramatically reduces the load on the microcontroller with the integrated
digital data processing features: data filtering, clock recovery, data pattern
recognition, integrated FIFO and TX data register. The automatic frequency control
(AFC) feature allows the use of a low accuracy (low cost) crystal. To minimize the
system cost, the RF12B can provide a clock signal for the microcontroller, avoiding
the need for two crystals.
Features
Typical Applications
¾ Remote control
¾ Home security and alarm
¾ Wireless keyboard/mouse and other PC peripherals
¾ Toy controls
¾ Remote keyless entry
¾ Tire pressure monitoring
¾ Telemetry
¾ Personal/patient data logging
¾ Remote automatic meter reading
APPENDIX B
Resolution
The resolution of the converter indicates the number of discrete values it can produce
over the range of analog values. The values are usually stored electronically in binary
form, so the resolution is usually expressed in bits. In consequence, the number of
discrete values available, or "levels", is usually a power of two. For example, an ADC
with a resolution of 8 bits can encode an analog input to one in 256 different levels,
since 28 = 256. The values can represent the ranges from 0 to 255 (i.e. unsigned
integer) or from -128 to 127 (i.e. signed integer), depending on the application.
Resolution can also be defined electrically, and expressed in volts. The voltage
resolution of an ADC is equal to its overall voltage measurement range divided by the
number of discrete intervals as in the formula:
to
m(k + 1 + b),
where m and b are constants. Here b is typically 0 or −0.5. When b = 0, the ADC is
referred to as mid-rise, and when b = −0.5 it is referred to as mid-tread.
Non-linear ADCs
If the probability density function of a signal being digitized is uniform, then the
signal-to-noise ratio relative to the quantization noise is the best possible. Because of
this, it's usual to pass the signal through its cumulative distribution function (CDF)
before the quantization. This is good because the regions that are more important get
quantized with a better resolution. In the dequantization process, the inverse CDF is
needed.
This is the same principle behind the companders used in some tape-recorders and
other communication systems, and is related to entropy maximization. (Never confuse
companders with compressors!)
For example, a voice signal has a Laplacian distribution. This means that the region
around the lowest levels, near 0, carries more information than the regions with higher
amplitudes. Because of this, logarithmic ADCs are very common in voice
communication systems to increase the dynamic range of the representable values
while retaining fine-granular fidelity in the low-amplitude region. An eight-bit a-law
or the ȝ-law logarithmic ADC covers the wide dynamic range and has a high
resolution in the critical low-amplitude region, that would otherwise require a 12-bit
linear ADC.
Accuracy
An ADC has several sources of errors. Quantization error and (assuming the ADC is
intended to be linear) non-linearity is intrinsic to any analog-to-digital conversion.
There is also a so-called aperture error which is due to a clock jitter and is revealed
when digitizing a time-variant signal (not a constant value). These errors are
measured in a unit called the LSB, which is an abbreviation for least significant bit. In
the above example of an eight-bit ADC, an error of one LSB is 1/256 of the full signal
range, or about 0.4%.
Quantization error
Quantization error is due to the finite resolution of the ADC, and is an unavoidable
imperfection in all types of ADC. The magnitude of the quantization error at the
sampling instant is between zero and half of one LSB. In the general case, the original
signal is much larger than one LSB. When this happens, the quantization error is not
correlated with the signal, and has a uniform distribution. Its RMS value is the standard
APPENDIX C
The liquid crystal display (LCD) is passive display equipment. This means it doesn’t
emit light; instead, it uses the ambient light in the environment. By manipulating this
light, it displays required text using very little power. This has made LCDs preferred
technology whenever low power consumption and compact size is critical hence; it is
suitable for use in battery-powered electronic devices. It is a thin, flat display device
made up of any number of color or monochrome pixels arrayed in front of a light
source or reflector. Each pixel of an LCD consists of a layer of liquid crystal
molecules aligned between two transparent electrodes, and two polarizing filters, the
axes of polarity of which are perpendicular to each other. With no liquid crystal
between the polarizing filters, light passing through one filter would be blocked by the
other. The surfaces of the electrodes that are in contact with the liquid crystal material
are treated so as to align the liquid crystal molecules in a particular direction. Before
applying an electric field, the orientation of the liquid crystal molecules is determined
by the alignment at the surfaces. In a twisted nematic device (the most common liquid
crystal device), the surface alignment directions at the two electrodes are
perpendicular, and so the molecules arrange themselves in a helical structure, or twist.
Because the liquid crystal material is birefringent (i.e. light of different polarizations
travels at different speeds through the material), light passing through one polarizing
filter is rotated by the liquid crystal helix as it passes through the liquid crystal layer,
allowing it to pass through the second polarized filter. Half of the light is absorbed by
the first polarizing filter, but otherwise the entire assembly is transparent. When a
voltage is applied across the electrodes, a torque acts to align the liquid crystal
molecules parallel to the electric field, distorting the helical structure. This reduces the
rotation of the polarization of the incident light, and the device appears gray. If the
applied voltage is large enough, the liquid crystal molecules are completely untwisted
and the polarization of the incident light is not rotated at all as it passes through the
liquid crystal layer. This light will then be polarized perpendicular to the second filter,
and thus be completely blocked and the pixel will appear black. By controlling the
voltage applied across the liquid crystal layer in each pixel, light can be allowed to
44780 standards:
The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the
data bus. The user may select whether the LCD will require a total of 11 data lines (3
control lines plus 8 lines for the data bus). The three control lines are referred to as
EN, RS and RW.
EN:
The EN line is called “Enable”. This control line is used to tell the LCD that you are
sending it data. To send data to the LCD, your program should make sure this line is
low and then set the other two control lines and/or put data on the data bus. When
other lines are completely ready, set EN high and wait for the minimum amount of
time as specified in the data sheet and end by bringing it back to low again.
RS:
The RS line is the “Register Select” line. When RS is low, the data is to be treated as
a command or special instruction. When RS is high the data being sent is text data,
which should be displayed on the screen. For example, to display the letter “T” on the
screen you would set RS high.
RW:
The RW line is the “Read/Write” control line. When RW is low, the information on
the data bus is being written on the LCD. When RW is high, the program is
effectively querying or reading the LCD. Only one instruction is a read command. All
others are write commands so RW will almost always be low.
D0 – D7:
The 8-bit data pins, D0 – D7, are used to send information to the LCD or read the
contents of the LCD’s internal registers. To display letters and numbers, we send
ASCII codes for the letters A – Z, a – z and numbers 0 – 9 to these pins while making
RS = 1. There are also instruction command codes that can be sent to the LCD to clear
the display or force the cursor to the home position or blink the cursor. Table A below
lists the instruction command codes. We also use RS = 0 to check the busy flag bit to
see if the LCD is ready to receive information. The busy flag is D7 and can be read
when R/W = 1 and RS = 0, as follows: if R/W = 1, RS = 0. When D7 = 1(busy flag
=1), the LCD is busy taking care of internal operations and will not accept any new
information. When D7 = 0, the LCD is ready to receive new information. It is always
recommended to check the busy flag before writing any data to the LCD.
Features:
Display applications:
APPENDIX D
This section describes the basic circuit of 4 X 4 matrix keypad using push to on
switches and the basic algorithm to interface the keypad with MCU. The circuit of
figure C.1 shows the 4x4 matrix keypad connected to a single port. The rows are
connected to an output port (upper nibble of the port) and the columns are connected
to input port (lower nibble of the port). If no key has been pressed, reading the input
port will yield 1s for all columns since they are all connected to high (Vcc). If all the
rows are grounded and a key is pressed, one of the columns will have 0 since the key
pressed provides the path to ground. It is the function of the MCU to scan the keypad
continuously to detect and identify the key pressed. The process described as below:
The process is proceeding with grounding rows and reading the columns. To detect a
pressed key, the MCU grounds all rows by providing 0 to the output latch, that it
reads the columns. If the data read from the columns is D3 – D0 = 1111, no key has
been pressed and the process continues until a key press is detected. However, if one
of the column bits has a zero, this means that a key press has occurred. For example,
if D3 – D0 = 1101, this means that a key in the D1 column has been pressed. After a
key press is detected, the MCU will go through the process of identifying the key.
Starting with the top row, the MCU grounds it by providing a low to row D0 only:
then it reads the columns. If the data read is all 1s, no key in that row is activated and
the process is moved to the next row. It grounds the next row, read the columns, and
checks for any zero. This process continues until the row is identified. After
identification of the row in which the key has been pressed, the next task is to find out
which column the pressed key belongs to. This should be easy since the MCU knows
at any time which row and column are being accessed.
!"
#
#$%
&'
!"
!"
Yes
.* /*-/(%*
)*
+,-
!"
--+"
(
,
#%(%
'
#
APPENDIX E
Costing
LEDs 10 5 50
Capacitors 1 pack 50 50
IR Receiver(TSOP) 2 35 70
IR LED 2 10 20
Timer IC (NE555) 1 30 30
IC Base 5 10 50
LDR 1 15 15
LM35 1 90 90
Ceramic capacitor 10 5 50
Relays 5 40 200
Transistor 5 35 105
Miscellaneous -- -- 3,000
APPENDIX F
Snapshots
Fig: - RF module