B.tech Eeeproject
B.tech Eeeproject
B.tech Eeeproject
CHAPTER-1
1. INTRODUCTOIN
EMBEDDED SYSTEMS:
1.1 Introduction:
An embedded system is a system which is going to do a predefined specified task is
the embedded system and is even defined as combination of both software and hardware. A
general-purpose definition of embedded systems is that they are devices used to control,
monitor or assist the operation of equipment, machinery or plant. "Embedded" reflects the
fact that they are an integral part of the system. At the other extreme a general-purpose
computer may be used to control the operation of a large complex processing plant, and its
presence will be obvious.
All embedded systems are including computers or microprocessors. Some of these
computers are however very simple systems as compared with a personal computer.
The very simplest embedded systems are capable of performing only a single function or set
of functions to meet a single predetermined purpose. In more complex systems an application
program that enables the embedded system to be used for a particular purpose in a specific
application determines the functioning of the embedded system. The ability to have programs
means that the same embedded system can be used for a variety of different purposes. In
some cases a microprocessor may be designed in such a way that application software for a
particular purpose can be added to the basic software in a second process, after which it is not
possible to make further changes. The applications software on such processors is sometimes
referred to as firmware.
The simplest devices consist of a single microprocessor (often called a "chip), which
may itself be packaged with other chips in a hybrid system or Application Specific Integrated
Circuit (ASIC). Its input comes from a detector or sensor and its output goes to a switch or
activator which (for example) may start or stop the operation of a machine or, by operating a
valve, may control the flow of fuel to an engine.
As the embedded system is the combination of both software and hardware
Dept. of ECE
AMRN
Software
Hardware
o ALP
o Processor
o C
o Peripheral
o VB
s
o memory
Etc.,
Construction industry
Transport
Domestic service
Communications
Dept. of ECE
AMRN
Instruction set: The set of instructions that the microprocessor can execute.
Clock speed : Given in megahertz (MHz), the clock speed determines how many
The
Register Array is a set of registers used for storing data. These registers can be accessed by
the ALU very quickly. Some registers have specific functions - we will deal with these later.
The Control Unit controls the entire process. It provides the timing and a control signal for
getting data into and out of the registers and the ALU and it synchronizes the execution of
instructions (we will deal with instruction execution at a later date).
Dept. of ECE
AMRN
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 applicatio ns, in contrast to the
microprocessors
used
in
personal
computers
or
other
general
purpose
applications.
ALU
CU
MEMORY
Timer,
Counter,
serial
communication ROM
Dept. of ECE
AMRN
Analog circuits to provide clocks and interface to the real world which is
analog in nature
A new microprocessor can be developed and tested more quickly if one of its aims is
to be less complicated.
instructions will find it easier to develop code with a smaller instruction set.
The simplicity of RISC allows more freedom to choose how to use the space on a
microprocessor.
Higher-level language compilers produce more efficient code than formerly because they
have always tended to use the smaller set of instructions to be found in a RISC computer.
RISC characteristics
Simple instructionset:
In a RISC machine, the instruction set contains simple, basic instructions, from which more
complex instructions can be composed.
Each instruction is the same length, so that it may be fetched in a single operation.
Dept. of ECE
AMRN
1 machine-cycle instructions.
Most instructions complete in one machine cycle, which allows the processor to handle
several instructions at the same time. This pipelining is a key technique used to speed up
RISC machines.
The ease of micro-coding new instructions allowed designers to make CISC machines
upwardly compatible: a new computer could run the same programs as earlier computers
because the new computer would contain a superset of the instructions of the earlier
computers.
implement a given task. This made more efficient use of the relatively slow main memory.
Because micro program instruction sets can be written to match the constructs of
every new version --- so instruction set & chip hardware become more complex with each
generation of computers.
So that as many instructions as possible could be stored in memory with the least
possible wasted space, individual instructions could be of almost any length---this means that
different instructions will take different amounts of clock time to execute, slowing down the
overall performance of the machine.
Dept. of ECE
AMRN
Many specialized instructions aren't used frequently enough to justify their existence -
CISC instructions typically set the condition codes as a side effect of the instruction.
Not only does setting the condition codes take time, but programmers have to remember to
examine the condition code bits before a subsequent instruction changes them.
1.6 Memory Architecture
There two different types memory architectures there are:
Harvard Architecture
Von-Neumann Architecture
Harvard Architecture
Computers have separate memory areas for program instructions and data. There are two
or more internal data buses, which allow simultaneous access to both instructions and data.
The CPU fetches program instructions on the program memory bus.
The Harvard architecture is a computer architecture with physically separate storage and
signal pathways for instructions and data. The term originated from the Harvard Mark I relaybased computer, which stored instructions on punched tape (24 bits wide) and data in electromechanical counters. These early machines had limited data storage, entirely contained
within the central processing unit, and provided no access to the instruction storage as data.
Programs needed to be loaded by an operator, the processor could not boot itself.
Dept. of ECE
AMRN
video processing algorithms. They avoid caches because their behavior must be extremely
reproducible. The difficulties of coping with multiple address spaces are of secondary
concern to speed of execution. As a result, some DSPs have multiple data memories in
distinct address spaces to facilitate SIMD and VLIW processing. Texas Instruments TMS320
C55x processors, as one example, have multiple parallel data busses (two write, three read)
and one instruction bus.
memory) and data (SRAM) memory, with no cache, and take advantage of the Harvard
architecture to speed processing by concurrent instruction and data access. The separate
storage means the program and data memories can have different bit depths, for example
using 16-bit wide instructions and 8-bit wide data. They also mean that instruction pre-fetch
can be performed in parallel with other activities. Examples include, the AVR by Atmel
Corp, the PIC by Microchip Technology, Inc. and the ARM Cortex-M3 processor (not all
ARM chips have Harvard architecture).
Even in these cases, it is common to have special instructions to access program
memory as data for read-only tables, or for reprogramming.
Von-Neumann Architecture
A computer has a single, common memory space in which both program instructions
and data are stored. There is a single internal data bus that fetches both instructions and data.
They cannot be performed at the same time
The von Neumann architecture is a design model for a stored-program digital
computer that uses a central processing unit (CPU) and a single separate storage structure
("memory") to hold both instructions and data. It is named after the mathematician and early
computer scientist John von Neumann. Such computers implement a universal Turing
machine and have a sequential architecture.
A stored-program digital computer is one that keeps its programmed instructions,
as well as its data, in read-write, random-access memory (RAM). Stored-program computers
were advancement over the program-controlled computers of the 1940s, such as the Colossus
and the ENIAC, which were programmed by setting switches and inserting patch leads to
route data and to control signals between various functional units. In the vast majority of
modern computers, the same memory is used for both data and program instructions. The
mechanisms for transferring the data and instructions between the CPU and memory are,
however, considerably more complex than the original von Neumann architecture.
Dept. of ECE
AMRN
The primary difference between Harvard architecture and the Von Neumann
architecture is in the Von Neumann architecture data and programs are stored in the same
memory and managed by the same information handling system.
Whereas the Harvard architecture stores data and programs in separate memory
processing unit (CPU) can either be reading and instruction or writing/reading data to/from
the memory. Both of these operations cannot occur simultaneously as the data and
instructions use the same system bus.
In a computer using the Harvard architecture the CPU can both read an instruction
and access data memory at the same time without cache. This means that a computer with
Harvard architecture can potentially be faster for a given circuit complexity because data
access and instruction fetches do not contend for use of a single memory pathway.
Today, the vast majority of computers are designed and built using the Von Neumann
architecture template primarily because of the dynamic capabilities and efficiencies gained in
designing, implementing, operating one memory system as opposed to two. Von Neumann
architecture may be somewhat slower than the contrasting Harvard Architecture for certain
specific tasks, but it is much more flexible and allows for many concepts unavailable to
Harvard architecture such as self programming, word processing and so on.
Harvard architectures are typically only used in either specialized systems or for very
specific uses.
Dept. of ECE
AMRN
CHAPTER-2
POWER SUPPLY
POWER SUPPLY:
Block diagram:
Dept. of ECE
10
AMRN
Figure: 2.1.2Transformer
Dept. of ECE
11
AMRN
Dept. of ECE
12
AMRN
Dept. of ECE
13
AMRN
Dept. of ECE
14
AMRN
Dept. of ECE
15
AMRN
where Vp is the primary (input) voltage, Vs is the secondary (output) voltage, Np is the
number of turns on the primary coil, and Ns is the number of turns on the secondary coil.
2.2 Diodes:
Diodes allow electricity to flow in only one direction. The arrow of the circuit
symbol shows the direction in which the current can flow. Diodes are the electrical version
of a valve and early diodes were actually called valves.
Dept. of ECE
16
AMRN
Dept. of ECE
17
AMRN
Dept. of ECE
18
AMRN
Dept. of ECE
19
AMRN
20
AMRN
IBM PC/ compatible computers based on x86(8086, 80286, 386, 486 and Pentium)
Dept. of ECE
21
AMRN
Any voltage in between these regions (i.e. between +3 and -3 Volts) is undefined.
The data byte is always transmitted least-significant-bit first.
The bits are transmitted at specific time intervals determined by the baud rate of the serial
signal. This is the signal present on the RS-232 Port of your computer, shown below.
Dept. of ECE
22
AMRN
Dept. of ECE
23
AMRN
The RS232 cables are generally referred to as DB-9 connector. In labeling, DB-9P
refers to the plug connector (male) and DB-9S is for the socket connector (female). The
simplest connection between a PC and microcontroller requires a minimum of three pin,
TXD, RXD, and ground. Many of the pins of the RS232 connector are used for handshaking
signals. They are bypassed since they are not supported by the UART chip.
Dept. of ECE
24
AMRN
Dept. of ECE
25
AMRN
CHAPTER-3
MICRO CONTROLLER
THE MICROCONTROLLER:
A microcontroller is a general purpose device, but that is meant to read data, perform
limited calculations on that data and control its environment based on those calculations. The
prime use of a microcontroller is to control the operation of a machine using a fixed program
that is stored in ROM and that does not change over the lifetime of the system.
The microcontroller design uses a much more limited set of single and double byte
instructions that are used to move data and code from internal memory to the ALU. The
microcontroller is concerned with getting data from and to its own pins; the architecture and
instruction set are optimized to handle data in bit and byte size.
The AT89C51 is a low-power, high-performance CMOS 8-bit microcontroller with
4k bytes of Flash Programmable and erasable read only memory (EROM). The device is
manufactured using Atmels high-density nonvolatile memory technology and is functionally
compatible with the industry-standard 80C51 microcontroller instruction set and pin out. By
combining versatile 8-bit CPU with Flash on a monolithic chip, the Atmels AT89c51 is a
powerful microcomputer, which provides a high flexible and cost- effective solution to many
embedded control applications.
3.1 AT89C51 MICROCONTROLLER
3.1.1FEATURES
80C51 based architecture
4-Kbytes of on-chip Reprogrammable Flash Memory
128 x 8 RAM
Two 16-bit Timer/Counters
Full duplex serial channel
Boolean processor
Four 8-bit I/O ports, 32 I/O lines
Memory addressing capability-64K ROM and 64K RAM
Power save modes-Idle and power-down
Six interrupt sources
Most instructions execute in 0.3 us
CMOS and TTL compatible
Dept. of ECE
26
AMRN
Dept. of ECE
27
AMRN
Dept. of ECE
28
AMRN
Port 2 emits the high-order address byte during fetches from external program
memory and during access to DPTR. In this application Port 2 uses strong internal pull-ups
when emitting 1s. During accesses to external data memory that use 8-bit data address
(MOVX@R1), Port 2 emits the contents of the P2 Special Function Register. Port 2 also
receives the high-order address bits and some control signals during Flash programming and
verification.
Port 3:
Port 3 is 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
Dept. of ECE
29
AMRN
Port pin
Alternate Functions
P3.0
P3.1
P3.2
INT0(external interrupt 0)
P3.3
INT1(external interrupt 1)
P3.4
P3.5
P3.6
P3.7
RST:
Rest input A on this pin for two machine cycles while the oscillator is running resets
the device.
ALE/PROG:
Address Latch Enable is an output pulse for latching the low byte of the address
during access to external memory. This pin is also the program pulse input (PROG) during
Flash programming.
In normal operation ALE is emitted at a constant rate of 1/16 the oscillator frequency and
may be used for external timing or clocking purpose. Note, however, that one ALE pulse is
skipped during each access to external Data memory.
PSEN:
Program Store Enable is the read strobe to external program memory when the
AT89c51 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.
Dept. of ECE
30
AMRN
Dept. of ECE
31
AMRN
Dept. of ECE
32
AMRN
TIMER/COUNTERS
The IS89C51 has two 16-bit Timer/Counter registers: Timer 0 and Timer 1. All two
can be configured to operate either as Timers or event counters. As a Timer, the register is
incremented every machine cycle. Thus, the register counts machine cycles. Since a machine
cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency.
As a Counter, the register is incremented in response to a 1-to-0 transition at its
corresponding external input pin, T0 and T1. The external input is sampled during S5P2 of
every machine cycle. When the samples show a high in one cycle and a low in the next
Dept. of ECE
33
AMRN
OSCILLATOR
FREQUENCY
12D
TLX
TR
THX
TFX
Fig.3.2.1. Timers
TMOD Register
TCON Register
The timer mode SFR is used to configure the mode of operation of each of the two
timers. Using this SFR your program may configure each timer to be a 16-bit timer, or
13 bit timer, 8-bit auto reload timer, or two separate timers. Additionally you may
configure the timers to only count when an external pin is activated or to count
events that are indicated on an external pin.
It can consider as two duplicate 4-bit registers, each of which controls the action of
one of the timers.
Dept. of ECE
34
AMRN
The timer control SFR is used to configure and modify the way in which the 8051s
two timers operate. This SFR controls whether each of the two timers is running or
stopped and contains a flag to indicate that each timer has overflowed. Additionally,
some non-timer related bits are located in TCON SFR.
These bits are used to configure the way in which the external interrupt flags are
activated, which are set when an external interrupt occurs.
T L0
These two SFRs, taken together, represent timer 1. Their exact behavior depends on how the
timer is configured in the TMOD SFR; however, these timers always count up. What is
Configurable is how and when they increment in value.
TH1
TL1
The Timer or Counter function is selected by control bits C/T in the Special Function
Register TMOD. These two Timer/Counters have four operating modes, which are selected
by bit pairs (M1, M0) in TMOD. Modes 0, 1, and 2 are the same for both Timer/Counters,
but Mode 3 is different.
The four modes are described in the following sections.
Mode 0:
Both Timers in Mode 0 are 8-bit Counters with a divide-by-32 pre scalar. Figure 8
shows the Mode 0 operation as it applies to Timer 1. In this mode, the Timer register is
configured as a 13-bit register. As the count rolls over from all 1s to all 0s, it sets the Timer
interrupt flag TF1. The counted input is enabled to the Timer when TR1 = 1 and either GATE
Dept. of ECE
35
AMRN
The 13-bit register consists of all eight bits of TH1 and the lower five bits of TL1. The
upper three bits of TL1 are indeterminate and should be ignored. Setting the run flag (TR1)
does not clear the registers.
Mode 0 operation is the same for Timer 0 as for Timer 1, except that TR0, TF0 and
INT0 replace the corresponding Timer 1 signals. There are two different GATE bits, one for
Timer 1 (TMOD.7) and one for Timer 0 (TMOD.3).
Mode 1
Mode 1 is the same as Mode 0, except that the Timer register is run with all 16 bits.
The clock is applied to the combined high and low timer registers (TL1/TH1). As clock
pulses are received, the timer counts up: 0000H, 0001H, 0002H, etc. An overflow occurs on
the FFFFH-to-0000H overflow flag. The timer continues to count. The overflow flag is the
TF1 bit in TCON that is read or written by software
Mode 2
Mode 2 configures the Timer register as an 8-bit Counter (TL1) with automatic
reload, as shown in Figure 10. Overflow from TL1 not only sets TF1, but also reloads TL1
with the contents of TH1, which is preset by software. The reload leaves the TH1 unchanged.
Mode 2 operation is the same for Timer/Counter 0.
Mode 3
Timer 1 in Mode 3 simply holds its count. The effect is the same as setting TR1 = 0.
Timer 0 in Mode 3 establishes TL0and TH0 as two separate counters. The logic for Mode 3
on Timer 0 is shown in Figure 11. TL0 uses the Timer 0 control bits: C/T, GATE, TR0,
INT0, and TF0. TH0 is locked into a timer function (counting machine cycles) and over the
use of TR1 and TF1 from Timer 1. Thus, TH0 now controls the Timer 1 interrupt.
Mode 3 is for applications requiring an extra 8-bit timer or counter. With Timer 0 in
Mode 3, the AT89C51 can appear to have three Timer/Counters. When Timer 0 is in Mode 3,
Timer 1 can be turned on and off by switching it out of and into its own Mode 3. In this case,
Timer 1 can still be used by the serial port as a baud rate generator or in any application not
requiring an interrupt.
Dept. of ECE
36
AMRN
Interrupt name
0000H
Reset
0003H
External interrupt 0
000BH
Timer interrupt 0
0013H
External interrupt 1
001BH
Timer interrupt 1
0023H
Lower the vector, higher the priority. The External Interrupts INT0 and INT1 can
each be either level-activated or transition-activated, depending on bits IT0 and IT1 in
Register TCON. The flags that actually generate these interrupts are the IE0 and IE1 bits in
TCON. When the service routine is vectored, hardware clears the flag that generated an
external interrupt only if the interrupt was transition-activated. If the interrupt was levelactivated, then the external requesting source (rather than the on-chip hardware) controls the
request flag.
Dept. of ECE
37
AMRN
Dept. of ECE
38
AMRN
Dept. of ECE
39
AMRN
CHAPTER-4
GSM
4.1 GSM:4.1.1Definition of GSM:
GSM (Global System for Mobile communications) is an open, digital cellular
technology used for transmitting mobile voice and data services.
GSM (Global System for Mobile communication) is a digital mobile telephone
system that is widely used in Europe and other parts of the world. GSM uses a variation of
Time Division Multiple Access (TDMA) and is the most widely used of the three digital
wireless telephone technologies (TDMA, GSM, and CDMA). GSM digitizes and compresses
data, then sends it down a channel with two other streams of user data, each in its own time
slot. It operates at either the 900 MHz or 1,800 MHz frequency band. It supports voice calls
and data transfer speeds of up to 9.6 kbit/s, together with the transmission of SMS (Short
Message Service).
4.1.2 History
In 1982, the European Conference of Postal and Telecommunications Administrations
(CEPT) created the Group Special Mobile (GSM) to develop a standard for a mobile
telephone system that could be used across Europe.
In 1987, a memorandum of
Dept. of ECE
40
AMRN
41
AMRN
AMPS (Advanced Mobile Phone System), which appeared in 1976 in the United
States, was the first cellular network standard. It was used primarily in the Americas,
Russia and Asia. This first-generation analogue network had weak security
mechanisms which allowed hacking of telephones lines.
TACS (Total Access Communication System) is the European version of the AMPS
model. Using the 900 MHz frequency band, this system was largely used in England
and then in Asia (Hong-Kong and Japan).
GSM (Global System for Mobile communications) is the most commonly used
standard in Europe at the end of the 20th century and supported in the United States.
This standard uses the 900 MHz and 1800 MHz frequency bands in Europe. In the
United States, however, the frequency band used is the 1900 MHz band. Portable
telephones that are able to operate in Europe and the United States are therefore
called tri-band.
CDMA (Code Division Multiple Access) uses a spread spectrum technique that
allows a radio signal to be broadcast over a large frequency range.
Dept. of ECE
42
AMRN
Dept. of ECE
43
AMRN
Dept. of ECE
44
AMRN
TDMA systems still rely on switch to determine when to perform a handoff. Handoff
occurs when a call is switched from one cell site to another while travelling. The TDMA
handset constantly monitors the signals coming from other sites and reports it to the switch
without callers awareness. The switch then uses this information for making better choices
for handoff at appropriate times. TDMA handset performs hard handoff, i.e., whenever the
user moves from one site to another, it breaks the connection and then provides a new
connection with the new site.
Advantages of TDMA:
There are lots of advantages of TDMA in cellular technologies.
1. It can easily adapt to transmission of data as well as voice communication.
Dept. of ECE
45
AMRN
Fig.4.1.5(a)Cellular Network
Cellular networks are based on the use of a central transmitter-receiver in each cell,
called a "base station" (or Base Transceiver Station, written BTS). The smaller the radius of
a cell, the higher is the available bandwidth. So, in highly populated urban areas, there are
cells with a radius of a few hundred meters, while huge cells of up to 30 kilometers provide
coverage in rural areas.
Dept. of ECE
46
AMRN
All the base stations of a cellular network are connected to a base station
controller (BSC) which is responsible for managing distribution of the resources. The
Dept. of ECE
47
AMRN
Dept. of ECE
48
AMRN
Dept. of ECE
49
AMRN
Authentication key
Dept. of ECE
50
AMRN
Computers use AT commands to control modems. Both GSM modems and dial-up modems
support a common set of standard AT commands. In addition to the standard AT commands,
GSM modems support an extended set of AT commands. These extended AT commands are
defined in the GSM standards. With the extended AT commands, the following operations
can be performed:
The number of SMS messages that can be processed by a GSM modem per minute
is very low i.e., about 6 to 10 SMS messages per minute.
Dept. of ECE
51
AMRN
(AT+CGMI),
model
number
(AT+CGMM),
IMEI
number
Dept. of ECE
whether
facility
is
52
locked
(AT+CLCK)
and
changing
AMRN
It should be noted that the mobile phone manufacturers usually do not implement all
AT commands, command parameters and parameter values in their mobile phones. Also, the
behavior of the implemented AT commands may be different from that defined in the
standard. In general, GSM modems, designed for wireless applications, have better support of
AT commands than ordinary mobile phones.
4.1.10. Basic concepts of SMS technology
1. Validity Period of an SMS Message
An SMS message is stored temporarily in the SMS center if the recipient mobile
phone is offline. It is possible to specify the period after which the SMS message will be
deleted from the SMS center so that the SMS message will not be forwarded to the recipient
mobile phone when it becomes online. This period is called the validity period. A mobile
phone should have a menu option that can be used to set the validity period. After setting it,
the mobile phone will include the validity period in the outbound SMS messages
automatically.
2. Message Status Reports
Sometimes the user may want to know whether an SMS message has reached the
recipient mobile phone successfully. To get this information, you need to set a flag in the
Dept. of ECE
53
AMRN
Dept. of ECE
54
AMRN
Dept. of ECE
55
AMRN
56
AMRN
LDRs or Light Dependent Resistors are very useful especially in light/dark sensor circuits.
Normally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms, but
when they are illuminated with light resistance drops dramatically.
The animation opposite shows that when the torch is turned on, the resistance of the LDR
falls, allowing current to pass through it.
Dept. of ECE
57
AMRN
Circuit Wizard software has been used to display, the range of values of a ORP12, LDR .
When a light level of 1000 lux (bright light) is directed towards it, the resistance is 400R
(ohms).
When a light level of 10 lux (very low light level) is directed towards it, the resistance has
risen dramatically to 10.43M (10430000 ohms).
Dept. of ECE
58
AMRN
The photo resistor, or Light Dependent Resistor, finds many uses as a low cost photo
sensitive element and was used for many years in photographic light meters as well as other
applications.such as flame, smoke, and burgler detectors, card readers and lighting controls
for street lamps.
Units for the light intensity are Lux or Lumence.
4.3.1.Basic structure:
Although there are many ways in which LDRs or photo resistors can be manufactured,
there are naturally a few more common methods that are seen. Essentially the LDR or photo
resistor consists of a resistive material sensitive to light that is exposed to light. The photo
resistive element comprises section of material with contacts at either end. Although many of
the material used for light dependent resistors are semiconductors, when used as photo
resistors, they are used only as a resistive element and there are no p-n junctions. Accordingly
the devices purely passive.
A typical structure for a Light Dependent Resistor uses an active semiconductor layer that
is deposited on an insulating substrate. The semiconductor is normally lightly doped to enable
it to have the required level of conductivity. Contacts then placed either side of the exposed
area. In many instances the area between the contacts is in the form of zig zag, or inter
digital pattern. This maximizes the exposed area and by keeping the distance between the
contacts small it enhances the gain.
It also possible to use a poly crystalline semiconductor that is deposited onto a
substrate such as ceramic. This makes for a very low cost light dependent resistor.
4.3.2. Operation:
Light Dependent Resistor made of a high resistance semiconductor, if light falling on
the is of high enough efficiently, photon absorbed by the semiconductor give bound electrons
enough energy to jump into the conduction band. The resulting free electron (and its hole
partner) conduct electricity, thereby lowering resistance.
In intrinsic devices, the only available electrons are in the valence band, and hence the
photon must have enough energy to excite the electrons across the entire band gap. Extrinsic
devices have impurities added , which have a ground state energy closer to the conduction
band, since the electrons dont have so far to jump, lower energy photons ( i.e. longer
wavelengths and lower frequencies ) will suffice to trigger the device.
4.3.3. Characteristics of LDR:
The characteristics of LDR are shown below. Here the resistance variations are shown as
a function of illumination. The resistance of LDR decreases with increasing incident light
intensity
Dept. of ECE
59
AMRN
1000
100
Res.
10
1.0
0.1
0.1
1.0
10
100
( Ftc )*
*1 Ftc = 10.764 lumens
Fig 4.3.4.(a) Characteristics of LDR
4.3.4.LDR Applications:
LDRs are very useful especially in light/dark sensor circuits. Normally the resistance
of LDR is very high, sometimes as high as 1000k ohms,but when they are illuminated with
light, resistance drops immediately.
1. Camera light meters.
2. Clock radios.
3. Security alarms.
4. Optical switches.
5. Far infrared detector.
6. Streetlights.
Dept. of ECE
60
AMRN
Vout
LDR
4.4 Thermistor:
Fig.4.4.Thermistor symbol
A thermistor is a type of resistor with resistance inversely proportional to its
temperature. The word is a portmanteau of thermal and resistor. Samuel Ruben invented the
thermistor in 1930, and was awarded U.S. Patent No. 2,021,491.
Dept. of ECE
61
AMRN
Dept. of ECE
62
AMRN
1 Steinhart-Hart equation
2 B parameter equation
3 Conduction model
4 Self-heating effects
5 Applications
6 References
7 See also
8 External links
Steinhart-Hart equation
In practice, the linear approximation (above) works only over a small temperature range.
For accurate temperature measurements, the resistance/temperature curve of the device must
be described in more detail. The Steinhart-Hart equation is a widely used third-order
approximation:
where a, b and c are called the Steinhart-Hart parameters, and must be specified for each
device. T is the temperature in kelvins and R is the resistance in ohms. To give resistance as a
function of temperature, the above can be rearranged into:
where
and
The error in the Steinhart-Hart equation is generally less than 0.02C in the measurement of
temperature. As an example, typical values for a thermistor with a resistance of 3000 at
room temperature (25C = 298.15 K) are:
Dept. of ECE
63
AMRN
B parameter equation
NTC thermistors can also be characterised with the B parameter equation, which is essentially
the Steinhart Hart equation with c=0.
where the temperatures are in kelvin and R0 is the resistance at temperature T0 (usually
25 C=298.15 K). Solving for R yields:
or, alternatively,
Where
. This can be
used to convert the function of resistance vs. temperature of a thermistor into a linear function
of lnR vs. 1 / T. The average slope of this function will then yield an estimate of the value of
the B parameter.
Conduction model
Many NTC thermistors are made from a pressed disc or cast chip of a semiconductor
such as a sintered metal oxide. They work because raising the temperature of a
semiconductor increases the number of electrons able to move about and carry charge - it
Dept. of ECE
64
AMRN
coulomb)
The current is measured using an ammeter. Over large changes in temperature, calibration is
necessary. Over small changes in temperature, if the right semiconductor is used, the
resistance of the material is linearly proportional to the temperature. There are many different
semiconducting thermistors with a range from about 0.01 kelvin to 2,000 kelvins (-273.14C
to 1,700C).
Most PTC thermistors are of the "switching" type, which means that their resistance rises
suddenly at a certain critical temperature. The devices are made of a doped polycrystalline
ceramic containing barium titanate (BaTiO3) and other compounds. The dielectric constant of
this ferroelectric material varies with temperature. Below the Curie point temperature, the
high dielectric constant prevents the formation of potential barriers between the crystal
grains, leading to a low resistance. In this region the device has a small negative temperature
coefficient. At the Curie point temperature, the dielectric constant drops sufficiently to allow
the formation of potential barriers at the grain boundaries, and the resistance increases
sharply. At even higher temperatures, the material reverts to NTC behaviour. The equations
used for modeling this behaviour were derived by W. Heywang and G. H. Jonker in the
1960s.
Another type of PTC thermistor is the polymer PTC, which is sold under brand names
such as "Polyswitch" "Semifuse", and "Multifuse". This consists of a slice of plastic with
carbon grains embedded in it. When the plastic is cool, the carbon grains are all in contact
with each other, forming a conductive path through the device. When the plastic heats up, it
expands, forcing the carbon grains apart, and causing the resistance of the device to rise
Dept. of ECE
65
AMRN
where I is current and V is the voltage drop across the thermistor. This power is converted
to heat, and this heat energy is transferred to the surrounding environment. The rate of
transfer is well described by Newton's law of cooling:
Where T(R) is the temperature of the thermistor as a function of its resistance R, T0 is the
temperature of the surroundings, and K is the dissipation constant, usually expressed in units
of milli watts per C. At equilibrium, the two rates must be equal.
Dept. of ECE
66
AMRN
The dissipation constant is a measure of the thermal connection of the thermistor to its
surroundings. It is generally given for the thermistor in still air, and in well-stirred oil.
Typical values for a small glass bead thermistor are 1.5 mW/C in still air and 6.0 mW/C in
stirred oil. If the temperature of the environment is known beforehand, then a thermistor may
be used to measure the value of the dissipation constant. For example, the thermistor may be
used as a flow rate sensor, since the dissipation constant increases with the rate of flow of a
fluid past the thermistor.
4.4.2. Applications
NTC thermistors are regularly used in automotive applications. For example, they
monitor things like coolant temperature and/or oil temperature inside the engine and
provide data to the ECU and, indirectly, to the dashboard.
Thermistor are also commonly used in modern digital thermostats and to monitor the
temperature of battery packs while charging.
Dept. of ECE
67
AMRN
CHAPTER-5
LCD (LIQUID CRISTAL DISPLAY)
LCD (Liquid Cristal Display)
A liquid crystal display (LCD) 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
consists of a column of liquid crystal molecules suspended between two transparent
electrodes, and two polarizing filters, the axes of polarity of which are perpendicular to each
other. Without the liquid crystals between them, light passing through one would be blocked
by the other. The liquid crystal twists the polarization of light entering one filter to allow it to
pass through the other.
A program must interact with the outside world using input and output devices that
communicate directly with a human being. One of the most common devices attached to an
controller is an LCD display. Some of the most common LCDs connected to the contollers
are 16X1, 16x2 and 20x2 displays. This means 16 characters per line by 1 line 16 characters
per line by 2 lines and 20 characters per line by 2 lines, respectively.
Many microcontroller devices use 'smart LCD' displays to output visual information.
LCD displays designed around LCD NT-C1611 module, are inexpensive, easy to use, and it
is even possible to produce a readout using the 5X7 dots plus cursor of the display. They
have a standard ASCII set of characters and mathematical symbols. For an 8-bit data bus, the
display requires a +5V supply plus 10 I/O lines (RS RW D7 D6 D5 D4 D3 D2 D1 D0). For
a 4-bit data bus it only requires the supply lines plus 6 extra lines(RS RW D7 D6 D5 D4).
When the LCD display is not enabled, data lines are tri-state and they do not interfere with
the operation of the microcontroller.
5.1 Features:
(1) Interface with either 4-bit or 8-bit microprocessor.
available. Line
Dept. of ECE
Shapes and S
68
AMRN
triggered
at power
ON.
oscillator.
Dept. of ECE
69
AMRN
Intelligent, with built-in Hitachi HD44780 compatible LCD controller and RAM
providing simple interfacing
5 x 7 dot matrix format for 2.96 x 5.56 mm characters, plus cursor line
Dept. of ECE
70
AMRN
Symbol
Level
Function
VSS
Power, GND
VDD
Power, 5V
Vo
Pin
RS
H/L
H: Data Input
L: Instruction Input
R/W
7-14 DB0-DB7
H/L
H,H->L Enable
H/L
15
NC
NOT CONNECTED
16
NC
NOT CONNECTED
Dept. of ECE
71
AMRN
Even limited to character based modules, there is still a wide variety of shapes and sizes
available. Line lengths of 8, 16,20,24,32 and 40 characters are all standard, in one, two and
four line versions.
Several different LC technologies exists. Supertwist types, for example, offer Improved
contrast and viewing angle over the older twisted nematic types. Some modules are
available with back lighting, so that they can be viewed in dimly-lit conditions. The back
lighting may be either electro-luminescent, requiring a high voltage inverter circuit, or
simple LED illumination.
Dept. of ECE
72
AMRN
Dept. of ECE
73
AMRN
CONTROL LINES:
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 (0) and then
set the other two control lines and/or put data on the data bus. When the other lines are
completely ready, bring EN high (1) and wait for the minimum amount of time required by
the LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.
RS:
Line is the "Register Select" line. When RS is low (0), the data is to be treated as a
command or special instruction (such as clear screen, position cursor, etc.). When RS is high
(1), the data being sent is text data which sould be displayed on the screen. For example, to
display the letter "T" on the screen you would set RS high.
RW:
Line is the "Read/Write" control line. When RW is low (0), the information on the
data bus is being written to the LCD. When RW is high (1), the program is effectively
querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command.
All others are write commands, so RW will almost always be low.
Dept. of ECE
74
AMRN
Dept. of ECE
75
AMRN
Dept. of ECE
76
AMRN
Dept. of ECE
77
AMRN
Dept. of ECE
78
AMRN
5.10. FLOWCHART:
1
Wait
No
Yes
Is LCD Free
Set RS Bit
Enable LCD
Send Data
Disable LCD
Is Data
Count Zero
No
STOP
Dept. of ECE
79
AMRN
CHAPTER-6
SOURCE CODE
KEIL SOFTWARETOOL (STEPS)
1.
2.
3.
4.
Dept. of ECE
80
AMRN
Save the Project by typing suitable project name with no extension in u r own
folder sited in either C:\ or D:\
6.
7.
8.
9.
Dept. of ECE
81
AMRN
10.
Then Click on OK
11.
12.
13.
14.
Now double click on the Target1, you would get another option Source group 1
as shown in next page.
Dept. of ECE
82
AMRN
15.
Click on the file option from menu bar and select new
16.
The next screen will be as shown in next page, and just maximize it by double
clicking on its blue boarder.
Dept. of ECE
83
AMRN
17.
18.
For a program written in Assembly, then save it with extension . asm and for
C based program save it with extension .C
19.
Now right click on Source group 1 and click on Add files to Group Source
Dept. of ECE
84
AMRN
20.
Now you will get another window, on which by default C files will appear.
21.
Now select as per your file extension given while saving the file
22.
23.
Now Press function key F7 to compile. Any error will appear if so happen.
Dept. of ECE
85
AMRN
24.
25.
26.
Then Click OK
27.
Now Click on the Peripherals from menu bar, and check your required port as
shown in fig below
Dept. of ECE
86
AMRN
28.
29.
30.
Dept. of ECE
87
AMRN
CHAPTER-7
CODE
#include<reg51.h>
#include<string.h>
#define lcd_data P2
Sbit lcd_rs = P2^0;
Sbit lcd_en = P2^1;
Sbit fire=P1^1;
Sbit smoke=P1^0;
//sbit buzz=P3^7;
Unsigned char past number [11];
Unsigned int count=0;
Unsigned char rcg,rcv,i;
Void delay (unsigned int t)
{
Unsigned int i, j;
for (i=0;i<t;i++)
for (j=0; j<800;j++);
}
Void lcdcmd (unsigned char value)
// LCD COMMAND
{
lcd_data=value&(0xf0); //send msb 4 bits
lcd_rs=0;
lcd_en=1;
delay (3);
Dept. of ECE
88
AMRN
lcd_en=0;
lcd_data= ((value<<4)&(0xf0));
lcd_rs=0;
lcd_en=1;
delay(3);
lcd en=0;
}
void lcd_init(void)
{
lcdcmd(0x02);
lcdcmd(0x02);
lcdcmd(0x28); //intialise the lcd in 4 bit mode*/
lcdcmd(0x28); //intialise the lcd in 4 bit mode*/
lcdcmd(0x0e);
//cursor blinking
lcdcmd (0x06);
lcdcmd(0x01);
}
void lcddata(unsigned char value)
{
lcd_data=value&(0xf0); //send msb 4 bits
lcd_rs=1;
lcd_en=1;
delay(3);
lcd_en=0;
lcd_data= ((value<<4)&(0xf0));
Dept. of ECE
AMRN
lcd_rs=1;
lcd_en=1;
delay(3);
lcd_en=0;
delay(3);
}
void msgdisplay(unsigned char b[]) // send string to lcd
{
unsigned char s,count=0;
for(s=0;b[s]! ='\0';s++)
{
count++;
if(s==16)
lcdcmd(0xc0);
if(s==32)
{
lcdcmd(1);
count=0;
}
lcddata(b[s]);
}
}
void serinit()
{
TMOD=0x20;
Dept. of ECE
90
AMRN
TH1=0xFD;
//9600
SCON=0x50;
TR1=1;
}
unsigned char receive()
{
unsigned char rx;
while(RI == 0);
rx=SBUF;
RI=0;
return rx;
}
void sertx(unsigned char tx)
{
unsigned char v;
SBUF=tx;
while(TI == 0);
TI=0;
v=receive ();
delay(10);
}
void sertxs(unsigned char *tx)
{
unsigned char v;
for(;*tx != '\0';tx++)
Dept. of ECE
91
AMRN
{
SBUF=*tx;
while(TI == 0);
TI=0;
v=receive();
delay(10);
}
}
void main()
{
fire=smoke=1;
// buz=1;
lcd_init ();
lcdcmd (0x01);
lcdcmd (0x80);
msgdisplay("INDUSTRIAL SAFETY ");
lcdcmd (0xc0);
msgdisplay(" SYSTEM ");
serinit();
sertxs("AT\r\n");
sertxs("AT+CMGF=1\r\n");
sertxs("AT+CNMI=1,2,0,0\r\n");
lcdcmd(0x01);
msgdisplay("SEND MESSAGE TO STR MOBL NUM");
do{
Dept. of ECE
92
AMRN
rcg=receive();
}while (rcg != '+');
for (count=0;count<9;count++)
{
rcg=receive();
}
for(count=0;count<10;count++)
{
Pastnumber [count] =receive ();
}
sertxs ("AT+CMGS=\"");
sertxs(pastnumber);
sertxs("\"\r\n");
sertxs("Mobile no. registered\r\n");
sertx(0x1A);
lcdcmd (0x01);
msgdisplay ("MOBILE NUMBER IS REGISTERED");
delay(200);
lcdcmd(0x01);
while(1)
{
if(fire==0)
{
lcdcmd(0x01);
msgdisplay("FIRE DETECTED");
Dept. of ECE
93
AMRN
sertxs("AT+CMGS=\"");
sertxs(pastnumber);
sertxs("\"\r\n");
sertxs("FIRE DETECTED\r\n");
sertx(0x1A);
delay(100);
lcdcmd(0x01);
}
if(smoke==0)
{
lcdcmd(0xC0);
msgdisplay("SMOKE DETECTED");
sertxs("AT+CMGS=\"");
sertxs(pastnumber);
sertxs("\"\r\n");
sertxs("SMOKE DETECTED\r\n");
sertx(0x1A);
delay(100);
lcdcmd (0x01);
}
}
Dept. of ECE
94
AMRN
CHAPTER-8
CONCLUSION
The project deals with designing a simple and low cost weather monitoring system using
LM35, LCD, SIM300 and ATMEGA-32 microcontroller unit to monitor weather conditions of
the desired location and transmit it to a a cell phone at distant location through SMS. The
designed product module is at prelim stage and designed only for temperature monitoring but can
be enhanced for monitoring other different type of environmental and climatic behavior of a
location, which also can be cost effective.
Dept. of ECE
95
AMRN
CHAPTER-9
APPLICATIONS AND ADVANTAGES
& FUTURE SCOPE
Applications and Advantages:
Weather can be monitored from a remote.
Detection and temperature condition will help us to avoid damage.
It is used as a weather reporting system.
It is widely used in industries.
No need of smart phone and android phone to know the weather.
Weather can be monitored with in simple text message
Automatically send caution message when abnormal condition occurs.
Future Scope:
Dept. of ECE
96
AMRN
CHAPTER-10
BIBLIOGRAPHY
REFERENCES
The 8051 Micro controller and Embedded Systems
o MuhammadAliMa
zidi
o JaniceGillispieMa
zidi
The8051MicrocontrollerArchitecture, Programming&
Applications
o KennethJ.Ayala
Fundamentals of Micro processors and Micro computers
o B. Ram
Electronic Components
D.V.Prasad
Dept. of ECE
97
AMRN