-
1
CHAPTER 1
INTRODUCTION
Public transportation is provided by the Government as a public
service, and its service
quality directly impacts on the travel convenience of the
public. As a result, punctual arrival
stations of the buses and accurate reporting stations name are
important tasks. At present,
punctuality of buses can be guaranteed because some employee
monitor the states of buses
operating and adjust the departure time of buses rationally at
the bus start station and bus
terminal. But it is difficult to monitor the punctuality of
buses via the intermediate stations.
The purpose of the project is to develop an Intelligent Bus
management system. Punctual
arrival stations of the buses and accurate reporting stations
name are important tasks. To
solve the question mentioned above, we should obtain the arrival
time of buses at
intermediate stations in time. However, these bus stations are
distributed in whole city,
vehicles are moving from one place to another ceaselessly, the
buses arrival time at
intermediate stations are stochastic. Consequently, the wireless
technology should be applied
in the intelligent public transport management system in order
to monitoring the buses
operation states. Recently, a method is to use GPS system to
monitor the movement of buses,
and then use SMS to send the vehicle location information to the
monitoring center.
However, it is difficult to apply the technology in large scale
because of the higher the cost of
GPS systems. In fact, we need not to care about the movement
process of buses, but
concentrate on the buses arrival time or the departure time at
stations. In addition, the bus
driver report station name by pressing a button at present that
may misguide passengers when
a mistake occurred.
Most bus station follows fixed schedules, and dont uses
intelligent systems for vehicle
tracking and control. Many supervisors are deployed at the
station to control the entrance and
the exit of buses and prepare the trip sheets containing the
schedules manually which is time
consuming and inaccurate. Moreover, transport departments have
no visibility over utilization
of its fleet on real-time, which results in underutilization of
resources. So, all these naturally
results in avoidable stress, costly errors and sub cost optimal
fleet utilization and finally
dissatisfaction and inconvenience to millions of commuters. The
provision of timely and
accurate transit travel time information is so important.
-
2
New technology provide a smart solution managing the bus
schedule in the bus stations
and offering helpful information to passengers. The problems
such as underutilization of
buses fleet and long waiting time at the bus station will be
reduced. So, both passenger and
bus station administrators will benefit from the system as real
time information are provided
1.1 Objectives Of The System
The objectives of the thesis are:
1. To study the various wireless technologies that can be used
for bus management
2. Design a best system for intelligent bus management that
overcomes the
disadvantages of existing systems.
3. Study and implementation of zigbee technology
4. Implementation of Intelligent public transport management
system using zigbee and
GSM/GPRS
1.2 Organization Of The Chapters
The thesis has been organized as follows: Chapter 2 describes
about the existing technologies
for bus management and its drawbacks. Chapter 3 describes the
research method employed.
The structure of the bus management system and the block diagram
explanation of the
subsystems and operation of the system are presented in Chapter
4. The hardware section is
presented in chapter 5. Chapter 6 deals with the protocol stack
and architecture of zigbee.
chapter 7 presents the software section with flowcharts of the
relevant subsystems. The
simulations results are in chapter 8. Chapter 9 concludes the
thesis. More details about GSM
modem,features of ARM and its peripherals,MCB development
board,details of developing
tool and details of zigbee are presented in appendix.
-
3
CHAPTER 2
BACKGROUND INFORMATIN AND LITERATURE SURVEY
Existing wireless identification technologies used for
Intelligent Public Transport
Management include Global Positioning System (GPS) and RFID
based bus management system
2.1 GPS (Global Positioning System)
Global Positioning System (GPS) has three components namely
1. The space segment: consisting of 24 satellites orbiting the
Earth at an altitude of
11000 nautical miles.
2. The user segment: consisting of a receiver, which is mounted
on the unit whose
location has to be determined.
3. The control segment: consists of various ground stations
controlling the satellites.
The system have permitted civilian use of the satellite signals.
Each satellite generates
radio signals that allow a receiver to estimate the distance
between the satellite and the
receiver. The receiver then uses these measurements to calculate
its own location with
reference to Earth in terms of coordinates expressed in latitude
and longitude. Thus the
receiver continuously records its coordinates at given time
intervals. This data, which is
continuously recorded, can be stored in a memory module along
with the receiver, or it can
also be transmitted instantaneously to the central facility. The
former would be an off-line
system and the latter an on-line system.
Fig (2.1) Twenty Four Satellites of GPS
-
4
2.1.1Accuracy Of GPS
GPS has two positioning services:
1. Precise Positioning Service (PPS)
2. Standard Positioning Service (SPS).
PPS is used by authorized users such as U.S. and Allied military
while SPS is used by
civilian users worldwide. The accuracy of PPS was within 22
meters, and the accuracy of
SPS was within 100 meters. To improve the accuracy of SPS, an
additional correction
(differential) signal was added, and is called Differential GPS
(DGPS). The accuracy of
DGPS was better than 10 meters. The SPS accuracy was
dramatically improved when the US
military removed the intentional degradation to the signal.
Currently the accuracy of PPS and
SPS are the same. The current accuracy of GPS is between 10 and
20 meters, and that of
DGPS is between 3 and 5 meters.
2.1.2 Limitations Of GPS System
i. Higher the cost of GPS system
ii. Sometimes the GPS may fail due to certain reasons and in
that case we need to carry a
backup map and directions.
iii. Requires external power supply in case of battery
failure
iv. Sometimes the GPS signals are not accurate due to some
obstacles to the signals such as
buildings, trees and sometimes by extreme atmospheric conditions
such as geomagnetic
storms.
v. The bus driver report station name by pressing a button at
present that may misguide
passengers when a mistake occurred.
2.2 RFID
Radio-frequency identification (RFID) is the use of a wireless
non-contact system that
uses radio-frequency electromagnetic fields to transfer data
from a tag attached to an object,
for the purposes of automatic identification and tracking.
Traditional RFID system consists of three main components
-
5
Fig(2.2) general RFID architecture
1.RFID Reader: sends an electromagnetic wave which carries a
signal to identify objects.
Then, the reader receives the information returned back by these
objects.
2.RFID tag: attached to these objects, reacts to receiving the
signal sent by the reader in
order to forwarding to it the requested information.
3. A computer/database: stores and processes information
collected by the reader.
Traditional RFID readers are imitated in their mobility and
their potential applications they
are usually connected to the host application via a serial port
or via Ethernet.
Some tags require no battery and are powered by the
electromagnetic fields used to read
them. Others use a local power source and emit radio waves
(electromagnetic radiation at
radio frequencies). The tag contains electronically stored
information which can be read from
up to several meters (yards) away. Unlike a bar code, the tag
does not need to be within line
of sight of the reader and may be embedded in the tracked
object.
A radio-frequency identification system uses tags, or labels
attached to the objects to be
identified. Two-way radio transmitter-receivers called
interrogators or readers send a signal
to the tag and read its response. The readers generally transmit
their observations to a
computer system running RFID software or RFID middleware.
The tag's information is stored electronically in a non-volatile
memory. The RFID tag
includes a small RF transmitter and receiver. An RFID reader
transmits an encoded radio
signal to interrogate the tag. The tag receives the message and
responds with its identification
information. This may be only a unique tag serial number, or may
be product-related
information such as a stock number, lot or batch number,
production date, or other specific
information.
-
6
RFID tags can be either passive, active or battery assisted
passive. An active tag has an
on-board battery and periodically transmits its ID signal. A
battery assisted passive (BAP)
has a small battery on board and is activated when in the
presence of a RFID reader. A
passive tag is cheaper and smaller because it has no battery.
Instead, the tag uses the radio
energy transmitted by the reader as its energy source. The
interrogator must be close for RF
field to be strong enough to transfer sufficient power to the
tag. Since tags have individual
serial numbers, the RFID system design can discriminate several
tags that might be within the
range of the RFID reader and read them simultaneously.
Figure(2.3) Schematic Representation of RFID Technology
Tags may either be read-only, having a factory-assigned serial
number that is used as a
key into a database, or may be read/write, where object-specific
data can be written into the
tag by the system user. Field programmable tags may be
write-once, read-multiple; "blank"
tags may be written with an electronic product code by the user.
RFID tags contain at least
two parts: an integrated circuit for storing and processing
information, modulating and
demodulating a radio-frequency (RF) signal, collecting DC power
from the incident reader
signal, and other specialized functions; and an antenna for
receiving and transmitting the
signal. Fixed readers are set up to create a specific
interrogation zone which can be tightly
controlled. This allows a highly defined reading area for when
tags go in and out of the
interrogation zone. Mobile readers may be hand-held or mounted
on carts or vehicles.
-
7
2.2.1Disadvantages Of RFID System
(i) Though it is very beneficial, it quite is expensive to
install.
(ii) It is difficult for an RFID reader to read the information
in case of RFID tags installed in
liquids and metal products. The problem is that the liquid and
metal surfaces tend to reflect
the radio waves, which makes the tags unreadable.
(iii) Interference has been observed if devices such as
forklifts and walkies-talkies are in the
vicinity of the distribution centres. The presence of mobile
phone towers has been found to
interfere with RFID radio waves.
Thereby we develop an Intelligent Traffic Management System
based on Zigbee and
GSM/GPRS in order to solve these disadvantages of GPS and RFID
systems.
-
8
CHAPTER 3
RESEARCH METHOD
The main idea of our research is to integrate Zigbee technology
and GSM to build an
intelligent bus tracking system. Two scenarios of integration
have been implemented. In the
first one, we have extended the read range of the Zigbee system
by adding wireless facility to
Zigbee readers. Each Zigbee reader is equipped with a wireless
module which can transmit
data to and from the reader. Zigbee reader acts as sensor node:
it reads the identification of an
object and sends it to the host application via an ad-hoc
network. The second scenario of
integration provides Zigbee readers with sensing ability.
Several motion sensors are installed
near each reader to detect the presence of a tagged object and
to command the reader activity.
This approach is tested through an application which can track
buses traffic in the bus
station. Here we interface Zigbee with the GSM module. When
designing this system, the
following constraints have been considered:
Modularity and expandability constraints: the system must be
modular in design. Both
hardware and software should be divided into small components or
modules to ensure
easy scalability for further feature expansions. Modules must be
produced independently
from each other, so that changes or the crash of one module
cannot affect the other ones.
Economic constraint: We should take into account performance to
cost ratio so as to
design a cost-effective solution.
Environmental constraint: In our design and implementation, we
should keep in mind the
Impact on environment. Low power consumption devices should be
used to keep
the power of the system very low. Energy optimization should be
involved in all the
designs steps.
-
9
CHAPTER 4
SYSTEM STRUCTURE
The system we designed comprises of the electronic
boards at stations,
the wireless identifier installed in buses
the monitoring software operated in PC.
Fig(4) structure of bus management system
The electronic modules used in the project is,
XBee/XBee PRO RF Modules
XBee End device
XBee Cordinator
ARM Microcontroller ARM 7 Microcontroller board
GSM/GPRS Modem
And finally the server with database.
-
10
Block Diagrams
The two main subsystems are wireless identifier & station
monitor. The block diagrams
are shown below:
4.1 Block Diagram Of Wireless Identifier
Fig(4.1) block diagram of wireless identifier
The function of the zigee end device installed in bus is to
communicate with the zigbee
coordinator of the station monitor. The end device has a unique
ID and it respond to the RF
signals from the zigbee coordinator.
Zigbee device and LCD is interfaced through the ARM
microcontroller.
LCD display helps the passengers by displaying the bus route and
by displaying the
station name automatically when the bus enters the station.
4.2 Block Diagram Of Station Monitor
Fig(4.2) block diagram of station monitor
Zigbee coordinator communicate with the zigbee end device. It
tracks the bus and sends
the corresponding information to the bus server.
The controller used in the station is the ARM7TDMI family32 bit
microcontroller.it is
serially interfaced with the zigbee coordinator.
GSM module is used for the messaging purpose.the relevant
informations such as bus ID,
arrival time and leaving time of bus from the station are send
to the main server.
Zigbee end device ARM
microcontroller
LCD display
Zigbee
coordinator
ARM
microcontroller
GSM/GPRS
module
LCD display
-
11
LCD display of the station monitor displays the bus ID,route and
bus arrival time and
leaving time.
4.3 Operation Of The System
To monitor the runing of buses and improving the punctuality of
buses at intermediate
stations, we shoud obtain the accurate arrival time, and send
this information to the
company's monitoring center. So, we need not to use the
expensive GPS sytem to positioning
their locations. Here, we combine the technology of ZigBee with
GSM/GPRS to monitor the
arrival or departure time of buses at stations and report bus
stations automatically.
The electronic board of each bus station consists of a station
monitor, GSM
communication module and the LCD display. Here, the station
monitor is a ZigBee
coordinator which can accept the request from other ZigBee
devices to join the network, and
can identify every device configured with ID.
At the same time, we install the wireless identifier device in
every bus. When the system
is operating, the station monitor transmit beacon frame
continuously. The wireless identifier
in buses can receive the beacon frame which include relevant
information about this bus
station, when buses approach the station. Then the bus can
report the station name
automatically. Meanwhile, it send itself information to the
station monitor, and the monitor
obtain the information about bus ID , arrival time and the
license plate number of bus. Those
information can be transmitted back the company's monitoring
center by GSM/GPRS system.
After the bus depart from the station, the station monitor also
transmit the message-----"XX
bus has left the station" to the center. At the same time, the
center send this message to next
station's electronic board and display "XX bus has left YY
station, arriving this station at ZZ
time" on the LCD. That can provide convenience for passengers
waiting. The monitoring
centre can be in control of the operation of each bus accurately
to guarantee its punctuality.
ZigBee's effective operating range is only tens of meters, and
it can estimate the distance
between the vehicle and the platform according to the signal
strength. As a result, the monitor
can be aware of the bus arrival only when the bus reaches near
the station. In addition, the
system can also operate smoothly when many buses approach the
same station, because
ZigBee coordinator allow ZigBee devices to connect with it. The
whole system's cost is very
low because it has a few of station monitors and low cost
wireless identifiers.
-
12
CHAPTER 5
THE HARDWARE DESIGN
Hardware design of the station monitor.
1. The STATION MONITOR consist of,
i. Microcontroller unit (ARM7 )
ii. XBee Coordinator Module
iii. GSM/GPRS module
Same modules are used for each station
The wireless identifier and station monitor comprises of XBee
module. Of the XBee
module, one is XBee coordinator and other is XBee end device
which is located in bus
(Wireless Identifier)
The XBee coordinator is interfaced to the microcontroller
through serial interface, the
XBee information is extracted in the microcontroller, it is
manipulated there in accordance
with the format and the corresponding data ie, the bus
information and the station information
is sent to the main server through GSM/GPRS module.
Similarly, information from the server about the bus arrival is
also send to corresponding
bus station and the arrival time is also displayed on the LCD
panel for information of bus
travellers.
5.1 Microcontroller
ARM Microcontroller used in the station is ARM7TDMI family
32-bit microcontroller
LPC2388 which offers high performance and very low power
consumption. The ARM
architecture is based on Reduced Instruction Set Computer (RISC)
principle and results in a
high instruction throughput and impressive real-time interrupt
response from a small and cost
effective processor core. Pipeline techniques are employed so
that all parts of the processing
and memory systems can operate continuously. Typically, while
one instruction is being
executed, its successor is being decoded and a third instruction
is being fetched from
memory. In this project ARM microcontroller is serially
interfaced with zigbee module and
GSM module.
-
13
5.2)Xbee Coordinator Module
The coordinator is the most capable device that maintains the
overall network knowledge.
It forms the root of the network tree and might bridge to other
networks. It is the coordinator
which tracks the bus and send the corresponding information to
the bus server. Physical layer
provide the information of link quality which can determine the
distance between a receiver
and a sender. The communication distance is usally about tens of
meters.
At present, many manufacturers developed the design platform for
ZigBee technology. In
this project we are using the Zigbee solution provided by
Maxstream XBee/XBee PRO
OEM RF Modules 802.15.4.The XBee and XBee-PRO OEM RF Modules
were engineered
to meet IEEE 802.15.4 standards and support the unique needs of
low-cost, low-power
wireless sensor networks. The modules require minimal power and
provide reliable delivery
of data between devices. The modules operate within the ISM 2.4
GHz frequency band and
are pin-for-pin compatible with each other.
It utilizes direct-sequence spread spectrum modulation and
operates on a fixed channel. A
total of 27 channels numbered 0 to 26 are available per channel
page. As a result, the
flexibility of ZigBee application can be improved greatly
because several different ZigBee
networks in the same area can coexist with each other by
selecting different channels.
Comparing with other network technology, the protocol stack of
ZigBee network is more
simple and only 32KB flash memory consumption
UART Data Flow
Zigbee module is connected to the microcontroller by the serial
interface.Serial Data
Devices that have a UART interface can connect directly to the
pins of the RF module as
shown in the figure below.
-
14
Fig(5.1). System Data Flow Diagram in a UARTinterfaced
environment (Lowasserted signals distinguished
with horizontal line over signal name.)
Data enters the module UART through the DI pin as an
asynchronous serial signal. The
signal should idle high when no data is being transmitted. Each
data byte consists of a start
bit (low), 8 data bits (least significant bit first) and a stop
bit (high).
5.3)Gsm Modem
GSM stands for Global System for Mobile Communication and is an
open, digital cellular
technology used for transmitting mobile voice and data
services.The GSM Modem is the part
responsible for communication ie, here messaging purpose. GSM is
a digital wireless
network standard. It provides a common set of compatible
services and capabilities to all
GSM mobile users. The services and security features to
subscribers are subscriber identity
confidentiality, subscriber identity authentication, user data
confidentiality on physical
connections, connectionless user data confidentiality and
signalling information element
confidentiality.
A GSM modem is a specialized type of modem which accepts a SIM
card, and operates
over a subscription to a mobile operator, just like a mobile
phone. From the mobile operator
perspective, a GSM modem looks just like a mobile phone. When a
GSM modem is
connected to a computer, this allows the computer to use the GSM
modem to communicate
over the mobile network. While these GSM modems are most
frequently used to provide
mobile internet connectivity, many of them can also be used for
sending and receiving SMS
and MMS messages. A GSM modem can be a dedicated modem device
with a serial, USB or
-
15
Bluetooth connection, or it can be a mobile phone that provides
GSM modem capabilities.
The GSM is a circuit-switched system that divides each 200kHz
channel into eight 25kHz
time-slots. GSM operates in the 900MHz and 1.8GHz bands in
Europe and the 1.9GHz and
850MHz bands in the US. The GSM makes use of narrowband Time
Division Multiple
Access (TDMA) technique for transmitting signals.
Fig(5.2)GSM Modem
Advantages Of Gsm
Improved spectrum efficiency
International roaming
Low-cost mobile sets and base stations (BSs)
High-quality speech
Compatibility with Integrated Services Digital Network (ISDN)
and other telephone
company services
Support for new services
5.4 Wireless Identifier
This unit as stated above is powered from the bus and carries
limited functionality for
lowering the cost and complexity of the system. The device has
just enough functionality to
talk to its parent node ie, the coordinator. There is no problem
for power supply because the
monitor installated in station. However, in case of power supply
failed, we should take the
capacity of rechargeable battery into account carefully, since
GSM/GPRS module would
consume energy a lot. In addition, we should solve the problem
of the RF interference
-
16
between GPRS module and ZigBee device in the hardware. The
structure of wireless
identifier circuit equipped in bus is really simple.
Figure(5.3) Wireless Identifier in bus
5.5 Server
This part is entirely software which can be developed using JAVA
technology. This
requires a database connection which can be ORACLE. The server
also requires a
GSM/GPRS connection through which data send by the station
monitor is extracted and
corresponding checking of information is done using the
database. Then the next location of
corresponding bus is obtained and information is sent to next
location
-
17
CHAPTER 6
ZIGBEE
ZigBee is a specification for a suite of high level
communication protocols using small,
low-power digital radios based on an IEEE 802 standard for
personal area networks. ZigBee
devices are often used in mesh network form to transmit data
over longer distances, passing
data through intermediate devices to reach more distant ones.
This allows ZigBee networks to
be formed ad-hoc, with no centralized control or high-power
transmitter/receiver able to
reach all of the devices. Any ZigBee device can be tasked with
running the network.
Fig (6.1)zigbee module
ZigBee is targeted at applications that require a low data rate,
long battery life, and secure
networking. ZigBee has a defined rate of 250 kbit/s, best suited
for periodic or intermittent
data or a single signal transmission from a sensor or input
device. Applications include
wireless light switches, electrical meters with
in-home-displays, traffic management systems,
and other consumer and industrial equipment that requires
short-range wireless transfer of
data at relatively low rates. The technology defined by the
ZigBee specification is intended to
be simpler and less expensive than other WPANs, such as
Bluetooth.
A coordinator in ZigBee network can be used to initiate,
terminate, or route
communication around the network. The coordinator is the primary
controller of the network.
ZigBee devices can also apply to join or leave the network.
Physical layer provide the
-
18
information of link quality which can determine the distance
between a receiver and a sender.
The communication distance is usually about tens of meters. To
monitoring the running of
buses and improving the punctuality of buses at intermediate
stations, we should obtain the
accurate arrival time, and send this information to the
company's monitoring centre. Note
that, our concern here is the time of the bus arriving the
stations; we are not interesting in
their position and their travel time between stations. So, we
need not to use the expensive
GPS system to positioning their locations. Here, we combine the
technology of ZigBee with
GSM/GPRS to monitor the arrival or departure time of buses at
stations and report bus
stations automatically.
6.1 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 ZigBee protocols support beacon and
non-beacon enabled
networks.
Fig(6.2)zigbee protocol stack
In non-beacon-enabled networks, 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
-
19
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 15 life. Beacon
intervals depend on data rate; they may range from 15.36
milliseconds to 251.65824 seconds
at 250 kbit/s, from 24 milliseconds to 393.216 seconds at 40
kbit/s and from 48
millisecondsto 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 .
6.2 ZIGBEE/IEEE 802.15.4 General Characteristics
1) Dual PHY (2.4GHz and 868/915 MHz) , Data rates of 250 kbps
(@2.4 GHz), 40 kbps
(@ 915 MHz), and 20 kbps (@868 MHz) , Optimized for low
duty-cycle applications
(
-
20
6.3 Zigbee Network And Architecture
The Co-ordinator is responsible for starting a ZigBee network.
Network initialization
involves the following steps:
1. Search for a Radio Channel-The Co-ordinator first searches
for a suitable radio
channel (usually the one which has least activity). This search
can be limited to those
channels that are known to be usable - for example, by avoiding
frequencies in which
it is known that a wireless LAN is operating.
2. Assign PAN ID- The Co-ordinator starts the network, assigning
a PAN ID (Personal
Area Network identifier) to the network. The PAN ID can be
pre-determined, or can
be obtained dynamically by detecting other networks operating in
the same frequency
channel and choosing a PAN ID that does not conflict with
theirs.At this stage, the
Co-ordinator also assigns a network (short) address to itself.
Usually, this is the
address 0x0000.
3. Start the Network- The Co-ordinator then finishes configuring
itself and starts itself in
Co-ordinator mode. It is then ready to respond to queries from
other devices that wish
to join the network.
Fig(6.3) Layered Architecture of Zigbee
-
21
6.4 Forming A Zigbee 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 sub layer, 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
masterkey 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.
Key distribution is one of the most important security functions
of the network. A secure
network will designate one special device which other devices
trust for the distribution of
security keys: the trust center. Ideally, devices will have the
trust center address and initial
master key preloaded; if a momentary vulnerability is allowed,
it will be
sent as described above. Typical applications without special
security needs will use a
network key provided by the trust center (through the initially
insecure channel) to
communicate.
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:
1) The MAC sub layer is capable of single-hop reliable
communications. As a rule, the
security level it is to use is specified by the upper
layers.
2) 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.
3) 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 change
in devices within it, which may originate in the devices
themselves (for instance, a
-
22
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. The
security levels
infrastructure is based on CCM*, which adds encryption- and
integrity-only features
to CCM.
-
23
CHAPTER 7
SOFTWARE DESIGN
The system software includes the application software and the
ZigBee protocol
software. Two development methods are provided by TI
corporation. One is only a simple
application which takes advantage of MAC layer operation
supported by IEEE802.15.4
hardware. Another is a complete ZigBee implementation which
includes the function of
network layer and application layer. The API functions of
physical layer and MAC layer are
provided by those schemes. We only call those functions when
implement the ZigBee
protocol stack. TI corporation offer some design examples in
datasheet which can help to
implement our application design.
The software that can run on a simple multi-tasking operating
systems, various tasks are
scheduled by the operating system to complete the specific
application. Each task has two C
language function, one is the initialization function, another
is the event handle fuction. Most
applications can be extended by modifying source code of these
examples. There are two
modification methods,adding a new task or increasing an event in
the existing task. In order
to avoiding the collision between an existing event and a new
event, we should think before
doing that carefully. In addition, this operating system is
non-preemptive but order
scheduling, so the time of handling an event should not be taken
up too much. We implement
our design by increasing a new event in a task.
The station monitor itself is a ZigBee network coordinator which
configured with a
GSM module. When we tum on the device power supply, the GSM/GPRS
module and
ZigBee protocol stack would be initialized by MCV. Then the
station monitor can use a
channel scan to measure the energy on the channel. Before
starting a new network, the results
of a channel scan can be used to select an appropriate logical
channel and channel page, as
well as the network identifier that is not being used by any
other network in the area. The
superframe is bounded by network beacons sent by the ZigBee
coordinator and then waiting
for the connection requestes from ZigBee devices. The
coordinator should first confirm their
validity when it receives the connection requestes from ZigBee
devices to join the network,
and then send the connection permission command. Once the
connection established, the
station monitor can obtain the device identifier and register it
in the list. At the same time, the
monitor send the message "XX bus YY clock arrive ZZ station" to
monitoring center. Of
-
24
course, the station monitor allow a lot of devices to connect
with it at one time and register
them in the list. When monitor receives the disconnection
request from a bus, itdelete the bus
information from the list, and then send the message "XX bus
leave YY station". The flow
chart of station monitor is as follows:
Fig(7.1) flowchart of station monitor
The wireless identifier installed in the bus is a ZigBee device
too. When power supply is
on, the ZigBee protocol stack is initialized, then the wireless
idetifier begin to scan channel
GSM init
Zigbee init
Init PAN
Connect
request?
Valid
request
Register the bus
connect
Send msg with GSM/GPRS
Disconn
ect
request?
Disconnect
Delete registered bus
Begin
Begin
-
25
and look for a ZigBee coordinator. After detecting the
superframe which is transmitted by the
coordinator, the identifier requestes to communicate with the
coordinator. The Flow chart of
wireless idetifier is as follows:
no
yes
no
yes
Fig(7.2) Flowchart Of Wireless Identifier
When the connection is established, it would obtain
theinformation about the station
monitor. Meanwhile, it can report the name of the bus station
automatically. Once the bus
depart from the station, the signal strength is low than a
certain level, the bus send the
disconnection request to the station monitor
Begin
Zigbee init
Found a
cooperat
or?
Request connect
Report station
RSSI
value is low?
Disconnect
-
26
CHAPTER 8
SIMULATION RESULTS
Step I: The code is opened in Keil Microvision IDE and the
following operations are done:
Translate Current File
Built Target
Start/Stop Debug Session
Run
fig(8.1)simulation result 1
-
27
Step II: the zigbee coordinator sending beacon frames containing
the information about
station that is displayed in the bus when the zigbee end device
is detected.
In the figure below EKLM is the station name transmitted.
Fig 8.2: Simulation ResultII
-
28
Step III: When any Zigbee end device comes in the range of the
beacon frame transmitted by the
zigbee coordinator, it receives the frame and send request to
the station or the zigbee coordinator
to establish connection. Here the beacon frame EKLM is given as
input into the UART#1windo
of ARM microcontroller associated with the bus.
Fig( 8.3): Simulation ResultIII
-
29
Step IV: 10-bit ID of the wireless bus identifier stored in the
program is given as input to
UART #2 window in the format CTRL +Enter, 10-bit unique ID,
Enter
Fig (8.4): Simulation ResultIV
Current station name, 3-bit bus ID and route of the bus is
displayed in the LCD of Keil
software and 3-bit bus ID, current station name and bus entering
time is displayed in the UART
#1 window.
-
30
Step V: Bus leaving is programmed in the code as an Interrupt.
So pin 2.10 of General Purpose Input/Output
(GPIO 2) Interrupts is activated.
Fig( 8.5): Simulation ResultV
3-bit bus ID, current station name and bus leaving time is
displayed in the UART #1 window.
-
31
CHAPTER 9
CONCLUSIONS
In accordance with the situation of the public
transportmanagement system at present, we
design a new intelligent bus monitor and management system by
using ZigBeetechnology
and GSM/GPRS technology. It can improve the quality of the
public transport service
effectively. Its low cost is easy to accept by many public
transport Corporation.
ZigBee's effective operating range is only tens of meters, and
it can estimate the distance
between the vehicle and the platform according to the signal
strength. As a result, the monitor
can be aware of the bus arrival only when the bus near the
station. In addition, the system can
also operate smoothly when many buses approach the same station,
because a ZigBee
coordinator allow ZigBee devices to connect with it. The whole
system's cost is very low
because it has a few of station monitors and low cost wireless
identifiers.
-
32
APPENDIX
GSM MODEM
GSM Modem Product, provides full functional capability to Serial
devices to send SMS
and Data over GSM Network. The product is available as Board
Level or enclosed in Metal
Box. The Board Level product can be integrated in to Various
Serial devices in providing
them SMS and Data capability and the unit housed in a Metal
Enclosure can be kept outside
to provide serial port connection. The GSM Modem supports
popular "AT" command set so
that users can develop applications quickly. The product has SIM
Card holder to which
activated SIM card is inserted for normal use. The power to this
unit can be given from UPS
to provide uninterrupted operation. This product provides great
feasibility for Devices in
remote location to stay connected which otherwise would not have
been possible where
telephone lines do not exist.
TO TEST GSM MODEM CONNECTIVITY USING HYPER TERMINAL
Select a suitable GSM Modem. Here Pulraj GSM is selected.
Understand the AT Command set required to communicate with the
modem.
-
33
Connect the modem to the computer according to the setup guide
specified in the
manual provided with the GSM modem.
Put a valid SIM card into the mobile phone or GSM/GPRS
modem.
Connect the mobile phone or GSM/GPRS modem to a computer, and
set up the
corresponding wireless modem driver.
Run the MS HyperTerminal by selecting Start -> Programs ->
Accessories ->
Communications -> HyperTerminal.
In the Connection Description dialog box, enter a name and
choose an icon for the
connection. Then click the OK button.
In the Connect To dialog box, choose the COM port that mobile
phone or
GSM/GPRS modem is connecting to in the Connect using combo box.
For example,
choose COM1 if the mobile phone or GSM/GPRS modem is connecting
to the COM1
port. Then click the OK button.
The Properties dialog box comes out. Enter the correct port
settings for the mobile
phone or GSM/GPRS modem. Then click the OK button.
Type "AT" in the main window. A response "OK" should be returned
from the mobile
phone or GSM/GPRS modem.
If OK returns, it means your mobile phone or GSM/GPRS modem is
connected
successfully.
AT COMMANDS
AT commands are instructions used to control a modem. AT is the
abbreviation of
ATtention. Every command line starts with "AT" or "at". That's
why modem commands are
called AT commands. There are two types of AT commands:
(i) Basic commands are AT commands that do not start with a "+".
For example,
D (Dial), A (Answer), H (Hook control), and O (Return to online
data state) are
the basic commands.
(ii) Extended commands are AT commands that start with a "+".
All GSM AT
commands are extended commands. For example, +CMGS (Send SMS
message),
+CMGL (List SMS messages), and +CMGR (Read SMS messages) are
extended
commands.
-
34
For sending SMS in text Mode:
AT+CMGF=1 press enter
AT+CMGS=mobile number press enter
Once The AT commands is given > prompt will be displayed on
the screen. Type the
message to sent via SMS. After this, press ctrl+Z to send the
SMS. If the SMS sending is
successful, ok will be displayed along with the message
number.
For reading SMS in the text mode:
AT+CMGF=1 Press enter
AT+CMGR= no.
Number (no.) is the message index number stored in the sim card.
For new SMS, URC
will be received on the screen as +CMTI: SM no. Use this number
in the AT+CMGR
number to read the message.
Application areas
Mobile Transport vehicles.
LAN based SMS server
Alarm notification of critical events including Servers
Network Monitoring and SMS reporting
Data Transfer applications from remote locations
Monitor and control of Serial services through GSM Network
Dispatch notification through SMS.
AMR- Automatic Meter Reading
GSM
Global System for Mobile Communications, originally Groupe
Spcial Mobile, is a
standard set developed by the European Telecommunications
Standards Institute (ETSI) to
describe protocols for second generation (2G) digital cellular
networks used by mobile
phones.
-
35
Network structure
The structure of a GSM network
The network is structured into a number of discrete
sections:
The Base Station Subsystem (the base stations and their
controllers).
The Network and Switching Subsystem (the part of the network
most similar to a
fixed network). This is sometimes also just called the core
network.
The GPRS Core Network (the optional part which allows packet
based Internet
connections).
The Operations support system (OSS) for maintenance of the
network.
GSM carrier frequencies
GSM networks operate in a number of different carrier frequency
ranges (separated into
GSM frequency ranges for 2G and UMTS frequency bands for 3G),
with most 2G GSM
networks operating in the 900 MHz or 1800 MHz bands. In rare
cases the 400 and 450 MHz
frequency bands are assigned in some countries because they were
previously used for first-
generation systems. Most 3G networks in Europe operate in the
2100 MHz frequency band.
Regardless of the frequency selected by an operator, it is
divided into time slots for
individual phones to use. This allows eight full-rate or sixteen
half-rate speech channels per
radio frequency. These eight radio timeslots (or eight burst
periods) are grouped into a
TDMA frame. Half rate channels use alternate frames in the same
timeslot. The channel data
rate for all 8 channels is 270.833 kbit/s, and the frame
duration is 4.615 ms.The transmission
power in the handset is limited to a maximum of 2 watts in GSM
850/900 and 1 watt in GSM
1800/1900.
ADVANTAGES
Improved spectrum efficiency
International roaming
Low-cost mobile sets and base stations (BSs)
High-quality speech
Compatibility with Integrated Services Digital Network (ISDN)
and other telephone
company services
-
36
ZIGBEE TECHNOLOGY
ZigBee is a specification for a suite of high level
communication protocols using small,
low-power digital radios based on an IEEE 802 standard for
personal area networks. ZigBee
devices are often used in mesh network form to transmit data
over longer distances, passing
data through intermediate devices to reach more distant ones.
This allows ZigBee networks to
be formed ad-hoc, with no centralized control or high-power
transmitter/receiver able to
reach all of the devices. Any ZigBee device can be tasked with
running the network.
Device Types
Zigbee devices are of three types:
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
stores information about the network, including acting as the
Trust Center &
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.
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 .
-
37
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
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). End devices will simply respond with the
requested address, while a
network coordinator or a router will also send the addresses of
all the devices associated with
it.
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 16 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.
-
38
Advantages Of Zigbee
Zigbee is poised to become the global control/sensor network
standard. It has been
designed to provide the following features:
(1)Low power consumption, simply implemented.
(1) Users expect batteries to last many months to years.Consider
that a typical single
family house has about 6 smoke/CO detectors. If the batteries
for each one only
lasted six months, the home owner would be replacing batteries
every month.
(2) Bluetooth has many different modes and states depending upon
your latency and
power requirements such as sniff, park, hold, active, etc.;
ZigBee/IEEE 802.15.4 has
active (transmit/receive) or sleep. Application software needs
to focus on the
application, not on which power mode is optimum for each aspect
of operation.
(3) Low cost (device, installation, maintenance)
(4) Low cost to the users means low device cost, low
installation cost and low
maintenance. ZigBee devices allow batteries to last up to years
using primary cells
(low cost) without any chargers (low cost and easy
installation). ZigBees simplicity
allows for inherent configuration and redundancy of network
devices provides low
maintenance.
(5) High density of nodes per network ZigBees use of the IEEE
802.15.4 PHY and MAC
allows networks to handle any number of devices. This attribute
is critical for
massive sensor arrays and control networks.
(6) Simple protocol, global implementation
(7) ZigBees protocol code stack is estimated to be about 1/4th
of Bluetooths or 802.11s.
(8) Simplicity is essential to cost, interoperability, and
maintenance. The IEEE 802.15.4
PHY adopted by ZigBee has been designed for the 868 MHz band in
Europe, the 915
MHz band in N America, Australia, etc; and the 2.4 GHz band is
now recognized to
be a global band accepted in almost all countries.
-
39
ARM
The ARM7TDMI core is a member of the ARM family of
general-purpose 32-bit
microprocessors. The ARM family offers high performance for very
low power consumption,
and small size. The ARM architecture is based on Reduced
Instruction Set Computer (RISC)
principles. The RISC(software) instruction set and related
decode mechanism are much
simpler than those of Complex Instruction Set Computer (CISC)
designs. This simplicity
gives:
a high instruction throughput
an excellent real-time interrupt response
a small, cost-effective, processor macro cell
LPC2364/6/8/78 is an ARM-based microcontroller for applications
requiring serial
communications for a variety of purposes. These microcontrollers
incorporate a 10/100
Ethernet MAC, USB 2.0 Full Speed interface, four UARTs, two CAN
channels, an SPI
interface, two Synchronous Serial Ports (SSP), three I2C
interfaces
Features
ARM7TDMI-S processor, running at up to 72 MHz.
Up to 512 kB on-chip Flash Program Memory
Up to 32 kB of SRAM on the ARM local bus for high performance
CPU access.
16 kB Static RAM for Ethernet interface. Can also be used as
general purpose SRAM.
8 kB Static RAM for USB interface. Can also be used as general
purpose SRAM.
Dual AHB system that provides for simultaneous Ethernet DMA, USB
DMA, and
program execution from on-chip Flash with no contention between
those
functions.
External memory controller that supports static devices such as
Flash and SRAM. An
8-bit data/16-bit address parallel bus is available in LPC2378
only.
Advanced Vectored Interrupt Controller, supporting up to 32
vectored interrupts.
Serial Interfaces
Ethernet MAC with associated DMA controller. These functions
reside on an
independent AHB bus.
USB 2.0 Device with on-chip PHY and associated DMA
controller.
Four UARTs with fractional baud rate generation, one with modem
control I/O, one
-
40
with IrDA support, all with FIFO. These reside on the APB
bus.
Two CAN channels with Acceptance Filter/FullCAN mode, Three I2C,
SPI controller
are reside on the APB bus.
Secure Digital (SD) / MultiMediaCard (MMC) memory card
interface.
Up to 70 (LPC2364/6/8) or 104 (LPC2378) general purpose I/O
pins.
10 bit A/D converter with input multiplexing among 6 pins
(LPC2364/66/68) or 8
pins LPC2378).
10 bit D/A converter.
Four general purpose Timers with two capture inputs each and up
to four compare
output pins each. Each Timer block has an external count
input.
Real Time Clock with separate power pin, clock source can be the
RTC oscillator or
the APB clock.
2 kB Static RAM powered from the RTC power pin, allowing data to
be stored when
the rest of the chip is powered off.
Watchdog Timer. The watchdog timer can be clocked from the
internal RC oscillator,
the RTC oscillator, or the APB clock.
Standard ARM Test/Debug interface for compatibility with
existing tools.
Emulation Trace Module
Single 3.3 V power supply (3.0 V to 3.6 V).
Four reduced power modes: Idle, Sleep, Power Down, and Deep
Power down.
Four external interrupt inputs. .
On-chip Power On Reset.
On-chip crystal oscillator with an operating range of 1 MHz to
24 MHz.
MCB 2300
The connectors on the evaluation board provide easy access to
many of the on-chip
peripherals.
Block Diagram
The hardware block diagram displays input, configuration, power
system, and User I/O
on the board. This visual presentation helps you to understand
the MCB2300 board
components.
-
41
MCB 2300 Development board
-
42
(1) USB 2.0 Full Speed Interface
Standard USB connectors for USB Device, USB Host and UART via
USB on the MCB2300
board for applications requiring USB communications.
(2) LCD Display
A 2-line by 16-character, 8-bit LCD display. You may use this
text display device to show
real-time debug and program status messages
(1) SD Card
(2) Power LED
(5) JTAG Download and Debug
A JTAG interface is on the MCB2300 board and, coupled with the
ULINK USB-JTAG
adapter, allows flash programming. The on-chip debug interface
can perform real-time in-
circuit emulation of the LPC2300 device. For fast PC
communication, use your PC's USB
port.
(6) & (7) Dual Serial Ports
Standard DB9 connectors are on the MCB2300 for both of the
LPC2300's serial ports
COM1 & COM2
(8) Potentiometer
An adjustable analog voltage source is on the MCB2300 board for
testing the Analog to
Digital output feature of the LPC2300. A configuration jumper
enables and disables this
feature
(9) Reset: To reset the processor
(10) INT0:To enable external interrupt
(11) Configuration Jumpers: To enable or disable certain
features
(12) Processor: LPC 2388
(13) Prototyping area
(14) LF Amplifier
An LF Amplifier on the MCB2300 connects the D/A output of the
LPC2300 device to a
speaker & use this LF Amplifier to generate sound.
-
43
(15) configuration jumper for LF amplifier
(16) & (17) Dual CAN Ports
Standard DB9 connectors are on the MCB2300 board for
applications requiring CAN
communications .Application may use either or both of these
ports, or they may be disabled
with a configuration jumper.
(18) configuration jumper for USB
(19) Host USB
(21) Power USB
Applications
Industrial control
Medical systems
User Peripherals
(1)General Purpose I/O
The LPC23xx has up to five General purpose IO ports which each
contain 32 IO lines
giving a maximum of 160 pins..PORT0 and PORT2 can generate an
interrupt when there is a
rising or falling edge on an individual pin.
Fast IO Registers
To maintain compatibility with the earlier LPC21xx devices PORT0
and PORT1 have
aset of control registers on the APB bus. But controlling these
two ports by these registers is
quite slow. The LPC23xx family has a second set of GPIO control
registers located on the
local bus called the Fast GPIO control registers. On reset the
pin connect block configures all
the peripheral pins to be general purpose I/O (GPIO) input pins.
The GPIO pins are
controlled by four registers, as shown below
-
44
Each GPIO pin is controlled by a bit in each of the four GPIO
registers. These bits data direction, set,clear and pin status .The
FIODIR pin allows each pin to be individually
configured as an input (0) or an output (1). If the pin is an
output the FIOSET and FIOCLR
registers allow you to control the state of the pin. Writing a 1
to these registers will set or clear the corresponding pin. The
state of the GPIO pin can be read at any time by reading the
contents of the FIOPIN register The FIOMASK register is used to
mask individual bits of the
FIOSET,FIOCLR and FIOPIN register. If a bit in the FIOMASK
register is set to 0 the corresponding bit in the FIOSET,FIOCLR and
FIOPIN will be updated. This masking helps speed up low level IO
bit manipulation.
PORT0 and PORT1 can be accessed as general purpose as well as
fast ports, but
P2,P3&P4 can be accessed only as fast ports.
(2)UART
The LPC23xx devices currently have four on-chip UARTS. They are
all identical to use ,
but UART1 has additional modem support and UART3 which has IrDA
support. All the
UARTs have a built-in Baud rate generator with autobaud
capability and 16 byte transmit
and receive FIFOs
First the pinselect block must be programmed to switch the
processor pins from GPIO to the
UART functions.Then LCR configures the format of transmitted
data. Usually the character
format is set to 8 bits, no parity and one stop bit. In the LCR,
there is an additional bit called
DLAB which is the divisor latch access bit. In order to be able
to program the Baud rate
generator, this bit must be set. The Baud rate generator is a
sixteen bit prescaler which
divides down Pclk to generate the UART clock which must run at
16 times the Baud rate.
This is formula used to calculate the UART Baud rate
Divisor = Pclk/16 * BAUD
Consider Pclk= 30MHz,
Divisor = 30,000,000/16 x 9600 = 194 or 0xC2
Often it is not possible to get an exact Baud rate for the
UARTs, they will work with up to
around a 5% error in the bit timing. The divisor value is held
in two registers: Divisor latch
-
45
MSB (DLM) and Divisor latch LSB (DLL). The first eight bits of
both registers holds each
half of the divisor as shown below. Finally, the DLAB bit in the
LCR register must be set
back to zero to protect the contents of the divisor
registers.
Data Transfer
Once the UART is initialised, characters can be transmitted by
writing to the Transmit
Holding Register.Similarly, characters may be received by
reading from the Receive Buffer
Register. Both these registers occupy the same memory location.
Writing a character places
the character in the transmit FIFO and reading from this
location loads a character from the
Receive FIFO. The putchar() and getchar functions are used to
read/write a single character
to the UART. These low level drivers are called by the Keil
STDIO functions such as printf()
and scanf(). So, if you want to re direct the standard I/O from
the UART to say an LCD
display and a keypad, rewrite these functions to support sending
and receiving a single
character to your desired I/O devices. Both the putchar() and
getchar() functions read the
Link Status Register (LSR) to check on UART error conditions and
to check the status of the
receive and transmit FIFOS
(3)ADC(Analog to Digital Converter)
The A/D converter present on LPC2300 variants is a 10-bit
successive approximation
converter with a conversion time of 2.44 uSec. The A/D converter
has either 6 or 8
multiplexed inputs depending on the variant. The converter is
available with 4 or 8 channels
of 10-bit resolution.
The A/D control register establishes the configuration of the
converter and controls the start
of conversion. The first step in configuring the converter is to
set up the peripheral clock. The
A/D clock is also derived from the PCLK. This PCLK must be
divided down to equal
4.5MHz. This is a maximum value and if PCLK cannot be divided
down to equal 4.5MHz
then the nearest value below 4.5MHz which can be achieved should
be selected AD Control
register: The control register PCLK is divided by the value
stored in the CLKDIV field plus
one. Hence the e quation for the A/D clock is as follows:
CLKDIV = (PCLK/Adclk) - 1
Unlike other peripherals the A/D converter can make measurements
of the external pins
when they are configured as GPIO pins. The A/D has a maximum
resolution of 10 bits but
can be programmed to give any resolution do wn to 3 bits. The
conversion resolution is equal
-
46
to the number of clock cycles per conversion minus one. Hence
for a 10-bit result the A/D
requires 11 ADCLK cycles and four for a 3-bit result. Once you
have configured the A/D
resolution, a conversion can be made. The A/D has two conversion
modes, hardware and
software. The hardware mode allows you to select a number of
channels and then set the A/D
running. In this mode a conversion is made for each channel in
turn until the converter is
stopped. At the end of each conversion the result is available
in the A/D Global data register
and in a dedicated results register for each channel, ADDR0
ADDR7.
At the end of a conversion the Done bit is set and an interrupt
may also be generated if
the global enable and channel interrupt enable bits are set in
the AtoD Interrupt enable
register. The conversion result is stored in the V/Vdd a field
as a ratio of the voltage on the
analog channel, divided by the voltage on the analog power
supply pin. The number of the
channel for which the conversion was made is also stored
alongside the result. This value is
stored in the CHN field. Finall y, if the result of a conversion
is not read before the next result
is due, it will be overwritten by the fresh result and the
OVERUN bit is set to on e. If you are
using multiple A/D channels the A/D status register provides
global access to the DONE and
Overrun bits for each channel
(4)Digital To Analog Converter
The LPC23xx variants have a 10-bit Digital to analog converter.
This is an easy-to-use
peripheral as it only has a single register. The DAC is enabled
by wr iting to bits 20 and 21 of
PINSEL1 and converting pin 0.26 from GPIO to the AOUT function.
It should also be noted
that a channel of the analog to digital converter also shares
this pin. The DAC is controlled by
a single register. The value to be converted is written here
along with the bias value. Once
enabled a conversion can be started b y writing to the VALUE
bits in the control register.
The conversion time is dependant on the value of the BIAS bit.
If it is set to one the
conversion time is 2.5uSec but it can drive 700 uA. If it is
zero, the conversion time is 1 uSec
but it is only able to deliver 350 uA. However, the total
settling time is also dependent on the
external impedance and the data setsheet values are valid for a
100pFcapacitance
(5)Real Time Clock
The LPC23xx Real Time Clock (RTC) is a clock calendar accurate
up to the year 2099.
The RTC has the option to run from and external 32KHz watch
crystal or from the internal
PCLK. The RTC also has an associated 2K of Low power SRAM called
the battery RAM.
-
47
The RTC and batter y SRAM have a separate p ower domain so by
supplying 3.3V to the
Vbat pin, the RTC can be kept running and the contents of the
battery ram may be preserved
when the LPC2 3xx is powered down. Both the RTC and the battery
ram are designed to
consume minimum power and can be run from a battery. This
arrangement means that the
RTC may be used to provide a perpetual clock calendar, if this
is not re quired, the RTC can
be used to provide a time reference and periodic interrupts
without the need for an additi ona
l external oscillator
(6)Timer
The LPC23xx has four general purpose timers. All of the general
purpose timers are
identical in structure and use. The timers are based around a
32-bit timer-counter with a 32-
bit prescaler. The default clock source for all of the timers is
the APB peripheral clock Pclk.
The tick rate of timer is controlled by the value stored in the
prescaler register. The prescaler
register will increment on each tick of Pclk until it reaches
the value stored in prescaler
register. When it reaches the prescale value, the timer-counter
is incremented by one and the
prescale counter resets to zero, and starts counting again.
Capture Mode : Each timer has upto four capture channels. The
capture channels allows
to capture the value of the timer-counter when an input signal
makes a transition.
Counter Mode : The count control register allows to select
between each timer as a
counter or a pure timer.
Match Mode : Each timer has upto four match channels. Each match
channel has a match
register which stores a 32-bit number. The current value of
timer-counter is compared against
the match register. When the values match, an event is
triggered.
-
48
DEVELOPING TOOL
Vision3 Overview
The Vision3 IDE is a Windows-based software development platform
that combines a
robust editor, project manager, and make facility. Vision3
integrates all tools including the
C compiler, macro assembler, linker/locator, and HEX file
generator. Vision3 helps
expedite the development process of your embedded applications
by providing the following:
Full-featured source code editor,
Device database for configuring the development tool
setting,
Project manager for creating and maintaining your projects,
Integrated make facility for assembling, compiling, and linking
your embedded
applications,
Dialogs for all development tool settings,
True integrated source-level Debugger with high-speed CPU and
peripheral simulator,
Advanced GDI interface for software debugging in the target
hardware and for
connection to Keil ULINK,
Flash programming utility for downloading the application
program into Flash ROM,
Links to development tools manuals, device datasheets &
user's guides.
The Vision3 IDE offers numerous features and advantages that
help you quickly and
successfully develop embedded applications. They are easy to use
and are guaranteed to help
you achieve your design goals.
The Vision3 IDE and Debugger is the central part of the Keil
development toolchain.
Vision3 offers a Build Mode and a Debug Mode.
In the Vision3 Build Mode you maintain the project files and
generate the application.In the
Vision3 Debug Mode you verify your program either with a
powerful CPU and peripheral
simulator or with the Keil ULINK USB-JTAG Adapter (or other AGDI
drivers) that connect
-
49
the debugger to the target system. The ULINK allows you also to
download your application
into Flash ROM of your target system
-
50
REFERENCES
[1] A Bus Management System Based on ZigBee
978-1-4244-7237-6/10/$26.00 2010
IEEE
[2] Qing-Jie Kong, Yikai Chen, and Yuncai Liu,(2009) "A
fusion-based system for road-
network traffic state surveillance: a case study of shanghai,"
IEEE Intelligent Transportation
Systems Magazine, vol. 1, no. 1, pp. 37-42
[3]Sheng, Q.Z., Li, X. and Zeadally, S. (2008) Enabling
Next-Generation RFID
Applications: Solutions and Challenges, IEEE Computer, Vol 41 No
9, pp 21-28
[4] Bus Management System Using RFID In WSN
[5] ZigBee.org ZigBee-Specification 2006
[6] ChipCon Corp CC2430Datasheet.pdf2005
[7] Texas Instruments Inc. Z-Statck Sample Application for
CC2430DB