Post on 04-Mar-2015
CONTENTS
1 PREAMBLE………………………………………………………………………………………………………………………..1
2 BLOCK DIAGRAM...................................................................................................................5
2.1 TRANSMITTER SECTION.....................................................................................................5
2.2 RECEIVER SECTION.............................................................................................................6
2.3 BLOCK DIAGRAM EXPLANATION........................................................................................6
3.SCHEMATIC DIAGRAM...........................................................................................................8
3.1 Transmitter section.............................................................................................................8
3.2 Receiver section.................................................................................................................8
3.3 Schematic explaination......................................................................................................9
4. HARDWARE EXPLANATION.................................................................................................10
4.1 POWER SUPPLY..............................................................................................................10
4.2 MICROCONTROLLER.........................................................................................................18
4.3 SENSORS …………………………………………………………………………………………… ………………………30
5 ZIG BEE TRANSICIVER..........................................................................................................59
6 GPS: Global Positioning System..........................................................................................75
7 SOFTWARE EXPLANATION……………………………………………………………………………………………..96
PROJECT DESCRIPTION …………………………………………………………………………………………………….112
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 1
1. Preamble
1.1 Introduction
The foremost critical task for coal mine is of keeping track of miners spread
out across a large mining areas .It becomes even difficult when mine tunnels collapse.
Many mines use a radio system to track miners, but when a collapse occurs, the base
stations connected by a thin wire often are rendered useless.
In this project to overcome the demerits of radio system we used wireless
technology for tracking the miners. For this purpose a small zig bee transmitter
module is equipped to each person entering a mine. Each transceiver placed in the
mine look after the location of miners. The transceivers communicate with base
stations through zigbee module. In addition of tracking the location of miners we also
include sensors such as temperature & humidity to intimate the base station & miners
when some atmosphere changes occur.
Mine operators are now able to monitor the real-time locations of each miner
to better pin point their locations in the event of an emergency. Even after a full-day
of use, mine operators can locate an individual miner within twenty feet.
1.2 Objective of the Project:
The main aim of this project is to design a system which will able to monitor the
conditions in coal mines for safety of miners.it can also used to identify the location
of miners in case of any accidents.it can also used to warn the miners in case of any
threats.
Chapter 2 provides the block diagram explanation of this project .
Chapter 3 Explains the detailed information of schematic diagram.
Chapter 4 provides details about different hardware components such as power
supply,Microcontroller AT89S52,Sensors(Temperature, Fire and Gas sensors, voice
chip,speaker etc.,
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 2
Chapter 5 gives detailed explaination of ZigBee.
In Chapter 6provides details about GPS.
In Chapter 7 software ad soft code part is explained.
In chapter 8 provides circuit description.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 3
2 BLOCK DIAGRAM
2.1 TRANSMITTER SECTION
Fig 1: transmitter section
2.2 RECEIVER SECTION
Fig2: receiver section
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 4
2.3 BLOCK DIAGRAM EXPLANATION
2.3.1 MICROCONTROLLER:
The microcontroller is the heart of the proposed embedded system. The
controller used is a low power, cost efficient chip manufactured by ATMEL having
8K bytes of on-chip flash memory. Whenever any object passes ir receiver receive the
information and displays the information on lcd according to the instructions given
by the micro controller.
2.3.2 POWER SUPPLY:
A device or system that supplies electrical or other types of energy to an
output load or group of loads is called a power supply unit or PSU. The term is most
commonly applied to electrical energy supplies, less often to mechanical ones, and
rarely to others. Here we giving 5v to the micro controller
2.3.3 TEMPERATURE SENSOR (LM35):
Precision Centigrade Temperature Sensor
In this project, in order to obtain the fan speed based on temperature, initially
this temperature value has to be read and fed to the microcontroller. This temperature
value has to be sensed. Thus a sensor has to be used and the sensor used in this project
is LM35. It converts temperature value into electrical signals.
LM35 series sensors are precision integrated-circuit temperature sensors
whose output voltage is linearly proportional to the Celsius temperature. The LM35
requires no external calibration since it is internally calibrated. . The LM35 does not
require any external calibration or trimming to provide typical accuracies of ±1⁄4°C at
room temperature and ±3⁄4°C over a full −55 to +150°C temperature range.
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.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 5
3.SCHEMATIC DIAGRAM
3.1 Transmitter section
FIGURE3:transmitter section
3.2 Receiver section
Figure4:receiver section
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 6
3.3 Schematic explaination
Transmitter section:In this project transmitter section which is present in mines
transmits the acquired data to receiver section.the sensors senses the respective
physical signals and converts it to electrical signals.this whole data is send to the
microcontroller through wired connections.
The microcontroller at89s52 is programmed to send the data to receiver when
the temperature, gas, fires levels crosses certain allowable levels.this whole data is
send to the receiver section where it can be monitored.
If the signals croses the levels then the voice chip will announce if any
threats.the GPS receiver will locate the miner who is working in mines and the
location co-ordinates is displayed at receiver section.
The whole data is send to the receiver section through RF signals. Here the RF
communication is done through ZigBee (specification of the IEEE 802.15.4)
module.since it is a transreceiver it can send data as well as receive any data send by
the controller at receiver section.
Receiver Section: this is basically the monitoring section. every developed by sensing
which is done by sensors is received through ZigBee is processed at the
microcontroller.this data is displayed on the LCD screens.the controller at the
receiver will observe the readings and also can announce the threats if any.
. ZigBee is connected to pin-10 which is RXD(serial communication port).port-
2 is used to cnnect other peripherials.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 7
4. HARDWARE EXPLANATION
4.1 Power Supply:
Power supply is a reference to a source of electrical power. A device or system that
supplies electrical or other types of energy to an output load or group of loads is called a
power supply unit or PSU. The term is most commonly applied to electrical energy
supplies, less often to mechanical ones, and rarely to others.
This power supply section is required to convert AC signal to DC signal and also to
reduce the amplitude of the signal. The available voltage signal from the mains is
230V/50Hz which is an AC voltage, but the required is DC voltage (no frequency) with the
amplitude of +5V and +12V for various applications.
In this section we have Transformer, Bridge rectifier, are connected serially and
voltage regulators for +5V and +12V (7805 and 7812) via a capacitor (1000µF) in parallel
are connected parallel as shown in the circuit diagram below. Each voltage regulator output
is again is connected to the capacitors of values (100µF, 10µF, 1 µF, 0.1 µF) are connected
parallel through which the corresponding output (+5V or +12V) are taken into
consideration.
Fig5: power supply diagram
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 8
4.1.1 Transformer
A transformer is a device that transfers electrical energy from one circuit to
another through inductively coupled electrical conductors. A changing current in the
first circuit (the primary) creates a changing magnetic field; in turn, this magnetic
field induces a changing voltage in the second circuit (the secondary). By adding a
load to the secondary circuit, one can make current flow in the transformer, thus
transferring energy from one circuit to the other.
The secondary induced voltage VS, of an ideal transformer, is scaled from the
primary VP by a factor equal to the ratio of the number of turns of wire in their
respective windings:
Basic principle
The transformer is based on two principles: firstly, that an electric current can
produce a magnetic field (electromagnetism) and secondly that a changing magnetic
field within a coil of wire induces a voltage across the ends of the coil
(electromagnetic induction). By changing the current in the primary coil, it changes
the strength of its magnetic field; since the changing magnetic field extends into the
secondary coil, a voltage is induced across the secondary.
A simplified transformer design is shown below. A current passing through
the primary coil creates a magnetic field. The primary and secondary coils are
wrapped around a core of very high magnetic permeability, such as iron; this ensures
that most of the magnetic field lines produced by the primary current are within the
iron and pass through the secondary coil as well as the primary coil.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 9
.
Fig5: transformer internal diagram
An ideal step-down transformer showing magnetic flux in the core.
Induction law
The voltage induced across the secondary coil may be calculated from
Faraday's law of induction, which states that:
Where VS is the instantaneous voltage, NS is the number of turns in the
secondary coil and Φ equals the magnetic flux through one turn of the coil. If the
turns of the coil are oriented perpendicular to the magnetic field lines, the flux is the
product of the magnetic field strength B and the area A through which it cuts. The
area is constant, being equal to the cross-sectional area of the transformer core,
whereas the magnetic field varies with time according to the excitation of the primary.
Since the same magnetic flux passes through both the primary and secondary coils in
an ideal transformer, the instantaneous voltage across the primary winding equals
Taking the ratio of the two equations for VS and VP gives the basic equation for
stepping up or stepping down the voltage
Ideal power equation
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 10
If the secondary coil is attached to a load that allows current to flow, electrical
power is transmitted from the primary circuit to the secondary circuit. Ideally, the
transformer is perfectly efficient; all the incoming energy is transformed from the
primary circuit to the magnetic field and into the secondary circuit. If this condition is
met, the incoming electric power must equal the outgoing power.
Pin coming = IPVP = Pout going = ISVS
Giving the ideal transformer equation
Pin-coming = IPVP = Pout-going = ISVS
.
If the voltage is increased (stepped up) (VS > VP), then the current is decreased
(stepped down) (IS < IP) by the same factor. Transformers are efficient so this formula
is a reasonable approximation.
The impedance in one circuit is transformed by the square of the turns ratio.
For example, if an impedance ZS is attached across the terminals of the secondary
coil, it appears to the primary circuit to have an impedance of
Detailed operation
The simplified description above neglects several practical factors, in
particular the primary current required to establish a magnetic field in the core, and
the contribution to the field due to current in the secondary circuit.Models of an ideal
transformer typically assume a core of negligible reluctance with two windings of
zero resistance. When a voltage is applied to the primary winding, a small current
flows, driving flux around the magnetic circuit of the core.
The changing magnetic field induces an electromotive force (EMF) across
each winding. Since the ideal windings have no impedance, they have no associated
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 11
voltage drop, and so the voltages VP and VS measured at the terminals of the
transformer, are equal to the corresponding EMFs. The primary EMF, acting as it
does in opposition to the primary voltage, is sometimes termed the "back EMF". This
is due to Lenz's law which states that the induction of EMF would always be such that
it will oppose development of any such change in magnetic field.
4.1.2 Bridge Rectifier
A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge
configuration that provides the same polarity of output voltage for any polarity of
input voltage. When used in its most common application, for conversion of
alternating current (AC) input into direct current (DC) output, it is known as a bridge
rectifier. A bridge rectifier provides full-wave rectification from a two-wire AC input,
resulting in lower cost and weight as compared to a center-tapped transformer design,
but has two diode drops rather than one, thus exhibiting reduced efficiency over a
center-tapped design for the same output voltage.
Basic Operation
When the input connected at the left corner of the diamond is positive with
respect to the one connected at the right hand corner, current flows to the right along
the upper colored path to the output, and returns to the input supply via the lower one.
Fig6. bridge rectifier
When the right hand corner is positive relative to the left hand corner, current
flows along the upper colored path and returns to the supply via the lower colored
path.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 12
Fig 7. bridge rectifier
In each case, the upper right output remains positive with respect to the lower
right one. Since this is true whether the input is AC or DC, this circuit not only
produces DC power when supplied with AC power: it also can provide what is
sometimes called "reverse polarity protection". That is, it permits normal functioning
when batteries are installed backwards or DC input-power supply wiring "has its
wires crossed" (and protects the circuitry it powers against damage that might occur
without this circuit in place).
Prior to availability of integrated electronics, such a bridge rectifier was
always constructed from discrete components. Since about 1950, a single four-
terminal component containing the four diodes connected in the bridge configuration
became a standard commercial component and is now available with various voltage
and current ratings.
Fig 8: wave forms of rectifier
4.1.3 Output smoothing (Using Capacitor)
For many applications, especially with single phase AC where the full-wave
bridge serves to convert an AC input into a DC output, the addition of a capacitor may
be important because the bridge alone supplies an output voltage of fixed polarity but
pulsating magnitude (see diagram above).
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 13
Fig 9: smoothing capacitor
The function of this capacitor, known as a reservoir capacitor (aka smoothing
capacitor) is to lessen the variation in (or 'smooth') the rectified AC output voltage
waveform from the bridge. One explanation of 'smoothing' is that the capacitor
provides a low impedance path to the AC component of the output, reducing the AC
voltage across, and AC current through, the resistive load. In less technical terms, any
drop in the output voltage and current of the bridge tends to be cancelled by loss of
charge in the capacitor.
This charge flows out as additional current through the load. Thus the change
of load current and voltage is reduced relative to what would occur without the
capacitor.Increases of voltage correspondingly store excess charge in the capacitor,
thusmoderating the change in output voltage / current. Also see rectifier output
smoothing.
The simplified circuit shown has a well deserved reputation for being
dangerous, because, in some applications, the capacitor can retain a lethal charge
after the AC power source is removed. If supplying a dangerous voltage, a practical
circuit should include a reliable way to safely discharge the capacitor
If the normal load can not be guaranteed to perform this function, perhaps
because it can be disconnected, the circuit should include a bleeder resistor connected
as close as practical across the capacitor. This resistor should consume a current large
enough to discharge the capacitor in a reasonable time, but small enough to avoid
unnecessary power waste.
Because a bleeder sets a minimum current drain, the regulation of the circuit,
defined as percentage voltage change from minimum to maximum load, is improved.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 14
However in many cases the improvement is of insignificant magnitude.In some
designs, a series resistor at the load side of the capacitor is added. The smoothing can
then be improved by adding additional stages of capacitor–resistor pairs, often done
only for sub-supplies to critical high-gain circuits that tend to be sensitive to supply
voltage noise.
The idealized waveforms shown above are seen for both voltage and current
when the load on the bridge is resistive. When the load includes a smoothing
capacitor, both the voltage and the current waveforms will be greatly changed. While
the voltage is smoothed, as described above, current will flow through the bridge only
during the time when the input voltage is greater than the capacitor voltage. For
example, if the load draws an average current of n Amps, and the diodes conduct for
10% of the time, the average diode current during conduction must be 10n Amps.
This non-sinusoidal current leads to harmonic distortion and a poor power factor in
the AC supply.
In a practical circuit, when a capacitor is directly connected to the output of a
bridge, the bridge diodes must be sized to withstand the current surge that occurs
when the power is turned on at the peak of the AC voltage and the capacitor is fully
discharged. Sometimes a small series resistor is included before the capacitor to limit
this current, though in most applications the power supply transformer's resistance is
already sufficient.
4.1.4 Voltage Regulator
The 78xx (also sometimes known as LM78xx) series of devices is a family of
self-contained fixed linear voltage regulator integrated circuits. The 78xx family is a
very popular choice for many electronic circuits which require a regulated power
supply, due to their ease of use and relative cheapness.
When specifying individual ICs within this family, the xx is replaced with a
two-digit number, which indicates the output voltage the particular device is designed
to provide (for example, the 7805 has a 5 volt output, while the 7812 produces 12
volts). The 78xx line is positive voltage regulators, meaning that they are designed to
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 15
produce a voltage that is positive relative to a common ground. There is a related line
of 79xx devices which are complementary negative voltage regulators. 78xx and 79xx
ICs can be used in combination to provide both positive and negative supply voltages
in the same circuit, if necessary.
78xx ICs have three terminals and are most commonly found in the TO220
form factor, although smaller surface-mount and larger TrO3 packages are also
available from some manufacturers. These devices typically support an input voltage
which can be anywhere from a couple of volts over the intended output voltage, up to
a maximum of 35 or 40 volts, and can typically provide up to around 1 or 1.5 amps of
current (though smaller or larger packages may have a lower or higher current rating).
4. B) MICRO CONTROLLER:
Fig10: internal block diagram of power supply
4.2 MICROCONTROLLER
4.2.1 Microprocessors vs. Microcontrollers:
• Microprocessors are single-chip CPUs used in microcomputers.
• Microcontrollers and microprocessors are different in three main aspects: Hardware
architecture, applications, and instruction set features.
• Hardware architecture: A microprocessor is a single chip CPU while a
microcontroller is a single IC contains a CPU and much of remaining circuitry of a
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 16
complete computer (e.g., RAM, ROM, serial interface, parallel interface, timer, and
interrupt handling circuit).
• Applications: Microprocessors are commonly used as a CPU in computers while
microcontrollers are found in small, minimum component designs performing control
oriented activities.
• Microprocessor instruction sets are processing Intensive.
• Their instructions operate on nibbles, bytes, words, or even double words.
• Addressing modes provide access to large arrays of data using pointers and offsets.
• They have instructions to set and clear individual bits and perform bit operations.
• They have instructions for input/output operations, event timing, enabling and
setting priority levels for interrupts caused by external stimuli.
• Processing power of a microcontroller is much less than a microprocessor.
4.1.2 Difference between 8051 and 8052:
The 8052 microcontroller is the 8051's "big brother." It is a slightly more
powerful microcontroller, sporting a number of additional features which the
developer may make use of:
256 bytes of Internal RAM (compared to 128 in the standard 8051).
A third 16-bit timer, capable of a number of new operation modes and 16-bit
reloads.
Additional SFRs to support the functionality offered by the third timer.
4.1.2.1 Features:
• Compatible with MCS-51 Products
• 8K Bytes of In-System Programmable (ISP) Flash Memory
– Endurance: 1000 Write/Erase Cycles
• 4.0V to 5.5V Operating Range
• Fully Static Operation: 0 Hz to 33 MHz
• Three-level Program Memory Lock
• 256K Internal RAM
• 32 Programmable I/O Lines
• 3 16-bit Timer/Counters
• Eight Interrupt Sources
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 17
• Full Duplex UART Serial Channel.
4.1.3 Description Of Microcontroller 89S52
Fig11: pin configuration.
The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller
with 8Kbytes of in-system programmable flash memory. The device is manufactured
Using Atmel’s high-density nonvolatile memory technology and is compatible with
the industry-standard 80C51 micro controller. The on-chip Flash allows the program
memory to be reprogrammed in-system or by a conventional nonvolatile memory
programmer. By combining a versatile 8-bit CPU with in-system programmable flash
one monolithic http; the Atmel AT89S52 is a powerful micro controller, which
provides a highly flexible and cost effective solution to any cost effective solution to
any embedded control applications to any embedded control applications
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 18
Fig12: architecture of 8052
The AT89S52 provides the following standard features: 8K bytes of Flash,
256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit
timer/counters, full duplex serial port, on-chip oscillator, and clock circuitry.
In addition, the AT89S52 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 the RAM
contents but freezes the oscillator, disabling all other chip functions until the next
interrupt Or hardware reset.
4.1.3.1 Pin Description of microcontroller 89s52
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 19
VCC: Supply voltage.
GND:Ground.
Port 0: Port0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
high impedance inputs. Port 0 can also be configured to be the multiplexed low order
address/data bus during accesses to external program and data memory. In this mode,
P0 has internal pull-ups. Port 0 also receives the code bytes during Flash
Programming and outputs the code bytes during program verification. External pull-
ups are required during program verification
Port 1: Port1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1
Output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins,
they are pulled high by the internal pull-ups and can be used as inputs. In
addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count
input(P1.0/T2) and the timer/counter 2 trigger input P1.1/T2EX), respectively, as
shown in the following table. Port 1 also receives the low-order address bytes during
Flash programming and verification.
Port 2:Port2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2
output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins,
they are pulled high by the internal pull-ups and can be used as inputs. Port 2 emits
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 20
the high-order address byte during fetches from external program memory and during
accesses to external data memory that use 16-bit addresses (MOVX @DPTR). In this
application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to
external data memory that use 8-bit addresses (MOVX @ RI), Port 2emits 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: Port3 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 writ 1s are written to
Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As
inputs, Port 3 pins that are externally being pulled low will source current (IIL)
because of the pull-ups. Port 3 also serves the functions of various special features of
the AT89S52, as shown in the following table.
Port3 also receives some control signals for Flash programming
And verification.
RST: Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.
ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching the low
byte of the address during accesses 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 of1/6 the oscillator frequency and may be used for external timing or
clocking purposes. Note, however, that one ALE pulse is skipped during each access
to external data Memory. If desired, ALE operation can be disabled by setting bit 0 of
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 21
SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has
no effect if the micro controller is in external execution mode.
PSEN: Program Store Enable (PSEN) is the read strobe to external program memory.
When the AT89S52 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. A should be strapped to VCC for internal program executions. This pin
also receives the 12-voltProgramming enables voltage (VPP) during Flash
programming.
XTAL1: Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
XTAL2: Output from the inverting oscillator amplifier.
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 1.
Either a quartz crystal or ceramic resonator may be used. To drive the device from an
External clock source. XTAL2 should be left unconnected while XTAL1 is driven..
Figure 13:. Oscillator Connections
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 22
Special Function Register (SFR) Memory: -Special Function Registers (SFR s) are
areas of memory that control specific functionality of the 8051 processor. For
example, four SFRs permit access to the 8051’s 32 input/output lines. Another SFR
allows the user to set the serial baud rate, control and access timers, and configure the
8051’s interrupt system.
The Accumulator: The Accumulator, as its name suggests is used as a general
register to accumulate the results of a large number of instructions. It can hold 8-bit
(1-byte) value and is the most versatile register.
The “R” registers: The “R” registers are a set of eight registers that are named R0,
R1. Etc up to R7. These registers are used as auxiliary registers in many operations.
The “B” registers: The “B” register is very similar to the accumulator in the
sense that it may hold an 8-bit (1-byte) value. Two only uses the “B” register 8051
instructions: MUL AB and DIV AB.
The Data Pointer: The Data pointer (DPTR) is the 8051’s only user accessible 16-bit
(2Bytes) register. The accumulator, “R” registers are all 1-Byte values. DPTR, as the
name suggests, is used to point to data. It is used by a number of commands, which
allow the 8051 to access external memory.
The Program Counter And Stack Pointer: The program counter (PC) is a 2-byte
address, which tells the 8051 where the next instruction to execute is found in
memory. The stack pointer like all registers except DPTR and PC may hold an 8-bit
(1-Byte) value.
4.2.3.2 ADDRESSING MODES:
An “addressing mode” refers that you are addressing a given memory location.
In summary, the addressing modes are as follows, with an example of each:
Each of these addressing modes provides important flexibility.
Immediate Addressing MOV A, #20 H
Direct Addressing MOV A, 30 H
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 23
Indirect Addressing MOV A, @R0
Indexed Addressing
a. External Direct MOVX A, @DPTR
b. Code In direct MOVC A, @A+DPTR
Immediate Addressing:
Immediate addressing is so named because the value to be stored in memory
immediately follows the operation code in memory. That is to say, the instruction
itself dictates what value will be stored in memory. For example, the instruction:
MOV A, #20H
This instruction uses immediate Addressing because the accumulator will be
loaded with the value that immediately follows in this case 20(hexadecimal).
Immediate addressing is very fast since the value to be loaded is included in the
instruction. However, since the value to be loaded is fixed at compile-time it is not
very flexible.
Direct Addressing:
Direct addressing is so named because the value to be stored in memory is
obtained by directly retrieving it from another memory location. for example:
MOV A, 30h
This instruction will read the data out of internal RAM address 30(hexadecimal) and
store it in the Accumulator. Direct addressing is generally fast since, although the
value to be loaded isn’t included in the instruction, it is quickly accessible since it is
stored in the 8051’s internal RAM. It is also much more flexible than Immediate
Addressing since the value to be loaded is whatever is found at the given address
which may variable.Also it is important to note that when using direct addressing any
instruction that refers to an address between 00h and 7Fh is referring to the SFR
control registers that control the 8051 micro controller itself.
Indirect Addressing:
Indirect addressing is a very powerful addressing mode, which in many cases
provides an exceptional level of flexibility. Indirect addressing is also the only way to
access the extra 128 bytes of internal RAM found on the 8052. Indirect addressing
appears as follows:
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 24
MOV A, @R0:
Memory: Special Function Registers (SFRs) are areas of memory that control
specific functionality of the 8051 processor. For example, four SFRs permit access to
the 8051’s 32 input/output lines. Another SFR allows the user to set the serial baud
rate, control and access timers, and configure the 8051’s interrupt system.
Timer 2 Registers: Control and status bits are contained in registers T2CON
and T2MOD for Timer 2 . The register pair (RCAP2H , RCAP2L) are the
Capture / Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-
reload mode .
Interrupt Registers: The individual interrupt enable bits are in the IE registe .
Two priorities can be set for each of the six interrupt sources in the IP
register.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 25
Timer 2:
Timer 2 is a 16-bit Timer / Counter that can operate as either a timer or
an event counter. The type of operation is selected by bit C/T2 in the SFR
T2CON. Timer 2 has three operating Modes : capture , auto-reload ( up or down
Counting ) , and baud rate generator . The modes are selected by bits in T2CON.
Timer2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the
TL2 register is incremented every machine cycle. Since a machine cycle consists of
12 oscillator periods, the count rate is 1/12 of the oscillator frequency.
To ensure that a given level is sampled at least once before it changes, the
level should be held for at least one full machine cycle.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 26
4.2.4 Capture Mode:
In the capture mode, two options are selected by bit EXEN2 inT2CON. If EXEN2 =
0, Timer2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON
This bit can then be used to generate an interrupt. If EXEN2=1,Timer2 performs the
same operation, but a 1-to-0 transition at external input T2EX also causes the current
value in TH2 and TL2 to be captured into RCAP2H and RCAP2L,respectively
4.2.5 Baud Rate Generator:
Timer2 is selected as the baud rate generator by setting TCLK and/or RCLK
in T2CON. Note that the baud rates for transmit and receive can be different if
Timer2 is used for the receiver or transmitter and Timer1 is used for the other
function. The baud rates in Modes1 and 3 are determined by Timer2’s overflow rate
according to the following equation.
Modes1 and 3 Baud Rates=Timer 2 Overflow Rate
The timer operation is different for Timer 2 when it is used as a baud rate
generator Normally as a timer, it increments every machine cycle(at 1/12 the
oscillator frequency).As a baud rate generator, however it increments every state
time ( at 1/2 the oscillator frequency ) .
Timer 0:
Timer 0 functions as either a timer or event counter in four modes of
operation. Timer0 is controlled by the four lower bits of the TMOD register
and bits 0, 1, 4 and 5 of the TCON register. Mode0 (13-bit Timer) Mode0
configures timer0 as a 13-bit timer which is set up as an 8-bit timer (TH0 register)
with a modulo 32 pre-scalar implemented with the lower five bits of the TL0
register. The upper three bits of TL0 register are indeterminate and should be ignored.
Timer 1:
Timer1 is identical to timer0, except for mode3, which is a hold-count mode.
Mode 3 (Halt) Placing Timer1 in mode3 causes it to halt and hold its count. This can
be used to halt Timer1 when TR1 run control bit is not available i.e., when Timer0 is
in mode3.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 27
4.3 SENSORS
4.3.1 CO GAS SENSOR: (Carbon dioxide sensor)
A carbon dioxide sensor or CO2 sensor is an instrument for the measurement
of carbon dioxide gas. The most common principles for CO2 sensors are infrared gas
sensors (NDIR) and chemical gas sensors. Measuring carbon dioxide is important in
monitoring Indoor air quality and many industrial processes.
4.3.1.1 No dispersive Infrared (NDIR) CO2 Sensors
NDIR sensors are spectroscopic sensors to detect CO2 in a gaseous
environment by its characteristic absorption. The key components are an infrared
source, a light tube, an interference (wavelength) filter, and an infrared detector. The
gas is pumped or diffuses into the light tube, and the electronics measures the
absorption of the characteristic wavelength of light. NDIR sensors are most often used
for measuring carbon dioxide. The best of these have sensitivities of 20-50 PPM.
Typical NDIR sensors are still in the (US) $100 to $1000 range. New developments
include using Micro electromechanical systems to bring down the costs of this sensor
and to create smaller devices (for example for use in air conditioning applications).
4.3.1.2 Chemical CO2 Sensors
Chemical CO2 gas sensors with sensitive layers based on polymer- or
hetero poly siloxane have the principal advantage of very low energy consumption
and can be reduced in size to fit into microelectronic-based systems. On the
downside, short- and long term drift effects as well as a rather low overall lifetime
are major obstacles when compared with the NDIR measurement principle.
4.3.1.3 Applications
For air conditioning applications these kind of sensors can be used to
monitor the quality of air and the tailored need of fresh air, respectively.
In applications where direct temperature measurement is not applicable
NDIR sensors can be used. The sensors absorb ambient infrared radiation (IR) given
off by a heated surface.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 28
4.3.1.4 Carbon Dioxide CO2 Sensor
Excellent performance CO2 Sensor, for use in a wide range of applications,
including air quality monitoring, smoke alarms, mine and tunnel warning systems,
greenhouses, etc. The sensor is easy to use and can be easily incorporated in a small
portable unit.
4.3.1.5 Features
• High Sensitivity
• Detection Range: 0 - 10,000 ppm CO2
• Response Time: <60s
• Heater Voltage: 6.0V
• Dimensions: 16mm Diameter, 15mm High excluding pins, Pins - 6mm High
Fig 14: Carbon Dioxide Sensor
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 29
4.3.2 FIRE SENSOR
A fire alarm notification appliance with astrobe light.
An automatic fire alarm system is designed to detect the unwanted presence
of fire by monitoring environmental changes associated with combustion. In general,
a fire alarm system is either classified as automatically actuated, manually actuated, or
both. Automatic fire alarm systems can be used to notify people to evacuate in the
event of a fire or other emergency, to summon emergency services, and to prepare the
structure and associated systems to control the spread of fire and smoke.
Design
After the fire protection goals are established - usually by referencing the minimum
levels of protection mandated by the appropriate model building code, insurance
agencies, and other authorities - the fire alarm designer undertakes to detail specific
components, arrangements, and interfaces necessary to accomplish these goals.
Equipment specifically manufactured for these purposes are selected and standardized
installation methods are anticipated during the design. In the United
States, NFPA 72, The National Fire Alarm Code is an established and widely used
installation standard.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 30
Fundamental configuration
A Honeywell fire alarm control panel.
Fire alarm control panel: This component, the hub of the system, monitors inputs
and system integrity, controls outputs and relays information.
Primary Power supply: Commonly the non-switched 120 or 240 Volt Alternating
Current source supplied from a commercial power utility. In non-residential
applications, a branch circuit is dedicated to the fire alarm system and its
constituents. "Dedicated branch circuits" should not be confused with "Individual
branch circuits" which supply energy to a single appliance.
Secondary (backup) Power supplies: This component, commonly consisting of
sealed lead-acid storage batteries or other emergency sources including
generators, is used to supply energy in the event of a primary power failure.
Initiating Devices: This component acts as an input to the fire alarm control unit
and are either manually or automatically actuated.
Notification appliances: This component uses energy supplied from the fire alarm
system or other stored energy source, to inform the proximate persons of the need
to take action, usually to evacuate.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 31
4.3.3 TEMPERATURE SENSOR (LM35):
In this project, in order to obtain the fan speed based on temperature, initially
this temperature value has to be read and fed to the microcontroller. This temperature
value has to be sensed. Thus a sensor has to be used and the sensor used in this project
is LM35. It converts temperature value into electrical signals.
LM35 series sensors are precision integrated-circuit temperature sensors
whose output voltage is linearly proportional to the Celsius temperature. The LM35
requires no external calibration since it is internally calibrated. . The LM35 does not
require any external calibration or trimming to provide typical accuracies of ±1⁄4°C at
room temperature and ±3⁄4°C over a full −55 to +150°C temperature range.
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.
4.3.3.1 Features
Calibrated directly in ° Celsius (Centigrade)
Linear + 10.0 mV/°C scale factor
0.5°C accuracy guaranteed (at +25°C)
Rated for full −55° to +150°C range
Suitable for remote applications
Fig15: temperature sensor
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 32
4.3.3.2 The characteristic of this LM35 sensor is:
For each degree of centigrade temperature it outputs 10milli volts.ADC accepts the
output from LM35 and converts that data into digital form which is sent to
microcontroller for further processing.
Fig17:lm35
4.4 VOICE CHIP:
Messages: voice, music and sounds are available
Function: message pre-recorded (optional)
Voice or music pre-recorded duration: 4 to 340 seconds for recording function
Components of module: PCB, OTP voice IC, a speaker, batteries and a sliding Activator
OTP voice IC: one time programmable MCU, Suitable for the quantity under 5000pcs, needn't pay the mask charge.
Activation type: Slider (Open the card to generate the sound)
Sound files type:mp3,wmv etc.PCB-Size: 3CM*2.6CM
Speaker-Size: 40mm Diameter
Batteries:1 x CR2032
Suitable for greeting card, sound , book, music, bag and so on
OEM and ODM orders are welcome
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 33
QuikVoice Digital Sound Chips
The Quick Voice chips are state-of-the-art digital sound chips. They can
record and/or play sound segments all by themselves without the help from a
microprocessor. Unlike other sound chips which store a very limited amount of
sounds in their internal memory, the Quick Voice chips store sounds in external
memory chips with virtually no limitation. Therefore, the Quick Voice chips do not
require the kind of setup charge and long lead time.
The Quick Voice chips employs the Continuously Variable Slope Delta
(CVSD) compression technique with variable sampling rates from 24 to 128 Kbps.
Sampling clock can be generated internally with a simple R/C network, or an external
clock can be used.
For EPROM based (playback only) designs, VP 880 Quick Voice
Development System must be used for sound development. VP880 is a computer
based sound digitization, editing and management system. After the sound is
developed, it is programmed into EPROM chips with a standard EPROM
programmer. Eletech also provides sound development and programming service to
customers who do not want to do it themselves.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 34
4.4.1 Features
* Voice grade audio record and/or playback
* Stand alone operation
* CVSD compression with variable sampling rates
* Use external EPROM or SRAM for sound data storage
* Single or multiple sound segments capability
* Single or dual channel outputS
4.4.2 Applications
* Exbhits, displays and attractions
* Message repeaters
* Gaming, vending and amusement equipment and Industrial controls
* Security alarm
4.4.3 Selection guide
Part Number VP1000A VP1410A VP1606 VP1608F
Output Channel 1 1 1 2
Operation Mode record & play play Play play
Trigger Method Direct direct Binary binary
Max. Number of
Sound Segments1 10 64 128
Memory Type SRAM/EPROM EPROM EPROM EPROM
Supply Voltage 5 VDC 5 VDC 5 VDC 5 VDC
Low Power Yes yes Yes yes
Package PDIP40, QFP48PDIP48,
QFP48PDIP48 QFP64
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 35
4.5 Speaker
An inexpensive, low fidelity 3½-inch speaker, typically found in small radios.
A loudspeaker (or "speaker") is an electro acoustic transducer that converts
an electrical signal into sound. The speaker moves in accordance with the variations
of an electrical signal and causes sound waves to propagate through a medium such as
air or water.
Loudspeakers (and other electro acoustic transducers) are the most variable
elements in a modern audio system and are usually responsible for most distortion and
audible differences when comparing sound systems.
4.5.1 Terminology
The term "loudspeaker" may refer to individual transducers (known as
"drivers") or to complete speaker systems consisting of an enclosure including one or
more drivers. To adequately reproduce a wide range of frequencies, most loudspeaker
systems employ more than one driver, particularly for higher sound pressure level or
maximum accuracy. Individual drivers are used to reproduce different frequency
ranges. The terms for different speaker drivers differ, depending on the application. In
two-way systems there is no mid-range driver, so the task of reproducing the mid-
range sounds falls upon the woofer and tweeter. Home stereos use the designation
"tweeter" for the high frequency driver, while professional concert systems may
designate them as "HF" or "highs".
4.5.1.2 Driver design
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 36
Cutaway view of a dynamic loudspeaker.
The most common type of driver uses a lightweight diaphragm, or cone,
connected to a rigid basket, or frame, via a flexible suspension that constrains a coil of
fine wire to move axially through a cylindrical magnetic gap.
When an electrical signal is applied to the voice coil, a magnetic field is
created by the electric current in the voice coil, making it an variable electromagnet.
The coil and the driver's magnetic system interact, generating a mechanical force that
causes the coil (and thus, the attached cone) to move back and forth, thereby
reproducing sound under the control of the applied electrical signal coming from the
amplifier. The following is a description of the individual components of this type of
loudspeaker.
The diaphragm is usually manufactured with a cone- or dome-shaped profile.
A variety of different materials may be used, but the most common are paper, plastic,
and metal. The ideal material would be stiff, to prevent uncontrolled cone motions;
light, to minimize starting force requirements and energy storage issues; and well
damped, to reduce vibrations continuing after the signal has stopped. In practice, all
three of these criteria cannot be met simultaneously using existing materials; thus,
driver design involves trade-offs.
The chassis, frame, or basket, is designed to be rigid, avoiding deformation
which would change critical alignments with the magnet gap, perhaps causing the
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 37
voice coil to rub against the sides of the gap. Chassis are typically cast from
aluminum alloy, or stamped from thin steel sheet, although molded plastic baskets are
becoming common, especially for inexpensive, low-mass drivers. Metallic chassis can
play an important role in conducting heat away from the voice coil; heating during
operation changes resistance, causing physical dimensional changes, and if extreme,
may even de-magnatize permanent magnets.
The suspension system keeps the coil centered in the gap and provides a
restoring (centering) force that returns the cone to a neutral position after moving. A
typical suspension system consists of two parts: the "spider", which connects the
diaphragm or voice coil to the frame and provides the majority of the restoring force,
and the "surround", which helps center the coil/cone assembly and allows free
pistonic motion aligned with the magnetic gap. The spider is usually made of a
corrugated fabric disk, impregnated with a stiffening resin. The name comes from the
shape of early suspensions, which were two concentric rings of Bakelite material,
joined by six or eight curved "legs". Variations of this topology included the addition
of a felt disc to provide a barrier to particles that might otherwise cause the voice coil
to rub. The German firm Rulik still offers drivers with uncommon spiders made of
wood.
4.5.2 Loudspeaker system design
4.5.2.1 Crossover
A passive crossover., Bi-amped.
Used in multi-driver speaker systems, the crossover is a subsystem that
separates the input signal into different frequency ranges suited to each driver. The
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 38
drivers receive only the power in their usable frequency range (the range they were
designed for), thereby reducing distortion in the drivers and interference between
them.
Crossovers can be passive or active. A passive crossover is an electronic
circuit that uses a combination of one or more resistors, inductors, or non-polar
capacitors. These parts are formed into carefully designed networks and are most
often placed between the power amplifier and the loudspeaker drivers to divide the
amplifier's signal into the necessary frequency bands before being delivered to the
individual drivers. Passive crossover circuits need no external power beyond the audio
signal itself, but do cause overall signal loss and a significant reduction in damping
factor between the voice coil and the crossover. An active crossover is an electronic
filter circuit that divides the signal into individual frequency bands before power
amplification, thus requiring at least one power amplifier for each band pass. Passive
filtering may also be used in this way before power amplification, but it is an
uncommon solution, due to inflexibility compared to active filtering. Any technique
that uses crossover filtering followed by amplification is commonly known as bi-
amping, tri-amping, quad-amping, and so on, depending on the minimum number of
amplifier channels.
Passive crossovers are commonly installed inside speaker boxes and are by far
the most usual type of crossover for home and low-power use. In car audio systems,
passive crossovers may be in a separate box, necessary to accommodate the size of
the components used. Passive crossovers may be simple for low-order filtering, or
complex to allow steep slopes such as 18 or 24 dB per octave. Passive crossovers can
also be designed to compensate for undesired characteristics of driver, horn, or
enclosure resonances, and can be tricky to implement, due to component interaction.
Passive crossovers, like the driver units that they feed, have power handling limits,
have insertion losses (10% is often claimed), and change the load seen by the
amplifier. The changes are matters of concern for many in the hi-fi world. When high
output levels are required, active crossovers may be preferable.
4.5.2.2 Specifications
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 39
Specifications label on a loudspeaker.
Speaker specifications generally include:
Speaker or driver type (individual units only) – Full-range, woofer, tweeter,
or mid-range.
Size of individual drivers. For cone drivers, the quoted size is generally the
outside diameter of the basket. However, it may less commonly also be the
diameter of the cone surround, measured apex to apex, or the distance from
the center of one mounting hole to its opposite. Voice-coil diameter may also
be specified. If the loudspeaker has a compression horn driver, the diameter of
the horn throat may be given.
Rated Power – Nominal (or even continuous) power, and peak (or maximum
short-term) power a loudspeaker can handle (i.e., maximum input power
before destroying the loudspeaker; it is never the sound output the loudspeaker
produces). A driver may be damaged at much less than its rated power if
driven past its mechanical limits at lower frequencies. Tweeters can also be
damaged by amplifier clipping (amplifier circuits produce large amounts of
energy at high frequencies in such cases) or by music or sine wave input at
high frequencies. Each of these situations passes more energy to a tweeter than
it can survive without damage.
Impedance – typically 4 Ω (ohms), 8 Ω, etc.
Baffle or enclosure type (enclosed systems only) – Sealed, bass reflex, etc.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 40
Crossover frequency(ies) (multi-driver systems only) – The nominal
frequency boundaries of the division between drivers.
Frequency response – The measured, or specified, output over a specified
range of frequencies for a constant input level varied across those frequencies.
It sometimes includes a variance limit, such as within "± 2.5 dB".
Sensitivity – The sound pressure level produced by a loudspeaker in a non-
reverberant environment, often specified in dB and measured at 1 meter with
an input of 1 watt (2.83 rms volts into 8 Ω), typically at one or more specified
frequencies. This rating is often specified by manufacturers to be impressive.
Maximum SPL – The highest output the loudspeaker can manage, short of
damage or not exceeding a particular distortion level. This rating is often
specified by manufacturers to be impressive, and is commonly given without
reference to frequency range or distortion level.
4.5.2.3 Electrical characteristics of a dynamic loudspeaker
The load a driver presents to an amplifier consists of a complex electrical
impedance—a combination of resistance and both capacitive and inductive reactance,
which combines properties of the driver, its mechanical motion, the effects of
crossover components (if any are in the signal path between amplifier and driver), and
the effects of air loading on the driver as modified by the enclosure and its
environment. Most amplifiers' output specifications are given at a specific power into
an ideal resistive load; however, a loudspeaker does not have a constant resistance
across its frequency range
To make sound, a loudspeaker is driven by modulated electrical current
(produced by an amplifier) that pass through a "speaker coil" (a coil of copper wire),
which then (through resistance and other forces) magnetizes the coil, creating a
magnetic field. The electrical current variations that pass through the speaker are thus
converted to varying magnetic forces, which move the speaker diaphragm, which thus
forces the driver to produce air motion that is similar to the original signal from the
amplifier.
4.5.2.4 Electromechanical measurements
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 41
Fully characterizing the sound output quality of a loudspeaker driver or system
in words is essentially impossible. Objective measurements provide information about
several aspects of performance so that informed comparisons and improvements can
be made, but no combination of measurements summarizes the performance of a
loudspeaker system in use, if only because the test signals used are neither music nor
speech.. Examples of typical measurements are: amplitude and phase characteristics
vs. frequency; impulse response under one or more conditions (e.g., square waves,
sine wave bursts, etc.); directivity vs. frequency (e.g., horizontally, vertically,
spherically, etc.); harmonic and intermodulation distortion vs. SPL output, using any
of several test signals; stored energy (i.e., ringing) at various frequencies; impedance
vs. frequency; and small-signal vs. large-signal performance. Most of these
measurements require sophisticated and often expensive equipment to perform, and
also good judgment by the operator, but the raw sound pressure level output is rather
easier to report and so is often the only specified value—sometimes in misleadingly
exact terms. The sound pressure level (SPL) a loudspeaker produces is measured in
decibels (dBspl).
4.6 MAX232:
RS232 is a asynchronous serial communication protocol widely used in
computers and digital systems. It is called asynchronous because there is no separate
synchronizing clock signal as there are in other serial protocols like SPI and I2C. The
protocol is such that it automatically synchronize itself. We can use RS232 to easily
create a data link between our MCU based projects and standard PC.
You can make a data loggers that reads analog value(such as temperatures or
light using proper sensors) using the ADC and send them to PC where a special
program written by you shows the data using nice graphs and charts etc.. actually your
imagination is the limit!
4.6.1 Basics of Serial Communication:
In serial communication the whole data unit, say a byte is transmitted one bit
at a time. While in parallel transmission the whole data unit, say a byte (8bits) are
transmitted at once. Obviously serial transmission requires a single wire while parallel
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 42
transfer requires as many wires as there are in our data unit. So parallel transfer is
used to transfer data within short range (e.g. inside the computer between graphic card
and CPU) while serial transfer is preferable in long range.
As in serial transmission only one wire is used for data transfer. Its logic level
changes according to bit being transmitted (0 or 1). But a serial communication need
some way of synchronization. If you don't understand what I mean by
"synchronization" then don't worry just read on it will become clear.
The animation below shows you how a serial transmission would look like (if
you can see electricity).
Fig- A Serial Line.(HIGH=RED & LOW=WHITE)
Can you make out what data is coming? No because you are not synchronized.
You need a way to know when a new byte start and when a bit ends and new bit start.
Suppose the line is low for some time that means a '0' but how many zeros? If we
send data like 00001111 then line is first low for some time and high after that. Then
how we know it is four '0's and four '1's?
Now if we add another line called the clock line to synchronize you then it
will become very easy. You need to note down the value of data line only when you
see the "clock line" high. Lets understand this with help of an animation.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 43
Fig- A Serial Line.(HIGH=RED & LOW=WHITE)
Now you can see how the "clock" line helps you in "synchronizing" the
incoming data. In this way many serial busses like SPI and I2C works. But USART is
different in USART there is no clock line. So it is called UART -
Universal Asynchronous Receiver Transmitter. In USART a start bit and stop bits are
used to synchronize the incoming data.
4.6.2 RS232
In RS232 there are two data lines RX and TX. TX is the wire in which data is
sent out to other device. RX is the line in which other device put the data it need to
sent to the device.
Fig- RS232 transmission.
The arrows indicates the direction of data transfer. In addition to RX/TX lines there is
a third line i.e. Ground (GND) or Common.
One more thing about RS232. We know that a HIGH =+5v and LOW=0v in
TTL / MCU circuits but in RS232 a HIGH=-12V and LOW=+12V. Ya this is bit
weird but it increases the range and reliability of data transfer. Now you must be
wondering how to interface this to MCUs who understand only 0 and 5v? But you
will be very happy to know that there is a very popular IC which can do this for you!
It is MAX232 from Maxim Semiconductors. I will show you how to make a level
converter using MAX232 in next tutorial.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 44
As there is no "clock" line so for synchronization accurate timing is required so
transmissions are carried out with certain standard speeds. The speeds are measured
in bits per second. Number of bits transmitted is also known as baud rate. Some
standard baud rates are
1200
2400
4800
9600
19200
38400
57600
115200
... etc
For our example for discussion of protocol we chose the speed as 9600bps(bits
per second). As we are sending 9600 bits per second one bits takes 1/9600 seconds or
0.000104 sec or 104 uS (microsecond= 10^-6 sec).
To transmit a single byte we need to extra bits they are START BIT AND
STOP BIT(more about them latter). Thus to send a byte a total of ten bits are
required so we are sending 960 bytes per second.
Note: The number of stop bits can be one or two (for simplicity we will be using
single stop bit)
There is one more bit the parity bit but again for simplicity we would not be using it)
4.6.2.1 RS232 Data Transmission.
The data transfer is done in following ways
4.6.2.1.1 Transmission
1. When there is no transmission the TX line sits HIGH (-12V See above para) ( STOP
CONDITION )
2. HIGH=-12V and LOW=+12V
3. When the device needs to send data it pulls the TX line low for 104uS (This is the
start bit which is always 0)
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 45
4. Then it send each bits with duration = 104uS
5. Finally it sets TX lines to HIGH for at least 104uS (This is stop bits and is always 1). I
said "at least" because after you send the stop bit you can either start new
transmission by sending a start bit or you let the TX line remain HIGH till next
transmission begin in this case the last bit is more than 104uS.
Fig- Data Transmission on RS232 line.
4.6.2.1.2 Reception
1. The receiving device is waiting for the start bit i.e. the RX line to go LOW (+12V see
above para).
2. When it gets start bit it waits for half bit time i.e. 104/2 = 51uS now it is in middle of
start bit it reads it again to make sure it is a valid start bit not a spike.
3. Then it waits for 104uS and now it is in middle of first bit it now reads the value of
RX line.
4. In same way it reads all 8 bits.
5. Now the receiver has the data.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 46
Fig- How the Receiver receives the data on RS232 RX l
The MAX232 is an integrated circuit that converts signals from an RS-232
serial port to signals suitable for use in TTL compatible digital logic circuits. The
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 47
MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS
signals.
The later MAX232A is backwards compatible with the original MAX232 but may
operate at higher baud rates and can use smaller external capacitors – 0.1 μf in place
of the 1.0 μf capacitors used with the original device.The newer MAX3232 is also
backwards compatible, but operates at a broader voltage range, from 3 to 5.5V.
4.6.2.2 Voltage levels
It is helpful to understand what occurs to the voltage levels. When a MAX232
IC receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and
+15V, and changes TTL Logic 1 to between -3 to -15V, and vice versa for converting
from RS232 to TTL. This can be confusing when you realize that the RS232 Data
Transmission voltages at a certain logic state are opposite from the RS232 Control
Line voltages at the same logic state.
RS232 Line Type & Logic LevelRS232
Voltage
TTL Voltage to/from
MAX232
Data Transmission (Rx/Tx) Logic 0 +3V to +15V 0V
Data Transmission (Rx/Tx) Logic 1 -3V to -15V 5V
Control Signals (RTS/CTS/DTR/DSR) Logic
0-3V to -15V 5V
Control Signals (RTS/CTS/DTR/DSR) Logic
1+3V to +15V 0V
4.7 RS-232
In telecommunications, RS-232 (Recommended Standard 232) is a standard for
serial binary single-ended data and control signals connecting between a DTE (Data
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 48
Terminal Equipment) and a DCE (Data Circuit-terminating Equipment). It is
commonly used in computer serial ports. A similar ITU-T standard is V.24.
4.7.1 Scope of the standard
The Electronics Industries Association (EIA) standard RS-232-Cas of 1969 defines:
Electrical signal characteristics such as voltage levels, signaling rate, timing
and slew-rate of signals, voltage withstand level, short-circuit behavior, and
maximum load capacitance.
Interface mechanical characteristics, pluggable connectors and pin
identification.
Standard subsets of interface circuits for selected telecom applications.
The standard does not define such elements as
character encoding (for example, ASCII, Baudot code or EBCDIC)
the framing of characters in the data stream (bits per character, start/stop bits,
parity)
protocols for error detection or algorithms for data compression
bit rates for transmission, although the standard says it is intended for bit rates
lower than 20,000 bits per second. Many modern devices support speeds of
115,200 bit/s and above
Details of character format and transmission bit rate are controlled by the serial
port hardware, often a single integrated circuit called a UART that converts data from
parallel to asynchronous start-stop serial form. Details of voltage levels, slew rate, and
short-circuit behavior are typically controlled by a line-driver that converts from the
UART's logic levels to RS-232 compatible signal levels, and a receiver that converts
from RS-232 compatible signal levels to the UART's logic levels.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 49
4.7.2 Limitations of the standard
Because the application of RS-232 has extended far beyond the original purpose
of interconnecting a terminal with a modem, successor standards have been developed
to address the limitations. Issues with the RS-232 standard include:[4]
The large voltage swings and requirement for positive and negative supplies
increases power consumption of the interface and complicates power supply
design. The voltage swing requirement also limits the upper speed of a
compatible interface.
Multi-drop connection among more than two devices is not defined. While
multi-drop "work-arounds" have been devised, they have limitations in speed
and compatibility.
Asymmetrical definitions of the two ends of the link make the assignment of
the role of a newly developed device problematic; the designer must decide on
either a DTE-like or DCE-like interface and which connector pin assignments
to use.
The handshaking and control lines of the interface are intended for the setup
and takedown of a dial-up communication circuit; in particular, the use of
handshake lines for flow control is not reliably implemented in many devices.
No method is specified for sending power to a device. While a small amount
of current can be extracted from the DTR and RTS lines, this is only suitable
for low power devices such as mice.
The 25-way connector recommended in the standard is large compared to
current practice.
4.7.3 Standard details
In RS-232, user data is sent as a time-series of bits. Both synchronous and
asynchronous transmissions are supported by the standard. In addition to the data
circuits, the standard defines a number of control circuits used to manage the
connection between the DTE and DCE. Each data or control circuit only operates in
one direction, that is, signaling from a DTE to the attached DCE or the reverse.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 50
Since transmit data and receive data are separate circuits, the interface can
operate in a full duplex manner, supporting concurrent data flow in both directions.
The standard does not define character framing within the data stream, or character
encoding.
4.7.4 Connectors
RS-232 devices may be classified as Data Terminal Equipment (DTE) or Data
Circuit-terminating Equipment (DCE); this defines at each device which wires will be
sending and receiving each signal. The standard recommended but did not make
mandatory the D-subminiature 25 pin connector. In general and according to the
standard, terminals and computers have male connectors with DTE pin functions, and
modems have female connectors with DCE pin functions. Other devices may have
any combination of connector gender and pin definitions.
The standard specifies 20 different signal connections. Since most devices use
only a few signals, smaller connectors can often be used. For example, the 9 pin DE-9
connector was used by most IBM-compatible PCs since the IBM PC AT, and has
been standardized as TIA-574. More recently, modular connectors have been used.
Most common are 8P8C connectors. Standard EIA/TIA 561 specifies a pin
assignment, but the "Yost Serial Device Wiring Standard" invented by Dave Yost
(and popularized by the Unix System Administration Handbook) is common on Unix
computers and newer devices from Cisco Systems. Many devices don't use either of
these standards. 10P10C connectors can be found on some devices as well.
Digital Equipment Corporation defined their own DEC connect connection
system which was based on the Modified Modular Jack (MMJ) connector. This is a 6
pin modular jack where the key is offset from the center position. As with the Yost
standard, DEC connect uses a symmetrical pin layout which enables the direct
connection between two DTEs. Another common connector is the DH10 header
connector common on motherboards and add-in cards which is usually converted via
a cable to the more standard 9 pin DE-9 connector (and frequently mounted on a free
slot plate or other part of the housing).
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 51
4.7.5 Pinouts
The following table lists commonly-used RS-232 signals and pin assignments.
Signal Origin DB-
25
pin
DE-
9
pin
TIA-
561
pin
Yost
pin
DEC
MMJNameTypical
purposeAbbreviation DTE DCE
Data
Terminal
Ready
OOB control
signal: Tells
DCE that DTE is
ready to be
connected.
DTR ● 20 4 3 2 1
Data Carrier
Detect
OOB control
signal: Tells
DTE that DCE is
connected to
telephone line.
DCD ● 8 1 2
7 6
Data Set
Ready
OOB control
signal: Tells
DTE that DCE is
ready to receive
commands or
data.
DSR ● 6 6
1
Ring
Indicator
OOB control
signal: Tells
DTE that DCE
has detected a
ring signal on
the telephone
line.
RI ● 22 9 - -
Request To
Send
OOB control
signal: Tells
DCE to prepare
RTS ● 4 7 8 1 -
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 52
to accept data
from DTE.
Clear To
Send
OOB control
signal:
Acknowledges
RTS and allows
DTE to transmit.
CTS ● 5 8 7 8 -
Transmitted
Data
Data signal:
Carries data
from DTE to
DCE.
TxD ● 2 3 6 3 2
Received
Data
Data signal:
Carries data
from DCE to
DTE.
RxD ● 3 2 5 6 5
Common
GroundGND common 7 5 4 4, 5 3, 4
Protective
GroundPG common 1 - - - -
The signals are named from the standpoint of the DTE. The ground signal is a
common return for the other connections; it appears on two pins in the Yost standard
but is the same signal. The DB-25 connector includes a second "protective ground" on
pin 1. Connecting this to pin 7 (signal reference ground) is a common practice but not
essential.
Note that EIA/TIA 561 combines DSR and RI, and the Yost standard
combines DSR and DCD.
4.7.6 Conventions
For functional communication through a serial port interface, conventions of bit rate,
character framing, communications protocol, character encoding, data compression,
and error detection, not defined in RS 232, must be agreed to by both sending and
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 53
receiving equipment. For example, consider the serial ports of the original IBM PC.
This implementation used an 8250 UART using asynchronous start-stop character
formatting with 7 or 8 data bits per frame, usually ASCII character coding, and data
rates programmable between 75 bits per second and 115,200 bits per second. Data
rates above 20,000 bits per second are out of the scope of the standard, although
higher data rates are sometimes used by commercially manufactured equipment.
In the particular case of the IBM PC, baud rates were programmable with
arbitrary values, so that a PC could be connected to, for example, MIDI music
controllers (31,250 bits per second) or other devices not using the rates typically used
with modems. Since most devices do not have automatic baud rate detection, users
must manually set the baud rate (and all other parameters) at both ends of the RS-232
connection.
4.7.7 RTS/CTS handshaking
In older versions of the specification, RS-232's use of the RTS and CTS lines is
asymmetric: The DTE asserts RTS to indicate a desire to transmit to the DCE, and the
DCE asserts CTS in response to grant permission. This allows for half-duplex
modems that disable their transmitters when not required, and must transmit a
synchronization preamble to the receiver when they are re-enabled. This scheme is
also employed on present-day RS-232 to RS-485 converters, where the RS-232's RTS
signal is used to ask the converter to take control of the RS-485 bus - a concept that
doesn't otherwise exist in RS-232. There is no way for the DTE to indicate that it is
unable to accept data from the DCE.
A non-standard symmetric alternative, commonly called "RTS/CTS
handshaking," was developed by various equipment manufacturers: CTS indicates
permission from the DCE for the DTE to send data to the DCE (and is controlled by
the DCE independent of RTS), and RTS indicates permission from the DTE for the
DCE to send data to the DTE. This was eventually codified in version RS-232-E
(actually TIA-232-E by that time) by defining a new signal, "RTR (Ready to
Receive)," which is CCITT V.24 circuit 133. TIA-232-E and the corresponding
international standards were updated to show that circuit 133, when implemented,
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 54
shares the same pin as RTS (Request to Send), and that when 133 is in use, RTS is
assumed by the DCE to be ON at all times.
Thus, with this alternative usage, one can think of RTS asserted (positive
voltage, logic 0) meaning that the DTE is indicating it is "ready to receive" from the
DCE, rather than requesting permission from the DCE to send characters to the DCE.
Note that equipment using this protocol must be prepared to buffer some extra
data, since a transmission may have begun just before the control line state change.
4.7.8 3-wire and 5-wire RS-232
A minimal "3-wire" RS-232 connection consisting only of transmit data, receive data,
and ground, is commonly used when the full facilities of RS-232 are not required.
Even a two-wire connection (data and ground) can be used if the data flow is one way
(for example, a digital postal scale that periodically sends a weight reading, or a GPS
receiver that periodically sends position, if no configuration via RS-232 is necessary).
When only hardware flow control is required in addition to two-way data, the RTS
and CTS lines are added in a 5-wire version.
4.7.9 Seldom used features
The EIA-232 standard specifies connections for several features that are not used in
most implementations. Their use requires the 25-pin connectors and cables, and of
course both the DTE and DCE must support them.
4.7.10 Signal rate selection
The DTE or DCE can specify use of a "high" or "low" signaling rate. The rates as
well as which device will select the rate must be configured in both the DTE and
DCE. The prearranged device selects the high rate by setting pin 23 to ON.
4.7.11 Loopback testing
Many DCE devices have a loopback capability used for testing. When
enabled, signals are echoed back to the sender rather than being sent on to the
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 55
receiver. If supported, the DTE can signal the local DCE (the one it is connected to) to
enter loopback mode by setting pin 18 to ON, or the remote DCE (the one the local
DCE is connected to) to enter loopback mode by setting pin 21 to ON. The latter tests
the communications link as well as both DCE's. Some synchronous devices provide a
clock signal to synchronize data transmission, especially at higher data rates. Two
timing signals are provided by the DCE on pins 15 and 17. Pin 15 is the transmitter
clock, or send timing (ST); the DTE puts the next bit on the data line (pin 2) when this
clock transitions from OFF to ON (so it is stable during the ON to OFF transition
when the DCE registers the bit). Pin 17 is the receiver clock, or receive timing (RT);
the DTE reads the next bit from the data line (pin 3) when this clock transitions from
ON to OFF.
Signal Pin
Common Ground 7 (same as primary)
Secondary Transmitted Data (STD) 14
Secondary Received Data (SRD) 16
Secondary Request To Send (SRTS) 19
Secondary Clear To Send (SCTS) 13
Secondary Carrier Detect (SDCD) 12
5 ZIG BEE TRANSICIVER:
ZigBee is a specification for a suite of high level communication protocols using
small, low-power digital radios based on the IEEE 802.15.4-2003 standard forwireless
personal area networks (WPANs), such as wireless headphones connecting with cell
phones via short-range radio. The technology defined by theZigBee specification is
intended to be simpler and less expensive than other WPANs, such as Bluetooth.
ZigBee is targeted at radio-frequency (RF) applications that require a low data rate,
long battery life, and secure networking.The ZigBee Alliance is a group of companies
that maintain and publish the ZigBee standard.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 56
5.1 Overview
ZigBee is a low-cost, low-power, wireless mesh networking proprietary
standard. The low cost allows the technology to be widely deployed in wireless
control and monitoring applications, the low power-usage allows longer life with
smaller batteries, and the mesh networking provides high reliability and larger range.
The ZigBee Alliance, the standards body that defines ZigBee, also publishes
application profiles that allow multiple OEM vendors to create interoperable products.
The current list of application profiles either published or in the works are:
Home Automation
ZigBee Smart Energy 1.0/2.0
Commercial Building Automation
Telecommunication Applications
The relationship between IEEE 802.15.4 and ZigBee is similar to that
between IEEE 802.11 and the Wi-Fi Alliance. The ZigBee 1.0 specification was
ratified on 14 December 2004 and is available to members of the ZigBee Alliance.
Most recently, the ZigBee 2007 specification was posted on 30 October 2007. The
first ZigBee Application Profile, Home Automation, was announced 2 November
2007. As amended by NIST, the Smart Energy Profile 2.0 specification will remove
the dependency on IEEE 802.15.4.
Device manufacturers will be able to implement any MAC/PHY, such as IEEE
802.15.4(x) and IEEE P1901, under an IP layer based on 6LowPAN.
ZigBee operates in the industrial, scientific and medical (ISM) radio bands;
868 MHz in Europe, 915 MHz in the USA and Australia, and 2.4 GHz in most
jurisdictions worldwide. The technology is intended to be simpler and less expensive
than other WPANs such as Bluetooth. ZigBee chip vendors typically sell integrated
radios and microcontrollers with between 60K and 128K flash memory, such as
the Jennic JN5148, the Free scale MC13213, the Ember EM250, the Texas
Instruments CC2430, the Samsung Electro-Mechanics ZBS240 and
the Atmel ATmega128RFA1.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 57
Because ZigBee can activate (go from sleep to active mode) in 15 msec or
less, the latency can be very low and devices can be very responsive — particularly
compared to Bluetooth wake-up delays, which are typically around three seconds.
Because ZigBees can sleep most of the time, average power consumption can be very
low, resulting in long battery life.
The first stack release is now called ZigBee 2004. The second stack release is
called ZigBee 2006, and mainly replaces the MSG/KVP structure used in 2004 with a
"cluster library". The 2004 stack is now more or less obsolete.ZigBee 2007, now the
current stack release, contains two stack profiles, stack profile 1 (simply called
ZigBee), for home and light commercial use, and stack profile 2 (called ZigBee Pro).
ZigBee Pro offers more features, such as multi-casting, many-to-one routing and high
security with Symmetric-Key Key Exchange (SKKE), while ZigBee (stack profile 1)
offers a smaller footprint in RAM and flash. Both offer full mesh networking and
work with all ZigBee application profiles.
ZigBee 2007 is fully backward compatible with ZigBee 2006 devices: A
ZigBee 2007 device may join and operate on a ZigBee 2006 network and vice versa.
Due to differences in routing options, ZigBee Pro devices must become non-routing
ZigBee End-Devices (ZEDs) on a ZigBee 2006 or ZigBee 2007 network, the same as
ZigBee 2006 or ZigBee 2007 devices must become ZEDs on a ZigBee Pro network.
The applications running on those devices work the same, regardless of the stack
profile beneath them.
5.2 Device types
There are three different types of ZigBee devices:
ZigBee coordinator (ZC): The most capable device, the coordinator forms the root
of the network tree and might bridge to other networks. There is exactly one
ZigBee coordinator in each network since it is the device that started the network
originally. It is able to store information about the network, including acting as the
Trust Centre & repository for security keys.
ZigBee Router (ZR): As well as running an application function, a router can act
as an intermediate router, passing on data from other devices.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 58
ZigBee End Device (ZED): Contains just enough functionality to talk to the parent
node (either the coordinator or a router); it cannot relay data from other devices.
This relationship allows the node to be asleep a significant amount of the time
thereby giving long battery life. A ZED requires the least amount of memory, and
therefore can be less expensive to manufacture than a ZR or ZC.
5.3 Protocols
The protocols build on recent algorithmic research (Ad-hoc On-demand
Distance Vector, neuRFon) to automatically construct a low-speed ad-hoc network of
nodes. In most large network instances, the network will be a cluster of clusters. It can
also form a mesh or a single cluster. The current profiles derived from the ZigBee
protocols support beacon and non-beacon enabled networks.
In non-beacon-enabled networks (those whose beacon order is 15), an
unslotted CSMA/CA channel access mechanism is used. In this type of network,
ZigBee Routers typically have their receivers continuously active, requiring a more
robust power supply. However, this allows for heterogeneous networks in which some
devices receive continuously, while others only transmit when an external stimulus is
detected.
The typical example of a heterogeneous network is a wireless light switch:
The ZigBee node at the lamp may receive constantly, since it is connected to the
mains supply, while a battery-powered light switch would remain asleep until the
switch is thrown. The switch then wakes up, sends a command to the lamp, receives
an acknowledgment, and returns to sleep. In such a network the lamp node will be at
least a ZigBee Router, if not the ZigBee Coordinator; the switch node is typically a
ZigBee End Device.
In beacon-enabled networks, the special network nodes called ZigBee Routers
transmit periodic beacons to confirm their presence to other network nodes. Nodes
may sleep between beacons, thus lowering their duty cycle and extending their battery
life. Beacon intervals may range from 15.36 milliseconds to 15.36 ms * 214 =
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 59
251.65824 seconds at 250 kbit/s, from 24 milliseconds to 24 ms * 214 = 393.216
seconds at 40 kbit/s and from 48 milliseconds to 48 ms * 214 = 786.432 seconds at 20
kbit/s. However, low duty cycle operation with long beacon intervals requires precise
timing, which can conflict with the need for low product cost.
In general, the ZigBee protocols minimize the time the radio is on so as to
reduce power use. In beaconing networks, nodes only need to be active while a
beacon is being transmitted. In non-beacon-enabled networks, power consumption is
decidedly asymmetrical: some devices are always active, while others spend most of
their time sleeping.
Except for the Smart Energy Profile 2.0, which will be MAC/PHY agnostic,
ZigBee devices are required to conform to the IEEE 802.15.4-2003 Low-Rate
Wireless Personal Area Network (WPAN) standard. The standard specifies the
lower protocol layers—the physical layer (PHY), and the media access control
(MAC) portion of the data link layer (DLL). This standard specifies operation in the
unlicensed 2.4 GHz (worldwide), 915 MHz (Americas) and 868 MHz (Europe) ISM
bands. In the 2.4 GHz band there are 16 ZigBee channels, with each channel requiring
5 MHz of bandwidth. The center frequency for each channel can be calculated as,
FC = (2405 + 5 * (ch - 11)) MHz, where ch = 11, 12, ...,26.
The radios use direct-sequence spread spectrum coding, which is managed by
the digital stream into the modulator. BPSK is used in the 868 and 915 MHz bands,
and OQPSK that transmits two bits per symbol is used in the 2.4 GHz band.
The raw, over-the-air data rate is 250 kbit/s per channel in the 2.4 GHz band, 40
kbit/s per channel in the 915 MHz band, and 20 kbit/s in the 868 MHz band.
Transmission range is between 10 and 75 meters (33 and 246 feet) and up to 1500
meters for zigbee pro, although it is heavily dependent on the particular environment
The basic channel access mode is "carrier sense, multiple access/collision
avoidance" (CSMA/CA). That is, the nodes talk in the same way that people
converse; they briefly check to see that no one is talking before they start. There are
three notable exceptions to the use of CSMA. Beacons are sent on a fixed timing
schedule, and do not use CSMA. Message acknowledgments also do not use CSMA.
Finally, devices in Beacon Oriented networks that have low latency real-time
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 60
requirements may also use Guaranteed Time Slots (GTS), which by definition do not
use CSMA.
5.3.1 ZigBee RF4CE
On March 3, 2009 the RF4CE (Radio Frequency for Consumer Electronics)
Consortium agreed to work with the ZigBee Alliance to jointly deliver a standardized
specification for radio frequency-based remote controls. ZigBee RF4CE is designed
to be deployed in a wide range of remotely-controlled audio/visual consumer
electronics products, such as TVs and set-top boxes. It promises many advantages
over existing remote control solutions, including richer communication and increased
reliability, enhanced features and flexibility, interoperability, and no line-of-sight
barrier.[7]
5.4 History
ZigBee-style networks began to be conceived in about 1998, when many installers
realized that both WiFi and Bluetooth were going to be unsuitable for many
applications.
The IEEE 802.15.4 standard was completed in May 2003.
The ZigBee Alliance announced in October 2004 that the membership had more
than doubled in the preceding year and had grown to more than 100 member
companies, in 22 countries. By April 2005 membership had grown to more than
150 companies, and by December 2005 membership had passed 200 companies.
The ZigBee specifications were ratified on 14 December 2004.
The ZigBee Alliance announces public availability of Specification 1.0 on 13 June
2005, known as ZigBee 2004 Specification.
The ZigBee Alliance announces the completion and immediate member
availability of the enhanced version of the ZigBee Standard in September 2006,
known as ZigBee 2006 Specification.
During the last quarter of 2007, ZigBee PRO, the enhanced ZigBee specification
was finalized.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 61
Origin of ZigBee name
The name of the brand is originated with reference to the behaviour of honey
bees after return to the beehive. Details are reported with specific pages on bees.
5.5 ZigBee specification
ZigBee is the specification of a low-cost, low-power wireless communications
solution, meant to be integrated as the main building block of ubiquitous networks. It
is maintained by the ZigBee Alliance, which develops the specification and certifies
its proper implementation. As of 2007, the latest publicly available revision is
the 2006 version.
5.5.1 Overview
ZigBee protocol stack
ZigBee builds upon the physical layer and medium access control defined
in IEEE standard 802.15.4 (2003 version) for low-rate WPAN's. The specification
goes on to complete the standard by adding four main components: network layer,
application layer, ZigBee device objects (ZDO's) and manufacturer-defined
application objects which allow for customization and favor total integration.
Besides adding two high-level network layers to the underlying structure, the
most significant improvement is the introduction of ZDO's. These are responsible for
a number of tasks, which include keeping of device roles, management of requests to
join a network, device discovery and security.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 62
At its core, ZigBee is a mesh network architecture. Its network layer natively
supports three types of topologies: both star and tree typical networks and generic
mesh networks. Every network must have one coordinator device, tasked with its
creation, the control of its parameters and basic maintenance. Within star networks,
the coordinator must be the central node. Both trees and meshes allow the use of
ZigBee routers to extend communication at the network level (they are not ZigBee
coordinators, but may act as 802.15.4 coordinators within their personal operating
space), but they differ in a few important details: communication within trees is
hierarchical and optionally utilizes frame beacons, whereas meshes allow generic
communication structures but no router beaconing.
5.5.1.1 Network layer
The main functions of the network layer are to enable the correct use of the
MAC sublayer and provide a suitable interface for use by the next upper layer,
namely the application layer. Its capabilities and structure are those typically
associated to such network layers, including routing.
On the one hand, the data entity creates and manages network layer data units
from the payload of the application layer and performs routing according to the
current topology. On the other hand, there is the layer control, which is used to handle
configuration of new devices and establish new networks: it can determine whether a
neighboring device belongs to the network and discovers new neighbors and routers.
The control can also detect the presence of a receiver, which allows direct
communication and MAC synchronization.
The routing protocol used by the Network layer is AODV. In order to find the
destination device, it broadcasts out a route request to all of its neighbors. The
neighbors then broadcast the request to their neighbors, etc until the destination is
reached. Once the destination is reached, it sends its route reply via unicast
transmission following the lowest cost path back to the source. Once the source
receives the reply, it will update its routing table for the destination address with the
next hop in the path and the path cost.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 63
5.5.1.2 Application layer
The application layer is the highest-level layer defined by the specification,
and is the effective interface of the ZigBee system to its end users. It comprises the
majority of components added by the ZigBee specification: both ZDO and its
management procedures, together with application objects defined by the
manufacturer, are considered part of this layer.
5.5.1.3 Main components
The ZDO is responsible for defining the role of a device as either coordinator or
end device, as mentioned above, but also for the discovery of new (one-hop) devices
on the network and the identification of their offered services. It may then go on to
establish secure links with external devices and reply to binding requests accordingly.
The application support sublayer (APS) is the other main standard component of
the layer, and as such it offers a well-defined interface and control services. It works
as a bridge between the network layer and the other components of the application
layer: it keeps up-to-date binding tables in the form of a database, which can be used
to find appropriate devices depending on the services that are needed and those the
different devices offer. As the union between both specified layers, it also routes
messages across the layers of the protocol stack.
5.5.2 Communication models
ZigBee high-level communication model
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 64
An application may consist of communicating objects which cooperate to
carry out the desired tasks. The focus of ZigBee is to distribute work among many
different devices which reside within individual ZigBee nodes which in turn form a
network (said work will typically be largely local to each device, for instance the
control of each individual household appliance).
The collection of objects that form the network communicate using the
facilities provided by APS, supervised by ZDO interfaces. Within a single device, up
to 240 application objects can exist, numbered in the range 1-240. 0 is reserved for the
ZDO data interface and 255 for broadcast; the 241-254 range is not currently in use
but may be in the future.
There are two services available for application objects to use (in ZigBee 1.0):
The key-value pair service (KVP) is meant for configuration purposes. It enables
description, request and modification of object attributes through a simple
interface based on get/set and event primitives, some allowing a request for
response. Configuration uses compressed XML (full XML can be used) to provide
an adaptable and elegant solution.
The message service is designed to offer a general approach to information
treatment, avoiding the necessity to adapt application protocols and potential
overhead incurred on by KPV. It allows arbitrary payloads to be transmitted over
APS frames.
Addressing is also part of the application layer. A network node consists of an
802.15.4-conformant radio transceiver and one or more device descriptions (basically
collections of attributes which can be polled or set, or which can be monitored
through events). The transceiver is the base for addressing, and devices within a node
are specified by an endpoint identifier in the range 1-240.
5.6 Communication and device discovery
In order for applications to communicate, their comprising devices must use a
common application protocol (types of messages, formats and so on); these sets of
conventions are grouped in profiles. Furthermore, binding is decided upon by
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 65
matching input and output cluster identifiers, unique within the context of a given
profile and associated to an incoming or outgoing data flow in a device. Binding
tables contain source and destination pairs.
Depending on the available information, device discovery may follow different
methods. When the network address is known, the IEEE address can be requested
using unicast communication. When it is not, petitions are broadcast (the IEEE
address being part of the response payload).
This extended discovery protocol permits external devices to find out about
devices in a network and the services that they offer, which endpoints can report when
queried by the discovering device (which has previously obtained their addresses).
Matching services can also be used.
The use of cluster identifiers enforces the binding of complementary entities by
means of the binding tables, which are maintained by ZigBee coordinators, as the
table must be always available within a network and coordinators are most likely to
have a permanent power supply. Backups, managed by higher-level layers, may be
needed by some applications. Binding requires an established communication link;
after it exists, whether to add a new node to the network is decided, according to the
application and security policies.
Communication can happen right after the association. Direct addressing uses
both radio address and endpoint identifier, whereas indirect addressing uses every
relevant field (address, endpoint, cluster and attribute) and requires that they be sent
to the network coordinator, which maintains associations and translates requests for
communication. Indirect addressing is particularly useful to keep some devices very
simple and minimize their need for storage. Besides these two methods, broadcast to
all endpoints in a device is available, and group addressing is used to communicate
with groups of endpoints belonging to a set of devices.
5.7 Security services
As one of its defining features, ZigBee provides facilities for carrying out secure
communications, protecting establishment and transport of cryptographic keys,
ciphering frames and controlling devices. It builds on the basic security framework
defined in IEEE 802.15.4. This part of the architecture relies on the correct
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 66
management of symmetric keys and the correct implementation of methods and
security policies.
5.7.1 Security architecture
ZigBee uses 128-bit keys to implement its security mechanisms. A key can be
associated either to a network, being usable by both ZigBee layers and the MAC
sublayer, or to a link, acquired through pre-installation, agreement or transport.
Establishment of link keys is based on a master key which controls link key
correspondence. Ultimately, at least the initial master key must be obtained through a
secure medium (transport or pre-installation), as the security of the whole network
depends on it. Link and master keys are only visible to the application layer. Different
services use different one-way variations of the link key in order to avoid leaks and
security risks.
Thus, the trust center maintains both the network key and provides point-to-point
security. Devices will only accept communications originating from a key provided
by the trust center, except for the initial master key. The security architecture is
distributed among the network layers as follows:
The MAC sublayer is capable of single-hop reliable communications. As a rule,
the security level it is to use is specified by the upper layers.
The network layer manages routing, processing received messages and being
capable of broadcasting requests. Outgoing frames will use the adequate link key
according to the routing, if it is available; otherwise, the network key will be used
to protect the payload from external devices.
The application layer offers key establishment and transport services to both ZDO
and applications. It is also responsible for the propagation across the network of
changes in devices within it, which may originate in the devices themselves (for
instance, a simple status change) or in the trust manager (which may inform the
network that a certain device is to be eliminated from it). It also routes requests
from devices to the trust center and network key renewals from the trust center to
all devices. Besides this, the ZDO maintains the security policies of the device.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 67
The security levels infrastructure is based on CCM*, which adds encryption- and
integrity-only features to CCM.
5.8 IEEE 802.15.4-2006
IEEE 802.15.4-2006 is a standard which specifies the physical layer and media
access control for low-rate wireless personal area networks (LR-WPANs). It is
maintained by the IEEE 802.15 working group.
It is the basis for the ZigBee, WirelessHART, and MiWi specification, each of which
further attempts to offer a complete networking solution by developing the
upper layers which are not covered by the standard. Alternatively, it can be used
with 6LoWPAN and standard Internet protocols to build a Wireless Embedded
Internet.
5.8.1.1 Overview
IEEE standard 802.15.4 intends to offer the fundamental lower network layers
of a type of wireless personal area network (WPAN) which focuses on low-cost, low-
speed ubiquitous communication between devices (in contrast with other, more end
user-oriented approaches, such as Wi-Fi). The emphasis is on very low cost
communication of nearby devices with little to no underlying infrastructure, intending
to exploit this to lower power consumption even more.
The basic framework conceives a 10-meter communications area with
a transfer rate of 250 kbit/s. Tradeoffs are possible to favor more radically embedded
devices with even lower power requirements, through the definition of not one, but
several physical layers. Lower transfer rates of 20 and 40 kbit/s were initially defined,
with the 100 kbit/s rate being added in the current revision.
Even lower rates can be considered with the resulting effect on power
consumption. As already mentioned, the main identifying feature of 802.15.4 among
WPAN's is the importance of achieving extremely low manufacturing and operation
costs and technological simplicity, without sacrificing flexibility or generality.
Important features include real-time suitability by reservation of guaranteed
time slots, collision avoidance through CSMA/CA and integrated support for secure
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 68
communications. Devices also include power management functions such as link
quality and energy detection.
802.15.4-conformant devices may use one of three possible frequency bands for
operation.
5.8.2 Protocol architecture
IEEE 802.15.4 protocol stack
Devices are conceived to interact with each other over a conceptually
simple wireless network. The definition of the network layers is based on the OSI
model; although only the lower layers are defined in the standard, interaction with
upper layers is intended, possibly using a IEEE 802.2 logical link control sublayer
accessing the MAC through a convergence sublayer. Implementations may rely on
external devices or be purely embedded, self-functioning devices.
5.8.2.1 The physical layer
The physical layer (PHY) ultimately provides the data transmission service, as
well as the interface to the physical layer management entity, which offers access to
every layer management function and maintains a database of information on related
personal area networks. Thus, PHY manages the physical RF transceiver and performs
channel selection and energy and signal management functions. It operates on one of
three possible unlicensed frequency bands:
868.0-868.6 MHz: Europe, allows one communication channel (2003, 2006)
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 69
902-928 MHz: North America, up to ten channels (2003), extended to thirty
(2006)
2400-2483.5 MHz: worldwide use, up to sixteen channels (2003, 2006)
The original 2003 version of the standard specifies two physical layers based
on direct sequence spread spectrum (DSSS) techniques: one working in the
868/915 MHz bands with transfer rates of 20 and 40 kbit/s, and one in the 2450 MHz
band with a rate of 250 kbit/s.
The 2006 revision improves the maximum data rates of the 868/915 MHz
bands, bringing them up to support 100 and 250 kbit/s as well. Moreover, it goes on to
define four physical layers depending on the modulation method used. Three of them
preserve the DSSS approach: in the 868/915 MHz bands, using either binary or offset
quadrature phase shift keying (the second of which is optional); in the 2450 MHz
band, using the latter. An alternative, optional 868/915 MHz layer is defined using a
combination of binary keying and amplitude shift keying (thus based on parallel, not
sequential spread spectrum, PSSS). Dynamic switching between supported
868/915 MHz PHY's is possible.
Beyond these three bands, the IEEE802.15.4c study group is considering the
newly opened 314-316 MHz, 430-434 MHz, and 779-787 MHz bands in China, while
the IEEE 802.15 Task Group 4d is defining an amendment to the existing standard
802.15.4-2006 to support the new 950 MHz-956 MHz band in Japan. First standard
amendments by these groups were released in April 2009.
In April, 2009 IEEE 802.15.4c and IEEE 802.15.4d were released expanding the
available PHYs with several additional PHYs: one for 780 MHz band using O-QPSK
or MPSK, another for 950 MHz using GFSK or BPSK.
5.8.2.2 The MAC layer
The medium access control (MAC) allows the transmission of MAC frames
through the use of the physical channel. Besides the data service, it offers a
management interface and itself manages access to the physical channel and
network beaconing. It also controls frame validation, guarantees time slots and
handles node associations. Finally, it offers hook points for secure services.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 70
5.8.2.3 Higher layers
Other higher-level layers and interoperability sublayers are not defined in the
standard. There exist specifications, such as ZigBee, which build on this standard to
propose integral solutions. TinyOSstacks also use a few items of IEEE 802.15.4
hardware.
5.9 Data transport architecture
Frames are the basic unit of data transport, of which there are four fundamental
types (data, acknowledgment, beacon and MAC command frames), which provide a
reasonable tradeoff between simplicity and robustness. Additionally, a superframe
structure, defined by the coordinator, may be used, in which case two beacons act as
its limits and provide synchronization to other devices as well as configuration
information. A superframe consists of sixteen equal-length slots, which can be further
divided into an active part and an inactive part, during which the coordinator may
enter power saving mode, not needing to control its network.
Within superframes contention occurs between their limits, and is resolved
by CSMA/CA. Every transmission must end before the arrival of the second beacon.
As mentioned before, applications with well-defined bandwidth needs can use up to
seven domains of one or more contentionless guaranteed time slots, trailing at the end
of the superframe. The first part of the superframe must be sufficient to give service to
the network structure and its devices.
Data transfers to the coordinator require a beacon synchronization phase, if
applicable, followed by CSMA/CA transmission (by means of slots if superframes are
in use); acknowledgment is optional. Data transfers from the coordinator usually
follow device requests: if beacons are in use, these are used to signal requests; the
coordinator acknowledges the request and then sends the data in packets which are
acknowledged by the device. The same is done when superframes are not in use, only
in this case there are no beacons to keep track of pending messages.
5.10 Reliability and security
The physical medium is accessed through a CSMA/CA protocol. Networks
which are not using beaconing mechanisms utilize an unslotted variation which is
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 71
based on the listening of the medium, leveraged by a random exponential
backoff algorithm; acknowledgments do not adhere to this discipline. Common data
transmission utilizes unallocated slots when beaconing is in use; again, confirmations
do not follow the same process.
Confirmation messages may be optional under certain circumstances, in which
case a success assumption is made. Whatever the case, if a device is unable to process
a frame at a given time, it simply does not confirm its reception: timeout-based
retransmission can be performed a number of times, following after that a decision of
whether to abort or keep trying.
Because the predicted environment of these devices demands maximization of
battery life, the protocols tend to favor the methods which lead to it, implementing
periodic checks for pending messages, the frequency of which depends on application
needs.
Regarding secure communications, the MAC sublayer offers facilities which can
be harnessed by upper layers to achieve the desired level of security. Higher-layer
processes may specify keys to perform symmetric cryptography to protect the payload
and restrict it to a group of devices or just a point-to-point link; these groups of
devices can be specified in access control lists. Furthermore, MAC
computes freshness checks between successive receptions to ensure that presumably
old frames, or data which is no longer considered valid, does not transcend to higher
layers.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 72
6 GPS: Global Positioning System
"GPS" redirects here. For other uses, see GPS (disambiguation).
For a generally accessible and less technical introduction to the topic, see Introduction to the
Global Positioning System.
Artist's conception of GPS Block II-F satellite in orbit
Civilian GPS receiver ("GPS navigation device") in a marine application.
Automotive navigation system in a taxicab.
The Global Positioning System (GPS) is a U.S. space-based global navigation satellite system.
It provides reliable positioning, navigation, and timing services to worldwide users on a
continuous basis in all weather, day and night, anywhere on or near the Earth which has an
unobstructed view of four or more GPS satellites.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 73
GPS is made up of three segments: Space, Control and User. The Space Segment is
composed of 24 to 32 satellites in Medium Earth Orbit and also includes the boosters required to
launch them into orbit. The Control Segment is composed of a Master Control Station, an
Alternate Master Control Station, and a host of dedicated and shared Ground Antennas and
Monitor Stations.
The User Segment is composed of hundreds of thousands of U.S. and allied military users
of the secure GPS Precise Positioning Service, and tens of millions of civil, commercial and
scientific users of the Standard Positioning Service (see GPS navigation devices). GPS satellites
broadcast signals from space that GPS receivers use to provide three-dimensional location
(latitude, longitude, and altitude) plus precise time.
GPS has become a widely used aid to navigation worldwide, and a useful tool for map-
making, land surveying, commerce, scientific uses, tracking and surveillance, and hobbies such
as geocaching and waymarking. Also, the precise time reference is used in many applications
including the scientific study of earthquakes and as a time synchronization source for cellular
network protocols.
GPS has become a mainstay of transportation systems worldwide, providing navigation
for aviation, ground, and maritime operations. Disaster relief and emergency services depend
upon GPS for location and timing capabilities in their life-saving missions. The accurate timing
that GPS provides facilitates everyday activities such as banking, mobile phone operations, and
even the control of power grids. Farmers, surveyors, geologists and countless others perform
their work more efficiently, safely, economically, and accurately using the free and open GPS
signals.
6.1 Basic concept of GPS
A GPS receiver calculates its position by precisely timing the signals sent by the GPS satellites
high above the Earth. Each satellite continually transmits messages which include.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 74
the time the message was transmitted
precise orbital information (the ephemeris)
the general system health and rough orbits of all GPS satellites (the almanac).
The receiver utilizes the messages it receives to determine the transit time of each message
and computes the distances to each satellite. These distances along with the satellites' locations
are used with the possible aid of trilateration to compute the position of the receiver. This
position is then displayed, perhaps with a moving map display or latitude and longitude;
elevation information may be included.
The GPS signal allows to repeat this calculation every 6 seconds. Many GPS units show
derived information such as direction and speed, calculated from position changes.
Three satellites might seem enough to solve for position, since space has three dimensions
and a position on the Earth's surface can be assumed. However, even a very small clock error
multiplied by the very large speed of light—the speed at which satellite signals propagate—
results in a large positional error. Therefore receivers use four or more satellites to solve for the
receiver's location and time. The very accurately computed time is effectively hidden by most
GPS applications, which use only the location. A few specialized GPS applications do however
use the time; these include time transfer, traffic signal timing, and synchronization of cell phone
base stations.
Although four satellites are required for normal operation, fewer apply in special cases. If
one variable is already known, a receiver can determine its position using only three satellites.
(For example, a ship or plane may have known elevation.) Some GPS receivers may use
additional clues or assumptions (such as reusing the last known altitude, dead reckoning, inertial
navigation, or including information from the vehicle computer) to give a degraded position
when fewer than four satellites are visible
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 75
6.2 Position calculation introduction
To provide an introductory description of how a GPS receiver works, errors will be ignored
in this section. Using messages received from a minimum of four visible satellites, a GPS
receiver is able to determine the times sent and then the satellite positions corresponding to these
times sent. The x, y, and z components of position, and the time sent, are designated as
where the subscript i is the satellite number and has the value 1, 2, 3, or 4. Knowing
the indicated time the message was received , the GPS receiver can compute the transit time of
the message as . Assuming the message traveled at the speed of light, c, the distance
traveled, can be computed as .
A satellite's position and distance from the receiver define a spherical surface, centered on
the satellite. The position of the receiver is somewhere on this surface. Thus with four satellites,
the indicated position of the GPS receiver is at or near the intersection of the surfaces of four
spheres. (In the ideal case of no errors, the GPS receiver would be at a precise intersection of the
four surfaces.)
If the surfaces of two spheres intersect at more than one point, they intersect in a circle. The
article trilateration shows this mathematically. A figure, Two Sphere Surfaces Intersecting in a
Circle, is shown below.
Two sphere surfaces intersecting in a circle
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 76
The intersection of a third spherical surface with the first two will be its intersection with
that circle; in most cases of practical interest, this means they intersect at two points. Another
figure, Surface of Sphere Intersecting a Circle (not disk) at Two Points , illustrates the
intersection. The two intersections are marked with dots. Again the article trilateration clearly
shows this mathematically.
Surface of sphere Intersecting a circle (not disk) at two points
For automobiles and other near-earth-vehicles, the correct position of the GPS receiver is
the intersection closest to the Earth's surface. For space vehicles, the intersection farthest from
Earth may be the correct one.
The correct position for the GPS receiver is also the intersection closest to the surface of
the sphere corresponding to the fourth satellite.
6.2.1 Correcting a GPS receiver's clock
The method of calculating position for the case of no errors has been explained. One of the
most significant error sources is the GPS receiver's clock. Because of the very large value of the
speed of light, c, the estimated distances from the GPS receiver to the satellites, the pseudo
ranges, are very sensitive to errors in the GPS receiver clock. This suggests that an extremely
accurate and expensive clock is required for the GPS receiver to work. On the other hand,
manufacturers prefer to build inexpensive GPS receivers for mass markets. The solution for this
dilemma is based on the way sphere surfaces intersect in the GPS problem.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 77
Diagram depicting satellite 4, sphere, p4, r4, and da
It is likely that the surfaces of the three spheres intersect, since the circle of intersection
of the first two spheres is normally quite large, and thus the third sphere surface is likely to
intersect this large circle. It is very unlikely that the surface of the sphere corresponding to the
fourth satellite will intersect either of the two points of intersection of the first three, since any
clock error could cause it to miss intersecting a point.
However, the distance from the valid estimate of GPS receiver position to the surface of
the sphere corresponding to the fourth satellite can be used to compute a clock correction. Let
denote the distance from the valid estimate of GPS receiver position to the fourth satellite and let
denote the pseudo-range of the fourth satellite. Let . Note that is the distance
from the computed GPS receiver position to the surface of the sphere corresponding to the fourth
satellite. Thus the quotient, , provides an estimate of (correct time) − (time indicated by
the receiver's on-board clock),and the GPS receiver clock can be advanced if is positive or
delayed if is negative.
6.3 System segmentation
Unlaunched GPS satellite on display at the San Diego Aerospace museum
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 78
The current GPS consists of three major segments. These are the space segment (SS), a control
segment (CS), and a user segment (US).
6.3.1 Space segment
See also section 4.3 of "Essentials of Satellite Navigation Compendium", GPS satellite,
List of GPS satellite launches, and Chapter 6 of The global positioning system by Parkinson and
Spilker.
A visual example of the GPS constellation in motion with the Earth rotating. Notice how
the number of satellites in view from a given point on the Earth's surface, in this example at
45°N, changes with time.
The space segment (SS) is composed of the orbiting GPS satellites, or Space Vehicles
(SV) in GPS parlance. The GPS design originally called for 24 SVs, eight each in three circular
orbital planes, but this was modified to six planes with four satellites each. The orbital planes are
centered on the Earth, not rotating with respect to the distant stars. The six planes have
approximately 55° inclination (tilt relative to Earth's equator) and are separated by 60° right
ascension of the ascending node (angle along the equator from a reference point to the orbit's
intersection). The orbits are arranged so that at least six satellites are always within line of sight
from almost everywhere on Earth's surface.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 79
Orbiting at an altitude of approximately 20,200 kilometers (about 12,550 miles or 10,900
nautical miles; orbital radius of approximately 26,600 km (about 16,500 mi or 14,400 NM)),
each SV makes two complete orbits each sidereal day, repeating the same ground track each day.
This was very helpful during development, since even with just four satellites, correct alignment
means all four are visible from one spot for a few hours each day. For military operations, the
ground track repeat can be used to ensure good coverage in combat zones.
As of March 2008,there are 31 actively broadcasting satellites in the GPS constellation, and
two older, retired from active service satellites kept in the constellation as orbital spares. The
additional satellites improve the precision of GPS receiver calculations by providing redundant
measurements. With the increased number of satellites, the constellation was changed to a
nonuniform arrangement. Such an arrangement was shown to improve reliability and availability
of the system, relative to a uniform system, when multiple satellites fail.[34] About eight satellites
are visible from any point on the ground at any one time (see animation at right).
6.3.2 Control segment
The Control Segment is composed of
1. a Master Control Station (MCS),
2. an Alternate Master Control Station,
3. four dedicated Ground Antennas and
4. six dedicated Monitor Stations.
The MCS can also access U.S. Air Force Satellite Control Network (AFSCN) ground
antennas (for additional command and control capability) and NGA (National Geospatial-
Intelligence Agency) monitor stations. The flight paths of the satellites are tracked by dedicated
U.S. Air Force monitoring stations in Hawaii, Kwajalein, Ascension Island, Diego Garcia,
Colorado Springs, Colorado and Cape Canaveral, along with shared NGA monitor stations
operated in England, Argentina, Ecuador, Bahrain, Australia and Washington DC.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 80
The tracking information is sent to the Air Force Space Command's MCS at Schriever
Air Force Base 16 miles ESE of Colorado Springs, which is operated by the 2nd Space
Operations Squadron (2 SOPS) of the United States Air Force (USAF).
The 2 SOPS contacts each GPS satellite regularly with a navigational update using
dedicated or shared (AFSCN) ground antennas (GPS dedicated ground antennas are located at
Kwajalein, Ascension Island, Diego Garcia, and Cape Canaveral). These updates synchronize the
atomic clocks on board the satellites to within a few nanoseconds of each other, and adjust the
ephemeris of each satellite's internal orbital model. The updates are created by a Kalman filter
which uses inputs from the ground monitoring stations, space weather information, and various
other inputs.
Satellite maneuvers are not precise by GPS standards. So to change the orbit of a satellite,
the satellite must be marked unhealthy, so receivers will not use it in their calculation. Then the
maneuver can be carried out, and the resulting orbit tracked from the ground. Then the new
ephemeris is uploaded and the satellite marked healthy again.
6.3.3 User segment
The User Segment is composed of hundreds of thousands of U.S. and allied military users
of the secure GPS Precise Positioning Service, and tens of millions of civil, commercial and
scientific users of the Standard Positioning Service. In general, GPS receivers are composed of
an antenna, tuned to the frequencies transmitted by the satellites, receiver-processors, and a
highly-stable clock (often a crystal oscillator). They may also include a display for providing
location and speed information to the user.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 81
A receiver is often described by its number of channels: this signifies how many
satellites it can monitor simultaneously. Originally limited to four or five, this has progressively
increased over the years so that, as of 2007, receivers typically have between 12 and 20 channels.
A typical OEM GPS receiver module measuring 15×17 mm.
GPS receivers may include an input for differential corrections, using the RTCM SC-104
format. This is typically in the form of an RS-232 port at 4,800 bit/s speed. Data is actually sent
at a much lower rate, which limits the accuracy of the signal sent using RTCM. Receivers with
internal DGPS receivers can outperform those using external RTCM data. As of 2006, even low-
cost units commonly include Wide Area Augmentation System (WAAS) receivers.
A typical GPS receiver with integrated antenna.
Many GPS receivers can relay position data to a PC or other device using the NMEA
0183 protocol, or the newer and less widely used NMEA 2000.[38] Although these protocols are
officially defined by the NMEA,[39] references to these protocols have been compiled from public
records, allowing open source tools like gpsd to read the protocol without violating intellectual
property laws. Other proprietary protocols exist as well, such as the SiRF and MTK protocols.
Receivers can interface with other devices using methods including a serial connection, USB, or
Bluetooth.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 82
6.4 Navigation
Aspects of navigation are discussed in this section. The subsection on navigation signals
discusses details of the message content. Carrier frequencies for the messages are stated.
Demodulating the carrier and decoding to separate the signals from the satellites is described.
The position calculation subsection does not require an understanding of the other subsections.
Basic equations describing the geometry of the sphere and the fundamental concept that the
satellite message travels at the speed of light are used in the subsection. The subsection on
multidimensional Newton-Raphson may be of interest only to those readers who want a more
detailed understanding on how an algorithm might be written and is unnecessary for the reader
who is uninterested in this amount of detail.
6.4.1.1 Navigation signals
6.4.2 GPS broadcast signal
Each GPS satellite continuously broadcasts a Navigation Message at 50 bit/s giving the
time-of-week, GPS week number and satellite health information (all transmitted in the first part
of the message), an ephemeris (transmitted in the second part of the message) and an almanac
(later part of the message). The messages are sent in frames, each taking 30 seconds to transmit
1,500 bits.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 83
Transmission of each 30 second frame begins precisely on the minute and half minute as
indicated by the satellite's atomic clock according to Satellite message format. Each frame
contains 5 subframes of length 6 seconds and with 300 bits. Each subframe contains 10 words of
30 bits with length 0.6 seconds each.
Words 1 and 2 of every subframe have the same type of data. The first word is the
telemetry word which indicates the beginning of a subframe and is used by the receiver to synch
with the navigation message. The second word is the HOW or handover word and it contains
timing information which enables the receiver to identify the subframe and provides the time the
next subframe was sent.
Words 3 through 10 of subframe 1 contain data describing the satellite clock and its
relationship to GPS time. Words 3 through 10 of subframes 2 and 3, contain the ephemeris data,
giving the satellite's own precise orbit. The ephemeris is updated every 2 hours and is generally
valid for 4 hours, with provisions for updates every 6 hours or longer in non-nominal conditions.
The time needed to acquire the ephemeris is becoming a significant element of the delay to first
position fix, because, as the hardware becomes more capable, the time to lock onto the satellite
signals shrinks, but the ephemeris data requires 30 seconds (worst case) before it is received, due
to the low data transmission rate.
The almanac consists of coarse orbit and status information for each satellite in the
constellation, an ionospheric model, and information to relate GPS derived time to Coordinated
Universal Time (UTC). Words 3 through 10 of subframes 4 and 5 contain a new part of the
almanac. Each frame contains 1/25th of the almanac, so 12.5 minutes are required to receive the
entire almanac from a single satellite. The almanac serves several purposes. The first is to assist
in the acquisition of satellites at power-up by allowing the receiver to generate a list of visible
satellites based on stored position and time, while an ephemeris from each satellite is needed to
compute position fixes using that satellite. In older hardware, lack of an almanac in a new
receiver would cause long delays before providing a valid position, because the search for each
satellite was a slow process
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 84
All satellites broadcast at the same two frequencies, 1.57542 GHz (L1 signal) and
1.2276 GHz (L2 signal). The receiver can distinguish the signals from different satellites because
GPS uses a code division multiple access (CDMA) spread-spectrum technique where the low-
bitrate message data is encoded with a high-rate pseudo-random (PRN) sequence that is different
for each satellite. The receiver knows the PRN codes for each satellite and can use this to
reconstruct the actual message data. The message data is transmitted at 50 bits per second. Two
distinct CDMA encodings are used: the coarse/acquisition (C/A) code (a so-called Gold code) at
1.023 million chips per second, and the precise (P) code at 10.23 million chips per second. The
L1 carrier is modulated by both the C/A and P codes, while the L2 carrier is only modulated by
the P code. The C/A code is public and used by civilian GPS receivers, while the P code can be
encrypted as a so-called P(Y) code which is only available to military equipment with a proper
decryption key. Both the C/A and P(Y) codes impart the precise time-of-day to the user.
6.5 Satellite frequencies
L1 (1575.42 MHz): Mix of Navigation Message, coarse-acquisition (C/A) code and
encrypted precision P(Y) code, plus the new L1C on future Block III satellites.
L2 (1227.60 MHz): P(Y) code, plus the new L2C code on the Block IIR-M and newer
satellites since 2005.
L3 (1381.05 MHz): Used by the Nuclear Detonation (NUDET) Detection System
Payload (NDS) to signal detection of nuclear detonations and other high-energy infrared
events. Used to enforce nuclear test ban treaties.
L4 (1379.913 MHz): Being studied for additional ionospheric correction.
L5 (1176.45 MHz): Proposed for use as a civilian safety-of-life (SoL) signal (see GPS
modernization). This frequency falls into an internationally protected range for
aeronautical navigation, promising little or no interference under all circumstances. The
first Block IIF satellite that would provide this signal is set to be launched in 2010.[42]
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 85
6.6 Position calculation advanced
Before providing a more mathematical description of position calculation, the introductory
material on this topics is reviewed. To describe the basic concept of how a GPS receiver works,
the errors are at first ignored. Using messages received from four satellites, the GPS receiver is
able to determine the satellite positions and time sent. The x, y, and z components of position and
the time sent are designated as where the subscript i denotes which satellite and
has the value 1, 2, 3, or 4. Knowing the indicated time the message was received , the GPS
receiver can compute the transit time of the message as . Assuming the message
traveled at the speed of light, c, the distance traveled, can be computed as .
Knowing the distance from GPS receiver to a satellite and the position of a satellite implies that
the GPS receiver is on the surface of a sphere centered at the position of a satellite. Thus we
know that the indicated position of the GPS receiver is at or near the intersection of the surfaces
of four spheres. In the ideal case of no errors, the GPS receiver will be at an intersection of the
surfaces of four spheres. The surfaces of two spheres if they intersect in more than one point
intersect in a circle. We are here excluding the unrealistic case for GPS purposes of two
coincident spheres. A figure, Two Sphere Surfaces Intersecting in a Circle, is shown below
depicting this which hopefully will aid the reader in visualizing this intersection. Two points at
which the surfaces of the spheres intersect are clearly marked on the figure.
Two sphere surfaces intersecting in a circle
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 86
The article, trilateration, shows mathematically how the equation for this circle of
intersection is determined. A circle and sphere surface in most cases of practical interest intersect
at two points, although it is conceivable that they could intersect in 0 or 1 point. We are here
excluding the unrealistic case for GPS purposes of three colinear (lying on same straight line)
sphere centers. Another figure, Surface of Sphere Intersecting a Circle (not disk) at Two Points,
is shown below to aid in visualizing this intersection. Again trilateration clearly shows this
mathematically. The correct position of the GPS receiver is the one that is closest to the fourth
sphere. This paragraph has described the basic concept of GPS while ignoring errors. The next
problem is how to process the messages when errors are present.
Surface of a sphere intersecting a circle (i.e., the edge of a disk) at two points
Let denote the clock error or bias, the amount by which the receiver's clock is slow. The GPS
receiver has four unknowns, the three components of GPS receiver position and the clock bias
. The equation of the sphere surfaces are given by:
Another useful form of these equations is in terms of the pseudoranges, which are simply the
ranges approximated based on GPS receiver clock's indicated (i.e., uncorrected) time so that
. Then the equations becomes:
.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 87
Two of the most important methods of computing GPS receiver position and clock bias are (1)
trilateration followed by one dimensional numerical root finding and (2) multidimensional
Newton-Raphson calculations. These two methods along with their advantages are discussed.
The receiver can solve by trilateration followed by one dimensional numerical root
finding. This method involves using trilateration to determine the intersection of the
surfaces of three spheres. It is clearly shown in trilateration that the surfaces of three
spheres intersect in 0, 1, or 2 points. In the usual case of two intersections, the solution
which is nearest the surface of the sphere corresponding to the fourth satellite is chosen.
The surface of the earth can also sometimes be used instead, especially in the case of
civilian GPS receivers since it is illegal in the United States to track vehicles of more than
60,000 feet (18,000 m) in altitude. The bias, is then computed as a function of the
distance from the solution to the surface of the sphere corresponding to the fourth
satellite. To determine what function to use for computing see the chapter on root
finding in [48] or the preview. Using an updated received time based on this bias, new
spheres are computed and the process is repeated. This repetition is continued until the
distance from the valid trilateration solution is sufficiently close to the surface of the
sphere corresponding to the fourth satellite. One advantage of this method is that it
involves one dimensional as opposed to multidimensional numerical root finding.
The receiver can utilize a multidimensional root finding method such as the Newton-
Raphson method. Linearize around an approximate solution, say
from iteration k, then solve four linear equations derived from the quadratic equations
above to obtain . The radii are large and so the sphere
surfaces are close to flat. This near flatness may cause the iterative procedure to converge
rapidly in the case where is near the correct value and the primary change is in the
values of , since in this case the problem is merely to find the intersection
of nearly flat surfaces and thus close to a linear problem.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 88
Other methods include:
1. Solving for the intersection of the expanding signals from light cones in 4-space cones
2. Solving for the intersection of hyperboloids determined by the time difference of signals
received from satellites utilizing multilateration,
3. Solving the equations in accordance with .[51][52][54]
When more than four satellites are available, a decision must be made on whether to use
the four best or more than four taking into considerations such factors as number of
channels, processing capability, and geometric dilution of precision. Using more than
four results in an over-determined system of equations with no unique solution, which
must be solved by least-squares or a similar technique. If all visible satellites are used, the
results are always at least as good as using the four best, and usually better. Also the
errors in results can be estimated through the residuals. With each combination of four or
more satellites, a geometric dilution of precision (GDOP) factor can be calculated, based
on the relative sky directions of the satellites used. As more satellites are picked up,
pseudoranges from more combinations of four satellites can be processed to add more
estimates to the location and clock offset. The receiver then determines which
combinations to use and how to calculate the estimated position by determining the
weighted average of these positions and clock offsets. After the final location and time
are calculated, the location is expressed in a specific coordinate system such as latitude
and longitude, using the WGS 84 geodetic datum or a local system specific to a country.
Finally, results from other positioning systems such as GLONASS or the upcoming
Galileo can be used in the fit, or used to double check the result. (By design, these
systems use the same bands, so much of the receiver circuitry can be shared, though the
decoding is different.)
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 89
6.6.1 Working of GPS
The Global Positioning System (GPS) is a satellite-based navigation system made up of a
network of 24 satellites placed into orbit by the U.S. Department of Defense. GPS was originally
intended for military applications, but in the 1980s, the government made the system available
for civilian use. GPS works in any weather conditions, anywhere in the world, 24 hours a day.
There are no subscription fees or setup charges to use GPS.
GPS satellites circle the earth twice a day in a very precise orbit and transmit signal
information to earth. GPS receivers take this information and use triangulation to calculate the
user's exact location. Essentially, the GPS receiver compares the time a signal was transmitted by
a satellite with the time it was received. The time difference tells the GPS receiver how far away
the satellite is. Now, with distance measurements from a few more satellites, the receiver can
determine the user's position and display it on the unit's electronic map.
A GPS receiver must be locked on to the signal of at least three satellites to calculate a 2D
position (latitude and longitude) and track movement. With four or more satellites in view, the
receiver can determine the user's 3D position (latitude, longitude and altitude). Once the user's
position has been determined, the GPS unit can calculate other information, such as speed,
bearing, track, trip distance, distance to destination, sunrise and sunset time and more.
6.6.2 Accuracy
Today's GPS receivers are extremely accurate, thanks to their parallel multi-channel design.
Garmin's 12 parallel channel receivers are quick to lock onto satellites when first turned on and
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 90
they maintain strong locks, even in dense foliage or urban settings with tall buildings. Certain
atmospheric factors and other sources of error can affect the accuracy of GPS receivers.
Garmin® GPS receivers are accurate to within 15 meters on average.
Newer Garmin GPS receivers with WAAS (Wide Area Augmentation System) capability
can improve accuracy to less than three meters on average. No additional equipment or fees are
required to take advantage of WAAS. Users can also get better accuracy with Differential GPS
(DGPS), which corrects GPS signals to within an average of three to five meters. The U.S. Coast
Guard operates the most common DGPS correction service. This system consists of a network of
towers that receive GPS signals and transmit a corrected signal by beacon transmitters. In order
to get the corrected signal, users must have a differential beacon receiver and beacon antenna in
addition to their GPS.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 91
6.6.3 The GPS satellite system
The 24 satellites that make up the GPS space segment are orbiting the earth about 12,000
miles above us. They are constantly moving, making two complete orbits in less than 24 hours.
These satellites are travelling at speeds of roughly 7,000 miles an hour.
GPS satellites are powered by solar energy. They have backup batteries onboard to keep
them running in the event of a solar eclipse, when there's no solar power. Small rocket boosters
on each satellite keep them flying in the correct path.
Here are some other interesting facts about the GPS satellites (also called NAVSTAR, the
official U.S. Department of Defense name for GPS):
The first GPS satellite was launched in 1978.
A full constellation of 24 satellites was achieved in 1994.
Each satellite is built to last about 10 years. Replacements are constantly being built and
launched into orbit.
A GPS satellite weighs approximately 2,000 pounds and is about 17 feet across with the
solar panels extended.
Transmitter power is only 50 watts or less.
6.6.4 Frequencies of GPS
GPS satellites transmit two low power radio signals, designated L1 and L2. Civilian GPS
uses the L1 frequency of 1575.42 MHz in the UHF band. The signals travel by line of sight,
meaning they will pass through clouds, glass and plastic but will not go through most solid
objects such as buildings and mountains.
A GPS signal contains three different bits of information - a pseudorandom code,
ephemeris data and almanac data. The pseudorandom code is simply an I.D. code that identifies
which satellite is transmitting information. You can view this number on your Garmin GPS unit's
satellite page, as it identifies which satellites it's receiving.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 92
Ephemeris data, which is constantly transmitted by each satellite, contains important
information about the status of the satellite (healthy or unhealthy), current date and time. This
part of the signal is essential for determining a position.
The almanac data tells the GPS receiver where each GPS satellite should be at any time
throughout the day. Each satellite transmits almanac data showing the orbital information for that
satellite and for every other satellite in the system.
6.6.4.1 Sources of GPS signal errors
Factors that can degrade the GPS signal and thus affect accuracy include the following:
Ionosphere and troposphere delays - The satellite signal slows as it passes through the
atmosphere. The GPS system uses a built-in model that calculates an average amount of
delay to partially correct for this type of error.
Signal multipath - This occurs when the GPS signal is reflected off objects such as tall
buildings or large rock surfaces before it reaches the receiver. This increases the travel
time of the signal, thereby causing errors.
Receiver clock errors - A receiver's built-in clock is not as accurate as the atomic clocks
onboard the GPS satellites. Therefore, it may have very slight timing errors.
Orbital errors - Also known as ephemeris errors, these are inaccuracies of the satellite's
reported location.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 93
Number of satellites visible - The more satellites a GPS receiver can "see," the better the
accuracy. Buildings, terrain, electronic interference, or sometimes even dense foliage can
block signal reception, causing position errors or possibly no position reading at all. GPS
units typically will not work indoors, underwater or underground.
Satellite geometry/shading - This refers to the relative position of the satellites at any
given time. Ideal satellite geometry exists when the satellites are located at wide angles
relative to each other. Poor geometry results when the satellites are located in a line or in
a tight grouping.
Intentional degradation of the satellite signal - Selective Availability (SA) is an intentional
degradation of the signal once imposed by the U.S. Department of Defense. SA was intended to
prevent military adversaries from using the highly accurate GPS signals. The government turned
off SA in May 2000, which significantly improved the accuracy of civilian GPS receivers.
6.7 Applications
The Global Positioning System, while originally a military project, is considered a dual-use
technology, meaning it has significant applications for both the military and the civilian industry.
6.7.1.1 Military
The military applications of GPS span many purposes:
Navigation: GPS allows soldiers to find objectives in the dark or in unfamiliar territory,
and to coordinate the movement of troops and supplies. The GPS-receivers that
commanders and soldiers use are respectively called the Commanders Digital Assistant
and the Soldier Digital Assistant.
Target tracking: Various military weapons systems use GPS to track potential ground and
air targets before they are flagged as hostile. These weapon systems pass GPS co-
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 94
ordinates of targets to precision-guided munitions to allow them to engage the targets
accurately. Military aircraft, particularly those used in air-to-ground roles use GPS to find
targets (for example, gun camera video from AH-1 Cobras in Iraq show GPS co-
ordinates that can be looked up in Google Earth).
Missile and projectile guidance: GPS allows accurate targeting of various military
weapons including ICBMs, cruise missiles and precision-guided munitions. Artillery
projectiles with embedded GPS receivers able to withstand accelerations of 12,000g's or
about 117,600 meters/second2 have been developed for use in 155 mm howitzers.[91]
Search and Rescue: Downed pilots can be located faster if they have a GPS receiver.
Reconnaissance and Map Creation: The military use GPS extensively to aid mapping and
reconnaissance.
The GPS satellites also carry a set of nuclear detonation detectors consisting of an optical
sensor (Y-sensor), an X-ray sensor, a dosimeter, and an electromagnetic pulse (EMP)
sensor (W-sensor) which form a major portion of the United States Nuclear Detonation
Detection System.[92][93]
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 95
7 Software Explanation
A) About Software
Software’s used are:
Keil software for c programming
Express PCB for lay out design
Express SCH for schematic design
What's New in µVision3?
µVision3 adds many new features to the Editor like Text Templates, Quick Function
Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based
startup and debugger setup. µVision3 is fully compatible to µVision2 and can be used in parallel
with µVision2.
What is µVision3?
µVision3 is an IDE (Integrated Development Environment) that helps you write, compile,
and debug embedded programs. It encapsulates the following components:
A project manager.
A make facility.
Tool configuration.
Editor.
A powerful debugger.
To help you get started, several example programs (located in the \C51\Examples, \C251\
Examples, \C166\Examples, and \ARM\...\Examples) are provided.
HELLO is a simple program that prints the string "Hello World" using the Serial
Interface.
MEASURE is a data acquisition system for analog and digital systems.
TRAFFIC is a traffic light controller with the RTX Tiny operating system.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 96
SIEVE is the SIEVE Benchmark.
DHRY is the Dhrystone Benchmark.
WHETS is the Single-Precision Whetstone Benchmark.
Additional example programs not listed here are provided for each device architecture.
Building an Application in µVision2:
To build (compile, assemble, and link) an application in µVision2, you must:
1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2).
2. Select Project - Rebuild all target files or Build target.
µVision2 compiles, assembles, and links the files in your project.
Creating Your Own Application in µVision2:
To create a new project in µVision2, you must:
1. Select Project - New Project.
2. Select a directory and enter the name of the project file.
3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the
Device Database™.
4. Create source files to add to the project.
5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the
source files to the project.
6. Select Project - Options and set the tool options. Note when you select the target device
from the Device Database™ all special options are set automatically. You typically only
need to configure the memory map of your target hardware. Default memory model
settings are optimal for most applications.
7. Select Project - Rebuild all target files or Build target.
Debugging an Application in µVision2:
To debug an application created using µVision2, you must:
1. Select Debug - Start/Stop Debug Session.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 97
2. Use the Step toolbar buttons to single-step through your program. You may enter G,
main in the Output Window to execute to the main C function.
3. Open the Serial Window using the Serial #1 button on the toolbar.
Debug your program using standard options like Step, Go, Break, and so on.
Starting µVision2 and Creating a Project:
µVision2 is a standard Windows application and started by clicking on the program icon.
To create a new project file select from the µVision2 menu
Project – New Project…. This opens a standard Windows dialog that asks you for the new
project file name. We suggest that you use a separate folder for each project. You can simply use
the icon Create New Folder in this dialog to get a new empty folder. Then select this folder and
enter the file name for the new project, i.e. Project1. µVision2 creates a new project file with the
name PROJECT1.UV2 which contains a default target and file group name. You can see these
names in the Project.
Window – Files:
Now use from the menu Project – Select Device for Target and select a CPU for your
project. The Select Device dialog box shows the µVision2 device database. Just select the micro
controller you use. We are using for our examples the Philips 80C51RD+ CPU. This selection
sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool
Configuration.
Building Projects and Creating a HEX Files:
Typical, the tool settings under Options – Target are all you need to start a new
application. You may translate all source files and line the application with a click on the Build
Target toolbar icon. When you build an application with syntax errors, µVision2 will display
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 98
errors and warning messages in the Output Window – Build page. A double click on a message
line opens the source file on the correct location in a µVision2 editor window.
Once you have successfully generated your application you can start debugging.
After you have tested your application, it is required to create an Intel HEX file to
download the software into an EPROM programmer or simulator. µVision2 creates HEX files
with each build process when Create HEX files under Options for Target – Output is enabled.
You may start your PROM programming utility after the make process when you specify the
program under the option Run User Program #1.
CPU Simulation:
µVision2 simulates up to 16 Mbytes of memory from which areas can be mapped for
read, write, or code execution access. The µVision2 simulator traps and reports illegal memory
accesses.
In addition to memory mapping, the simulator also provides support for the integrated
peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have
selected are configured from the Device.
Database selection:
you have made when you create your project target. Refer to page 58 for more
Information about selecting a device. You may select and display the on-chip peripheral
components using the Debug menu. You can also change the aspects of each peripheral using the
controls in the dialog boxes.
Start Debugging:
You start the debug mode of µVision2 with the Debug – Start/Stop Debug Session
command. Depending on the Options for Target – Debug Configuration, µVision2 will load the
application program and run the startup code µVision2 saves the editor screen layout and
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 99
restores the screen layout of the last debug session. If the program execution stops, µVision2
opens an editor window with the source text or shows CPU instructions in the disassembly
window. The next executable statement is marked with a yellow arrow. During debugging, most
editor features are still available.
For example, you can use the find command or correct program errors. Program source
text of your application is shown in the same windows. The µVision2 debug mode differs from
the edit mode in the following aspects:
The “Debug Menu and Debug Commands” described on page 28 are Available. The
additional debug windows are discussed in the following. _ The project structure or tool
parameters cannot be modified. All build Commands are disabled.
Disassembly Window:
The Disassembly window shows your target program as mixed source and assembly
program or just assembly code. A trace history of previously executed instructions may be
displayed with Debug – View Trace Records. To enable the trace history, set Debug –
Enable/Disable Trace Recording.
If you select the Disassembly Window as the active window all program step commands
work on CPU instruction level rather than program source lines. You can select a text line and
set or modify code breakpoints using toolbar buttons or the context menu commands.
You may use the dialog Debug – Inline Assembly… to modify the CPU instructions.
That allows you to correct mistakes or to make temporary changes to the target program you are
debugging.
7.1 Keil Software:
Installing the Keil software on a Windows PC
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 100
Insert the CD-ROM in your computer’s CD drive
On most computers, the CD will “auto run”, and you will see the Keil installation menu.
If the menu does not appear, manually double click on the Setup icon, in the root
directory: you will then see the Keil menu.
On the Keil menu, please select “Install Evaluation Software”. (You will not require a
license number to install this software).
Follow the installation instructions as they appear.
Loading the Projects:
The example projects for this book are NOT loaded automatically when you install the
Keil compiler.
These files are stored on the CD in a directory “/Pont”. The files are arranged by chapter:
for example, the project discussed in Chapter 3 is in the directory “/Pont/Ch03_00-Hello”.
Rather than using the projects on the CD (where changes cannot be saved), please copy
the files from CD onto an appropriate directory on your hard disk.
Note: you will need to change the file properties after copying: file transferred from the CD will
be ‘read only’.
Configuring the Simulator
Open the Keil Vision2
go to Project – Open Project and browse for Hello in Ch03_00 in Pont and open it.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 101
Go to Project – Select Device for Target ‘Target1’
Select 8052(all variants) and click OK
Now we need to check the oscillator frequency:Go to project – Options for Target ‘Target1’
Make sure that the oscillator frequency is 12MHz.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 102
Building the Target
Build the target as illustrated in the figure below
Running the SimulationHaving successfully built the target, we are now ready to start the debug session and run the simulator.First start a debug session
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 103
The flashing LED we will view will be connected to Port 1. We therefore want to observe the
activity on this port
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 104
To ensure that the port activity is visible, we need to start the ‘periodic window update’ flag
Go to Debug - Go
While the simulation is running, view the performance analyzer to check the delay duration
Go to Debug – Performance Analyzer and click on it
Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 105
7.2 SOURCE CODE
TRANSMITTER SECTION
#include<reg51.h>
#include<intrins.h>
#include"uart.h"
sbit en1 = P2^0;
sbit en2 = P2^1;
sbit in1 = P2^2;
sbit in2 = P2^3;
sbit in3 = P2^4;
sbit in4 = P2^5;
sbit CO = P0^2;
sbit FIRE = P0^1;
sbit TEMP = P0^0;
void serial_com (unsigned char value);
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 106
void send_to_serial (unsigned char s[]);
void delay(unsigned int );
unsigned int i;
unsigned char fdetect=0,hb=68,gpsdata[45],a,hc;
sbit ZIGBEE = P3^3;
sbit GPS = P3^2;
void main()
{
unsigned char ch;
UART_init();
st:
ZIGBEE=1;
GPS=0;
delay(200);
while(1)
{
if(FIRE==0)
{
ch='F';
goto xx;
}
if(TEMP==1)
{
ch='T';
goto xx;
}
if(CO==0)
{
ch='C';
goto xx;
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 107
}
}
xx: a=0;
while(a!='$')
{
while(RI==0);
a=SBUF;
RI=0;
}
i=0;
while(i<44)
{
while(RI==0);
gpsdata[i]=SBUF;
RI=0;
i++;
}
if((gpsdata[2]=='R')&&(gpsdata[3]=='M')&&(gpsdata[4]=='C'))
{
goto jag;
}
else
goto xx;
jag:
RI=0;
ZIGBEE=0;
GPS=1;
TR1=0;
delay(500);
ch_send_to_modem(ch);
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 108
send_to_modem("LT: ");
for(i=19;i<30;i++)
ch_send_to_modem(gpsdata[i]);
send_to_modem("LG: ");
for(i=31;i<43;i++)
ch_send_to_modem(gpsdata[i]);
ch_send_to_modem('J');
delay(2000);
goto st;
}
//&&&&&& DELAY PROGRAN &&&&&&&&&&//
void delay(unsigned int value)
{
unsigned int x,y;
for(x=0;x<value;x++)
for(y=0;y<100;y++);
}
RECEIVER SECTION
//@@@@// coalmineRX//@@@@//
#include<reg51.h>
#include"lcddisplay.h"
#include<intrins.h>
sbit m1 = P0^7; //message 1
sbit m2 = P0^6; //message 2
sbit m3 = P0^5; //message 3
sbit buz = P2^0;
void single_char (unsigned char letter);
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 109
void serial_send(unsigned char b[]);
unsigned char REC[40];
unsigned char i;
//**MAIN PROGRAM**//
void main()
{
lcd_init();
delay(200);
lcd_init();
buz=0;
st:
delay(500);
lcdcmd(1);
msgdisplay("WELCOME");
TMOD=0x20; // TIMER VALUES
TH1=0xFD;
SCON=0x50;
TR1=1;
delay(300);
while(RI==0);
REC[0]=SBUF;
RI=0;
i=1;
buz=1;
do
{
while(RI==0);
REC[i++]=SBUF;
RI=0;
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 110
}while(REC[i-1]!='J');
REC[i]='\0';
delay(1);
buz=0;
lcdcmd(0x01);
if(REC[0]=='F')
{
m2=1;
msgdisplay("OVER CO GAS");
m2=0;
}
if(REC[0]=='T')
{
m1=1;,
msgdisplay("OVER TEMPERATURE");
m1=0;
}
if(REC[0]=='C')
{
m3=1;
msgdisplay("FIRE detected!");
m3=0;
}
delay(500);
lcdcmd(0x01);
for(i=1;i<32;i++)
{
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 111
if(i==16)
lcdcmd(0xc0);
lcddata(REC[i]);
}
delay(1500);
RI=0;
goto st;
}
single_char (unsigned char letter)
{
SBUF=letter;
while(TI==0);
TI=0;
}
PROJECT DESCREPTION
In the mines there are levels where miners work. It is a tough task to monitor the conditions
using cables. The aim of the project is to monitor the conditions in each level of coal mines with
RF signals.
The project consists of two circuits .One is transmitter section which is in the coal mines and
other is the receiver section which is on the ground surface.
TRANSMITTER SECTION
It mainly consists of a zigbee which is the major component in this project for RF
communication . Every level of miner section will have a transmitter it consists of a
microcontroller, zigbee, sensors and GPS receiver.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 112
The sensors which is used here is temperature sensor, fire sensor, and gas sensor. They are
interfaced with microcontroller to the port 2. The sensors sense the physical signals and are
converted to electrical signals which are send to microcontroller
The Zigbee is connected to pin 11, of the microcontroller which is received by microcontroller to
the receiver section trough the RF signals. It is purely serial communication.
The GPS receiver will send the details of location to the microcontroller. Every signal reached by
the microcontroller is send to the receiver section.
The voice chip is used to announce the miners if any threats are identified.
RECIEVER SECTION
It is placed at the base station which is on the ground.in this the microcontroller is interfaced
with the Zigbee, LCD screen and port to connect PC.
The data sent by the transmitter section is received by the Zigbee.it is interfaced with max 232 to
the microcontroller.
Therefore the data received will be leveled to the voltage levels of microcontroller and
get processed. The results will be distributed on the LCD screen.We can also monitors or warn
the minors by programming using the PC connected to it.
Dept. of ECE, Hi-Tech college of Engineering and Technology Page 113