Jimma Thesis

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 65

JIMMA INSTITUTE OF TECHNOLOGY

School of Electrical and Computer Engineering


Computer Engineering Stream

FINAL YEAR THESIS


RFID BASED ADDIS ABABA NATIONAL BUS STATION
CUSTOMER SERVICE SYSTEM

LIST OF MEMBERS:
Name ID No.
SOLOMON ABEBEI--------------------01959/03
SILEABAT DIRES-----------------------01483/03
MULUGETA MERGIYAW------------01596/01
HAREGEWOYN TEKILE-------------01046/03
WOLDEMESKEL ZIMELO-----------01702/03
HABTU BIRHANU-----------------------01019/03

ADVISOR: Mrs. SERAWORK AMSALU (M.Sc)


CO-ADVISOR: Mr. SOLOMON B. (B.Sc)

JUNE 15, 2015


Declaration
We are honestly declared that, this is our work and that all sources of materials used in this
project have been strongly acknowledged.

This project paper is submitted in partial fulfillment of the requirement for BSc in Electrical and
Computer engineering at Jimma Institute of Technology.

This is to certify that the above declaration made by our effort is correct to the best of our
knowledge.

In doing so, we assure that we agree with all written above with our signature as follows.
Name ID Signature
1. Solomon Abebei 01956/03 ­­­­­­­­­­­­­­­­­­­
2. Sileabat Dires 01483/03 ­­­­­­­­­­­­­­­­­­­
3. Mulugeta Mergiyaw 01596/01 ­­­­­­­­­­­­­­­­­­­
4. Woldemeskel Zimelo 01702/03 ­­­­­­­­­­­­­­­­­­­
5. Habitu Birhanu 01019/03 ­­­­­­­­­­­­­­­­­­­
6. Haregewoyn Kifle 01046/03 ­­­­­­­­­­­­­­­­­­­

Institute: Jimma Institute of Technology (JIT)


School: Electrical and Computer Engineering (ECE).
Program: B.Sc. Degree
Project tittle: RFID based Addis Ababa national bus station customer service system
I certify that this project satisfies all the requirements as a project for the degree of Bachelor of
Science.
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ ­­­­­­­­­­­­­­­­­­­­­­­­
Name of program coordinator Signature
This is to certify that I have read this project and that in my opinion it is fully adequate, in scope
and quality, as a project for the degree of Bachelor of Science.

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ ­­­­­­­­­­­­­­­­­­­­­­­­­­­­
Name of Advisor Signature

i
Abstract
This paper will discuss about RFID based Customer Service Notification as a solution to solve
problems of Addis Ababa National Bus Station customers. The system can improve unwanted
place to place movement of people to find their bus. Each bus is assigned by automatically
display bus status information (weather the bus is inside station or outside station, the bus is
changed or already leave the station) to the customers using display board and website.

This paper will also discuss how can inform customers about booking information of buses for
future traveling from Addis Ababa before they buy tickets using website. And how customers
prevent themselves from extra payment either if they are late or the bus is already leave station
before they arrive.

Additionally, this paper discusses how we help the administrator of Addis Ababa National Bus
Station by developing an application to control station of information like bus information,
booking and ticketing information.

This system needs basic knowledge about RFID technology (Radio Frequency Identification)
and its basic components, how can interface it, work on C#, ASP.NET, SQL Server, Proteus and
building website driven database.

ii
Acknowledgement
The successful completion of any task would be impossible without the help of others. First of
all, we would like to express our gratitude to Jimma University, Jimma Institute of technology
and the School of Electrical and Computer Engineering for giving this opportunity to do our final
year project on RFID based Addis Ababa bus station customer service system out of the normal
environment.
We have a grateful thanks to our project advisor Mrs. Serawork Amsalu (M.Sc.) and co-
advisor Mr.Solomon B. (B.Sc.) for their guidance, inspiration and constructive suggestions that
has been helpful to us in the preparation of this project.

Our special thanks goes to our stream chairman Mr. Fitulwak A. (M.Sc.) for his continuous
motivation and support in the entire process of the project.

We would like to thank Engr. Kris C.Culpotura, MSME, MIT for giving us advice and
comments on our project.

We also thank to our Computer Engineering stream instructors (particularly, Engr. Jhun,
Mr.Gadisa Wakgari and Mr. Sisay Desita) and friends who have helped us in the successful
completion of our project.

Lastly, we would like to give thanks to our Computer and Communication engineering
laboratory assistance that she helps us by opening the computer laboratory class continuously
until we have finished our project.

iii
Table of Contents
Declaration ....................................................................................................................................... i

Abstract ........................................................................................................................................... ii

Acknowledgement ......................................................................................................................... iii

List of Figures ............................................................................................................................... vii

List of Tables ............................................................................................................................... viii

Acronyms ....................................................................................................................................... ix

Chapter One .................................................................................................................................... 1

1 Introduction ............................................................................................................................. 1

1.1 Statement of the problem ................................................................................................. 2

1.2 Objectives ......................................................................................................................... 2

1.2.1 General objective ...................................................................................................... 2

1.2.2 Specific objective ...................................................................................................... 2

1.3 Scope of the project .......................................................................................................... 3

1.4 Limitation of the project ................................................................................................... 3

1.5 Methodology .................................................................................................................... 3

1.6 Outline of the report ......................................................................................................... 4

Chapter Two.................................................................................................................................... 5

2 Literature Review.................................................................................................................... 5

2.1 RFID Technology............................................................................................................. 5

2.1.1 RFID (Radio Frequency Identification) .................................................................... 5

2.1.2 RFID System components ........................................................................................ 5

2.1.3 Benefits of RFID ....................................................................................................... 6

2.1.4 Advantage of RFID over Barcode ............................................................................ 6

2.1.5 RFID working principle ............................................................................................ 6

iv
2.1.6 Application of RFID ................................................................................................. 6

2.1.7 Common Problems with RFID ................................................................................. 7

Chapter Three.................................................................................................................................. 8

3 System block diagram ............................................................................................................. 8

3.1 Overview of Embedded System ....................................................................................... 8

3.2 System block diagram ...................................................................................................... 8

3.2.1 Block diagram description ........................................................................................ 9

Chapter Four ................................................................................................................................. 11

4 System design and implementation ...................................................................................... 11

4.1 Components used ........................................................................................................... 11

4.1.1 Power Supply .......................................................................................................... 11

4.1.2 PIC18F45K22 microcontroller ............................................................................... 11

4.1.3 EM­18 RFID Reader ............................................................................................... 13

4.1.4 RFID Passive Tags .................................................................................................. 16

4.1.5 20 x 4 character LCD .............................................................................................. 16

4.1.6 RS­232 Data Interface............................................................................................. 18

4.1.7 MAX232 ................................................................................................................. 20

4.1.8 Resistors .................................................................................................................. 22

4.1.9 Capacitors ............................................................................................................... 22

4.1.10 Crystal ..................................................................................................................... 22

4.2 Software requirements and description .......................................................................... 23

4.2.1 Programming language ........................................................................................... 23

4.2.2 IDE .......................................................................................................................... 23

4.3 General flowchart of the system..................................................................................... 24

4.4 Simulated Hardware circuit description ......................................................................... 25

v
4.4.1 Power supply........................................................................................................... 25

4.4.2 RFID tag reading section ........................................................................................ 26

4.4.3 RS­232 interface ..................................................................................................... 26

4.4.4 LCD display section................................................................................................ 27

4.5 Software part of the system ............................................................................................ 28

4.5.1 Software design ....................................................................................................... 28

4.5.2 C# graphical user interface ..................................................................................... 30

4.5.3 System website........................................................................................................ 35

Chapter Five .................................................................................................................................. 39

5 Conclusions and recommendations....................................................................................... 39

5.1 Conclusions .................................................................................................................... 39

5.2 Recommendations .......................................................................................................... 40

References ..................................................................................................................................... 41

Appendices .................................................................................................................................... 42

Appendix A: Circuit diagram of the system ............................................................................. 42

Appendix B: Sample MikroC code ........................................................................................... 43

Appendix C: Sample C# code ................................................................................................... 49

Appendix D: Sample ASP.NET codes...................................................................................... 52

Appendix E: Sample SQL Query.............................................................................................. 54

vi
List of Figures
Figure 1System Design flow [8]....................................................................................................... 4
Figure 2 System block diagram ...................................................................................................... 9
Figure 3 PIC18F45K22 [9]............................................................................................................. 12
Figure 4 PIC18F45K22 pin diagram............................................................................................. 13
Figure 5 EM­18 RFID reader [1].................................................................................................... 13
Figure 6 EM­18 RFID pin diagram [1] .......................................................................................... 14
Figure 7 RFID system principle [1]................................................................................................ 15
Figure 8 Typical RFID tag with antenna and a microchip............................................................ 16
Figure 9 20 x 4 character LCD display ......................................................................................... 17
Figure 10 20x4 character LCD pin diagram ................................................................................. 17
Figure 11 RS­232 DB­8 male and female connector [3]................................................................ 19
Figure 12 MAX232 pin diagram [9] .............................................................................................. 20
Figure 13 MAX232 basic connection with microcontroller [9] ..................................................... 22
Figure 14 Crystal oscillator........................................................................................................... 23
Figure 15 General flowchart of the system ................................................................................... 24
Figure 16 power supply ................................................................................................................ 25
Figure 17 RFID tag reading section .............................................................................................. 26
Figure 18 RS­232 interface section............................................................................................... 26
Figure 19 LCD display section ..................................................................................................... 27
Figure 20 Usecase diagram ........................................................................................................... 29
Figure 21 SQL server relational database diagram ....................................................................... 30
Figure 22 Home tab section .......................................................................................................... 31
Figure 23 Registering new bus tab on administrator form .......................................................... 32
Figure 24 Updating bus information tab on administrator form ................................................... 33
Figure 25 Assigning bus for semirit tab on administrator form.................................................... 34
Figure 26 Update destination information tab on administrator form .......................................... 35
Figure 27 home page ..................................................................................................................... 36
Figure 28 Review page ................................................................................................................. 36
Figure 29 Station page .................................................................................................................. 37
Figure 30 Contact page ................................................................................................................. 37
Figure 31 About page................................................................................................................... 38
Figure 32 System database entity relationship diagram ............................................................... 42

vii
List of Tables
Table 1 EM­18 RFID reader pin description ................................................................................ 14
Table 2 20x4 character LCD pin description ................................................................................ 18
Table 3 RS­232 DB­9 connector pin description .......................................................................... 19
Table 4 MAX232 pin description ................................................................................................. 21

viii
Acronyms
AIDC: Automatic Identification and Data Capture

ASP: Active Server Page

CPU: Central Processing Unit

COFF: Common Object File Format

CLI: Common Language Interface

CMOS: complementary metal oxide semi­conductor

CSS: Cascaded Style Sheet

DB: Database

DCE: Data Communication Equipment

DTE: Data Terminating Equipment

EEPROM: Electrically Erasable Programmable Read Only Memory

IC: Integrated Circuit

ICD: In circuit Debugger

I2C: Inter Integrated Circuit

IDE: Integrated Development Environment

LCD: Liquid Crystal Display

LED: Light Emitting Diode

MS SQL: Microsoft Sequential Query Language

MSSP: Master Synchronous Serial Port

PC: Personal computer

PIC: Peripheral Interface controller

PRO: Professional

ix
RFID: Radio Frequency Identification System

RISC: Reduced Instruction Set Computer

SPI: Serial Peripheral Interface

TTL: Transistor­transistor logic

UART: Universal Asynchronous Receiver Transmitter

UML: Unified Modelling Language

VSM: Virtual System Modeling

XML: Extensible Markup Language

x
Chapter One

1 Introduction
Addis Ababa national bus station was originally founded when the Ethiopia road transport
authority (ERTA) is organized in the year of 1967. In 2005, the Ethiopian government
reorganized the transport sector and the station is responsible for ERTA. [7]

Addis Ababa bus station is one of the biggest and core of every national bus journey in the
country. This national bus station has around 750 service buses and it is estimated to travel
30,000 travelers per a day. Even though the station covers a wide range of customer travelling
service ,it works with traditional manual system which have poor method of announcement for
their customers when either a bus is changed or to call person with the help of speaker and sell
tickets with direct contact of customers even if there is a large number of peoples. Each bus
hasn’t a fixed time to start travelling that the travelers may not arrive their destination on the
desired time. This big station doesn’t have any automated notification system for their customer
(whether the bus is within the station or it doesn’t enter station). Not only have these, but also the
station doesn’t have a system (method) or access to notify an information for those customers
who are not nearby the station. This system also consumes the officers’ paper, pen, energy and
time. So, this problems must be solved so as to fulfill customers need and participate in the
economic development of the country.

Having this problem, we come up with a solution of the above all problems to help authorities
and customers of Addis Ababa National Bus Station by developing an automated system.

This project is designed and implemented by using RFID technology, which is one of the new
emerging technologies that use radio frequency wave to transfer data between a reader and a
movable item which is RFID tag, which is attached to the bus, to identify it.

1
1.1 Statement of the problem
Since we are coming at far distance from Addis Ababa, we use this station service. The
customers doesn’t get fast and comfort services. We have seen that the station officers use
traditional manual system and it is difficult to buy tickets because of large number of travelers.
So, we are initiated to design and develop an automated notification board and website for
customers of Addis Ababa bus station. Specifically, we design a system that solves problems
related with unwanted place to place movement of people to find their bus which faces them for
the robbers, replacing backward manual systems to show changes on services for the clients and
to indicate the bookings of the buses for future travelling from Addis Ababa before they buy
tickets.

1.2 Objectives
The objective of this project was categorized as the general objective and specific objective
discussed as follows.

1.2.1 General objective

 To design an RFID based customer service notification system for Addis Ababa National
Bus Station.

1.2.2 Specific objective

 To design a system that notify customers whether the bus is entering or living the station,
even changes made to this bus
 To develop a website that is used to visit buses going from Addis Ababa to any
destination before customers are going to buy tickets
 To develop a desktop application that used to register bus information of the station
 To provide online services for the customers or travelers
 To design a system which announces customers of the station about ticket price
 To upgrade project and problem solving skills and team working

2
1.3 Scope of the project
This project is designed and developed based RFID technology for Addis Ababa national bus
station. This system covers some activities that were manually done in the current Addis Ababa
National Bus Station. This system basically have automated method:

 To notify customers, both inside the station and not nearby using notification board and
website respectively, whether bus is inside, outside or changed, which they are assigned
for
 Any change to the information is done by only the admin of the system

1.4 Limitation of the project

 The Person who access the desktop application should have the knowledge of computer
 The system is basically applicable only in English language
 This system is limited to Addis Ababa National Bus station

1.5 Methodology

First we have focused on finding problems by observing our surrounding. Since we are
customers of Addis Ababa Bus station, we have observed problems related to customers service
notification. From the observations we decided to design and develop a system which notify
status of buses and booking information of the station to the customers. The Proteus simulation
was then developed with C code for the hardware in parallel with the software to show how the
overall system works.

3
Figure 1System Design flow [8]

1.6 Outline of the report


This report is explain RFID based customer notification system for Addis Ababa National Bus
Station by divided it into four part; the first part is quick introduction and overview of RFID
technology, which is discussed in chapter two, second part of this report briefly explain hardware
design of this system, which is in chapter three and four, the third part of this report explain
software part of this automated system, which is in chapter three and four, and finally the last
part explains conclusion of this system and some recommendation we have about this system for
the authorities of Addis Ababa National Bus Station, Jimma Institute of Technology Electrical
and Computer Engineering department and researchers that are intended to design more on the
future.

4
Chapter Two

2 Literature Review
Nowadays use different technology to track items and inventories. Among this technologies
RFID and barcode are the most commonly used, each have their own advantage and
disadvantage.

2.1 RFID Technology


2.1.1 RFID (Radio Frequency Identification)
Radio Frequency Identification (RFID) is wireless use of radio waves to transfer data, for the
purposes of automatically identifying and tracking tags attached to objects. The
tags contain electronically stored information. Some tags are powered by electromagnetic
induction from magnetic fields produced near the reader. Some types collect energy from the
interrogating radio waves and act as a passive transponder. Other types have a local power
sources such as a battery and may operate hundreds of meters from the reader. Unlike a barcode,
the tag does not necessarily need to be within line of sight of the reader and may be embedded in
the tracked object. RFID is one method for Automatic Identification and Data Capture (AIDC).[4]

2.1.2 RFID System components


RFID systems consists of an antenna and a transceiver, which read the radio frequency and
transfer the information to a processing device, and a transponder or tag, which is an integrated
circuit containing the radio frequency circuitry and information to be transmitted.

RFID tags fall into two general categories; with battery and without battery. Those tags without
battery are called passive tags, use the interrogator’s radio wave energy to relay its stored
information back to the interrogator. The advantage of this tags is that the reader can much
farther away and still get the signal. A battery powered RFID tags, also called active tags,
embedded with a small battery that powers the relay of information. Such type of tags have a
virtually unlimited life span and are much smaller.

5
2.1.3 Benefits of RFID
 Identification without visual contact
 Read/write capability
 Reliability and speed
 Reusability
 Data storage at point of origin

2.1.4 Advantage of RFID over Barcode


RFID tags and barcodes both carry information about products. However, there are important
difference between these two technologies:

 Barcode readers require a direct line of sight to the printed barcode; RFID reader do not
require a direct line of sight to either active RFID tags or passive RFID tags.
 RFID tag can be read at much greater distances; an RFID reader can pill information
from a tag at distance up to 300 feet. The range to read a barcode is much less, typically
no more than fifteen feet.[6]
 Barcodes have no read/write capability; i.e., one cannot add to the information written on
a printed barcode. RFID tags, however, can be read/write devices; the RFID reader can
communicate with the tag, and alter as much of the information as the tag design will
allow.[6]
 RFID tags are typically more expensive than barcodes, in some cases, much more so.

2.1.5 RFID working principle


When an RFID tag passes through the field of the scanner or RFID reader, it detects the
activation signal from the antenna. That “wake up” the RFID chip, and it transmits the
information on its microchip to be picked up by the scanning antenna.

2.1.6 Application of RFID


RFID tags are used in many industries. For example, an RFID tag attached to an automobile
during production can be used to track its progress through the assembly line; RFID­tagged
[4]
pharmaceuticals microchip in livestock and pets allow positive identification of animals. Not
only this RFID system are also seen in:

6
 People tracking
Hospital uses RFID tags for tracking their special patients. In emergency patient and
other essential equipment can easily tracked. It will be mainly very useful in mental care
hospitals doctors can track each and every activity of the patient. Hospitals are not the
only there are also other institution that use RFID technology to track peoples, for
example peoples tracking system will be used in jails. [6]
 Access control
RFID tags are widely used in identification badges, replacing earlier magnetic stripe
cards. These badges need only be held within a certain distance of the reader to
authenticate the holder. Tags can also be placed on vehicles, which can be read at a
distance, to allow entrance to controlled areas without having to stop the vehicle and
present a card or enter an access code. [4]
 Transportation and logistics
Yard management, shipping and freight and distribution centers uses RFID tracking. In
the railroad industry, RFID tags mounted on locomotives and rolling stock identify the
owner, identification number and type of equipment and its characteristics. This can be
used with a database to identify the lading, origin, etc. of the commodities being carried.
[4]

 Contactless payment system


RFID tags used to carry payment information. RFIDs are particular suited to electronic
Toll collection systems. Tags attached to vehicles, or carried by people transmit payment
information to a fixed reader attached to a Toll station. Payments are then routinely
deducted from users account, or information is changed directly on the RFID tag. RFID
technology is also used in modern toll station for toll collection from their customers. [5]

2.1.7 Common Problems with RFID


The most common problems with RFID are tag collision and reader collision.

 Tag collision: collision occur when multiple tags respond to the same reader
simultaneously. This means, many tags are present in a small area.
 Reader collision: this occurs when the signals from two or more readers overlap. The tag
is unable to respond to simultaneous queries.

7
Chapter Three

3 System block diagram


3.1 Overview of Embedded System
Embedded system applications are application that include either hardware or software based
system. Having a microprocessor or microcontrollers in a system means that removing the bugs,
making modifications, adding new features, or upgrading system are only matters of rewriting or
reprogramming the software that controls the device without modifying the whole hardware or
adding additional electronic devices to the system. Embedded systems are electronic systems that
include a microcomputer to perform a specific or dedicated task or activity.

Nowadays, lots of embedded system application are developed by adding many features and
technologies so as to minimize size and cost, and to maximize system reliability. RFID, Radio
Frequency Identification, new emerging technology is one this technologies. RFID, as the name
indicates, uses radio frequency waves to transfer data between a reader and a movable item
which is RFID tag, to identify, categorize and track items.

RFID based customer notification system for Addis Ababa National Bus Station is designed
according to the concept of embedded system, that integrate RFID reader to receive data from
dedicated RFID Tags within station, microcontroller for data processing and LCD display to
output data for customers of the station.

3.2 System block diagram


Input part: this is starting point of the system in which RFID readers are used to detect and/or
read information of Bus tags.

System control part: this part capable of processing data received from RFID reader and send it
to server part and to get desired message in response, so as to output reliable information for the
customers of station and check the validity and/or status of Tags, which is attached to the buses.

Output part: output should be seen for the customers using LCD display, for those customers
who are inside the station, website, for those who are outside station. Output is not needed only

8
for the customers of the station, but also the administrator also have to what is going happening
on the system, this is achieved by using buzzer, LED and massages.

The general block diagram of system is as follow:

Figure 2 System block diagram

3.2.1 Block diagram description


RFID based Addis Ababa National Bus Station Customer System basically consists of the
following main blocks:

Bus RFID Tag: Bus RFID tags are unique number/Tag number, which is given by authorized
body of the station, attached to the bus for identification purpose. This block is used to check
status of the bus like, is it incoming bus? Or is it changed bus? Or is bus living station. It is
sensed by the RFID reader when it is within the range of the reader. We are used 125 kHz
passive RFID tags.

9
RFID Reader: RFID reader is a device that is used to detect an RFID tags. It has inbuilt
antenna that generates and emits radio waves; the tag responds by sends back its data. It sends
back this data received from the tag to the microcontroller. In this project we have used EM­18
RFID reader, which detects RFID tags.

Microcontroller: this block is used to control the whole system. It process data received from
the RFID reader and transmit this data to the server, for validation and further data processing. In
response, it fetches data from the server and provide output to the display. In this project we used
PIC18F45k22 microcontroller which support two UART. Since, we didn’t get PIC18F45k22, for
our demonstration purpose we have used PIC16F877A instead of PIC18F45k22 microcontroller.

DB Server: this is Back­end or Back bone of the system, where information about the bus like
Tag Number, bus level, name, capacity, national bus number, owner information, destinations
and other information’s, stored. For this project we have used MS SQL server 2008 r2 as a
database server.

LCD Display: Liquid Crystal Display (LCD), display messages like Bus tag and status of the
bus (inside station, outside station or it is changed bus), which is send by the microcontroller
from the server. Here in this project we have used 20x4 alphanumeric display. Once again, we
have used 16 x 2 alphanumeric LCD display for the demonstration purpose.

DB driven website: it is like LCD display of the station, which gives full information about the
buses of the station, for those customers who are not nearby the station with additional features
like booking information destination for next journey and some other station information’s. This
is the Front­end of the system and it is designed using ASP.NET with C#.

10
Chapter Four

4 System design and implementation


4.1 Components used
1. Power Supply
2. PIC18F45k22
3. EM­18 RFID reader
4. RFID passive Tags
5. LCD
6. MAX232
7. Resistors
8. Capacitors

Software development tools used

1. Proteus, ISIS Professional v7.8 SP2


2. MikroC PRO for PIC
3. Microsoft Visual Studio 2012
4. SQL Server Management Studio

4.1.1 Power Supply


A power supply is an electronic device that supplies electric power to an electrical load. The
primary function of a power supply is to convert one form of electrical energy to another and, as
a result, power supplies are sometimes referred to as electric power converters. In the AC/DC
power conversion a rectifier is used to convert the transformer output voltage (AC) to a varying
DC voltage, which in turn is passed through an electronic filter to convert it to an unregulated
DC voltage. The filter removes most, but not all of the AC voltage variations; the remaining
voltage variations are known as ripple to get +5V DC input for the Microcontroller.

4.1.2 PIC18F45K22 microcontroller


PIC18F45K22 is high­range family of PIC microcontrollers having low­power consumption and
high­performance. This device has 40 pins, there are also 28 and 44 pins PIC18F families, which
make it easier to use the peripherals as the functions are spread out over the pins and to decide

11
what external devices to attach without worrying too much if there enough pins to do the task.
One of the main advantages is that each pin have more than one function so that, it makes easier
to decide what the pin function do may tasks without adding another peripheral devices.

Figure 3 PIC18F45K22 [9]

Features of PIC18F45K22

 High performance RISC CPU


 C Compiler optimized architecture/instruction set
 Up to 1024 Bytes Data EEPROM
 Up to 64 Kbytes Linear Program Memory Addressing
 Up to 3896 Bytes Linear Data Memory Addressing
 16­bit Wide Instructions, 8­bit Wide Data Path
 Flexible oscillator structure
 Peripheral features:
 Two Master Synchronous Serial Port (MSSP) modules:
o 3­wire SPI (supports all 4 modes)
o I2C™ Master and Slave modes with address mask
 Two Enhanced Universal Synchronous Asynchronous Receiver Transmitter modules
o Supports RS­232, RS­485 and LIN 2.0
o Auto­baud detect
 RS­232 operation using internal oscillator
 Auto Wake­up on Start bit

12
PIC18F45K22 pin diagram:

Figure 4 PIC18F45K22 pin diagram

4.1.3 EM-18 RFID Reader


EM­18 RFID Reader Module is RFID reader module, which operate at 125 kHz, mostly used for
Radio Frequency Projects. It is a low cost, small size, low power consumption and easy to use.
This reader module comes with an on­chip antenna and can be powered up with a 5V power
supply. The module must be powered­up and connected to the transmit pin of the module to
receive pin of microcontroller. Software UART can be used for microcontroller having no
UART modules.

Figure 5 EM­18 RFID reader [1]

13
EM-18 RFID Reader pin diagram

Figure 6 EM­18 RFID pin diagram [1]

EM-18 RFID Reader pin description

Table 1 EM­18 RFID reader pin description


Pin Signal Description
1 VCC 5V supply voltage
2 GND Signal ground (0V)
3 BEEP BEEP and LED, active low terminal
4 ANT No use
5 ANT No use
6 SEL Chip select, high for RS232 and low for WEIGAND
7 TX Transmit terminal, connected to RX pin of PIC to send serial data
8 D1 Data line
9 D0 Data line
EM-18 RFID reader features:

 125 kHz transmit frequency


 Support EM4001 64 bit RFID tags
 Communication interface with TTL serial interface and WIEGAND output
 4.6V – 5.5V DC ± 10% regulated
 50mA, <10mA at power down, current consumption
 Integrated antenna
 Data baud rate 9600 bps, data bit 8 bits, polarity check none, stop bits one
communication parameters

14
Operation

EM­18 RFID Reader Module generates and radiates radio frequency carrier signals of frequency
125kHz through its coils. When a 125kHz passive RFID Tag is brought in to this field, will get
energized from it. These RFID Tags are usually made using a CMOS IC EM4102. It gets enough
power and master clock for its operations from the electromagnetic fields produced by RFID
Reader. [1]

Figure 7 RFID system principle [1]

When an RFID Tag is bring in to the field of EM­18 RFID reader it will read is tag number and
give output via TX terminal. The BEEP terminal become indicate valid tag detection. [1]

Typical applications

 E­Payment
 E­toll Road pricing
 E­Ticketing for events
 E­ticketing for Public Transport
 Access control
 PC Access
 Authentication
 Printer/ production Equipment

15
4.1.4 RFID Passive Tags
An RFID, Radio Frequency Identification, tag is a microchip combined with an antenna in a
compact package; the packaging is structured to allow the RFID tag to be attached to an object to
be tracked, in our case the bus. The tag’s antenna picks up signals from RFID reader and then
returns the signal, usually with some additional data like a unique serial number or other
customized information.

Even though RFID Tags comes in three forms, active, passive or semi­passive, in this project we
have used passive RFID Tag. A passive tag is cheaper and smaller because it has no battery.

Figure 8 Typical RFID tag with antenna and a microchip

4.1.5 20 x 4 character LCD


LCD display is very basic module and is very commonly used in various devices and circuits.
These modules are preferred over seven segments and other multi segment LEDs. The reasons
being: LCDs are economical; easily programmable; have no limitation of displaying special &
even custom characters (unlike in seven segments), animations and so on. A 20x4 LCD means it
can display 20 characters per line and there are 4 such lines. In this LCD each character is
displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data.

The command register stores the command instructions given to the LCD. A command is an
instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the
cursor position, controlling display etc. The data register stores the data to be displayed on the
LCD. The data is the ASCII value of the character to be displayed on the LCD.

16
20 x 4 character LCD Features:

 LCD can add a lot to applications in terms of providing a user interface for user,
debugging an application.
 LCD has single line display, two line display, and four line display. Each line can has up
to 20 characters.
 Built­in controller (S6A0069 or Equivalent)
 +5V power supply (Also available for +3V)
 1/16 duty cycle
 LED backlight

Figure 9 20 x 4 character LCD display

20x4 character LCD pin diagram and description

Figure 10 20x4 character LCD pin diagram

17
20x4 character LCD pin description:

Table 2 20x4 character LCD pin description

Pin Signal Description


1 VSS Signal ground (0V)
2 VDD Power supply for logic (+5V)
3 VEE Used to alter the control/adjust contrast of the display. Ideally, it is
connected to variable power supply
4 RS Register Select signal, when this line is low, data bytes transferred to the
display are treated as commands. By setting it to high data is treated as
characters
5 RW Read/Write select signal, used to choose whether to write to or to read from
the LCD.
6 E Operation (data read/write) enable signal, starts the transfer of data to or
from the LCD on falling edge
7 D0 The data bus and is used to pass commands and characters to the LCD. Data
8 D1 can be transferred to and from the display either as a single 8­bit byte or two
9 D2 4­bit nibbles. In the latter case only the upper four data lines (D4­D7) are
10 D3 used. This 4­bit mode is beneficial when using a microcontroller with few
11 D4 input/output pins available
12 D5
13 D6
13 D7

4.1.6 RS-232 Data Interface


RS­232 communication enables point to point data transfer. It commonly used in data acquisition
applications, for the transfer of data between microcontroller and a PC. [2] This standard specifies
9 or 25 different signal lines, depending on type of RS232. However, many of them are rarely
implemented and only two signal wires plus a common ground wire are required as minimum.
While many different connectors had been in use during the last decades, the DB­9 connector
had become the commonly used standard in recent years. [3]

18
Due to the asymmetrical specification of interface, there are two different connector layouts,
DTE (data terminal equipment, originally used by teletype writers) and DCE (data
communication equipment, originally used by modems). Usually a male connector is available
on DTE device, while a female connector is provided at the DCE.

Figure 11 RS­232 DB­8 male and female connector [3]

RS-232 DB-9 connector pin description:

Table 3 RS­232 DB­9 connector pin description

Pin Signal Direction Description


1 DCD DTE <­ DCE Data Carrier Detect (when connected)
2 RXD DTE <­ DCE Received Data (send data from DCE)
3 TXD DTE ­> DCE Transmitted Data (send data from DTE)
4 DTR DTE ­> DCE Data Terminal Ready (for connection)
5 GND Common ground
6 DSR DTE <­ DCE Data Set ready (to connect)
7 RTS DTE ­> DCE Request To Send (or DTE ready to receive)
8 CTS DTE <­ DCE Clear To Send (or DCE ready to receive)
9 RI DTE <­ DCE Ring Indicator (with incoming call)

19
4.1.7 MAX232
MAX232 IC is used to convert the TTL/CMOS logic levels to RS­232 logic levels during serial
communication of microcontrollers with PC. The controller operate at TTL logic level (0 – 5V)
whereas the serial communication in PC works on RS2­32 standards (­25V to +25V). This
makes link between them to communicate with each other.

The intermediate link is provided through MAX232. It is a dual driver/receiver that includes a
capacitive voltage generator to supply RS­232 voltage levels from a single 5V supply. Each
receiver converts RS­232 inputs to 5V TTL/CMOS levels. The drivers (T1 and T2), also called
transmitter, convert the TTL/CMOS input level into RS­232 level.

Figure 12 MAX232 pin diagram [9]

20
MAX232 pin description:

Table 4 MAX232 pin description

Pin Name Function


1 C1+ Capacitor connection pins
2 C3+ Capacitor connection pins
3 C1­ Capacitor connection pins
4 C2+ Capacitor connection pins
5 C2­ Capacitor connection pins
6 C4­ Capacitor connection pins
7 T2 Out Output pin; output the serially transmitted data at RS­232 logic level;
connected to receiver pin of PC serial port
8 R2 In Input pin; receive serially transmitted data at RS­232 logic level;
connected to transmitter pin of PC serial port
9 R2 Out Output pin; output the serially data at TTL logic level; connected to
receiver pin of controller
10 T2 In Input pin; receive the serially data at TTL logic level; connected to serial
11 T1 In transmitter pin of controller
12 R1 Out Output pin; output the serially transmitted data at TTL logic level;
connected to transmitter pin of controller
13 R1 In Input pin; receive serially transmitted data at RS­232 logic level;
connected to transmitter pin of PC serial port
14 T1 Out Output pin; output the serially transmitted data at RS­232 logic level;
connected to receiver pin of PC serial port
15 GND Signal ground (0V)
16 VCC 5V supply voltage
The transmitters take input from controller’s serial transmission pin, TX, and send the output to
RS­2332’s receiver pin, RXD. The receiver, on the other hand, take input from transmit pin,
TXD, of RS­232 serial port and give serial output to the microcontroller’s receiver pin, RX.
MAX232 need four external capacitors whose value ranges from 1µF to 22µF.

21
Figure 13 MAX232 basic connection with microcontroller [9]

4.1.8 Resistors
Resistor is a passive component that resists the flow of direct or alternating electric circuit. The
resistance of the resistor can be estimated by their color codes. There are some nonlinear
resistors whose resistance changes with temperature or light.

4.1.9 Capacitors
A capacitor is a passive two­terminal electrical component used to store energy electrostatically
in an electric field. Contain at least two electrical conductors (plates) separated by a dielectric
(insulator). Capacitors are used for smoothing power supply variations, coupling the various
stages of audio system, tuning in radio circuits, and store energy like in camera flash.

4.1.10 Crystal
Even though microcontroller has built in oscillator, it cannot operate without external
components which stabilize its operation and determine its frequency (operating speed of the
microcontroller). Depending on which elements are used as well as their frequencies, there are
four different oscillator modes: LP, Low Power Crystal, XT, Crystal/Resonator, HS, High
speed/Resonator and RC, Resistor/Capacitor. [8]

Crystals provides high initial accuracy and a moderately low temperature coefficient. Operation
is guaranteed over a range of conditions. Crystal oscillator modules and fully integrated silicon
oscillators are most common. Crystal oscillator modules provide accuracy similar to discrete

22
component circuits using crystals. Silicon oscillators are more precise than discrete component
RC oscillator circuits, and many provide comparable accuracy to ceramic resonator­based
oscillators.

Figure 14 Crystal oscillator

4.2 Software requirements and description


4.2.1 Programming language
 C programming for the PIC programming
 C# for desktop application
 ASP.NET for website development

4.2.2 IDE
 Proteus, ISIS Professional v7.8 SP2 for hardware simulation design
 MikroC PRO for PIC for hardware programming
 Microsoft Visual Studio 2012 for website and desktop application development
 SQL Server Management Studio as back­end

23
4.3 General flowchart of the system

Figure 15 General flowchart of the system

24
4.4 Simulated Hardware circuit description
4.4.1 Power supply
This is the power supply unit we have used for generation of +5V input for all components.

Figure 16 power supply

Description

In above circuit we have used a regulated power supply, a Step­down transformer TR2 is used
which gives 5 volt ac from 230V ac. Four IN 4007 diodes are used which forms a bridge. Three
capacitors C1 of 470µf, C2 of 0.01nf and C3 of 0.01nf are used for filter purpose. The regulated
IC 7805 is used for voltage regulating purpose.

Working principle:

A bridge rectifier which is made up of from four diodes rectifies the input 5 volt from the step
down transformer. This rectified output is given to C1 & C3 capacitors for filtering purpose. The
output from C3 is given to pin no.1 of 7805 IC. The 7805 is regulated IC which regulates the
voltage from C3 capacitor. +5V DC output is taken from pin no 3 of 7805 IC. The ground is
taken from pin no 2 of 7805 IC.

25
4.4.2 RFID tag reading section

Figure 17 RFID tag reading section

Description

Since we didn’t get EM­18 RFID reader simulation circuit inside proteus, in the above circuit we
have used virtual terminal simulator as EM­18 RFID Reader so as to simulate the result.

Operation:

Depending on RFID tag number typed the virtual terminal transmit/send this number to the
PIC18F45K22 microcontroller through the RX1 pin for further processing.

4.4.3 RS-232 interface

Figure 18 RS­232 interface section

26
Description

Since PIC18F45K22 microcontroller is the controlling unit and is interfaced with server PC
through RS­232 protocol, MAX232 is used to convert the TTL voltage level of the
microcontroller to RS­232 logic levels during serial communication of microcontrollers with PC.
The capacitors are used for internal charge pumps to generate +12V and ­12V required for RS­
232 communication.

Operation:

Whenever RFID tag is detected by the reader, the PIC18F45K22 microcontroller receives this
tags through pin RX1 and it sends to server computer through pin TX2. After tag is checked
inside the server message will be received by the microcontroller, pin RX2, to output to the 20 x
4 character LCD display.

4.4.4 LCD display section

Figure 19 LCD display section

27
Description

The PIC18F45K22 microcontroller also used to control the output. LCD (LM044L) is used to
display bus tag and status of the bus. There is resonating network which made up from C1, C2
and crystal. Microcontroller has an on chip oscillator. Variable resistor (0­10k) is placed for
setting the brightness of the LCD.
Operation:
After the tag number is checked inside the server database message will be received by the
microcontroller, status of the bus and tag number, this message is displayed on the LCD. When
LCD rows are filled and if another message comes previously displayed messages will move
upward. The LCD display present bus tag number and status of the bus by moving row contents
upward each time when 4th row is filled.

4.5 Software part of the system


4.5.1 Software design
Use case diagram

A Use Case is a UML modeling element that describes how a user of the system interacts with
the system to perform a discrete unit of work. It describes and signifies a single interaction over
time that has meaning for the end user (person, machine or other system), and is required to
leave the system in a complete state: the interaction either completed or rolled back to the initial
state.

A Use Case:

 Typically have requirements and constraints that describe the essential features and
rules under which it operates.
 Can have an associated Sequence diagram illustrating behavior over time; that does
what to whom, and when.
 Typically has scenarios associated with it that describe the work flow over time that
produces the end result; alternative work flows (for example, to capture exceptions)
are also enabled.

28
The use case diagram explaining the tasks of RFID based Customers Notification System for
Addis Ababa National Bus Station was done as follows:

Figure 20 Usecase diagram

29
Database model

Database model shows the database design of the system, it describes how the data will be stored
and how data’s are related to one another in the system. RFID based Customers Notification
System model was done as follows:

Figure 21 SQL server relational database diagram

4.5.2 C# graphical user interface


This desktop application is to manage every information of the station:

 Configuring RFID port’s


 Opening or closing connection with RFID reader (COM Port)

This form also have tabs for:

 Changing or viewing LCD display messages

30
 Registering new bus and viewing registered buses
 Updating bus information
 Searching for bus information
 Assigning bus for ‘semirit’
 Changing buses from ‘semirit’
 Searching, adding, updating and deleting station destinations
 Searching, adding, updating and deleting destinations price
 User help
 Information about the software and the programmers

This desktop application is only managed and controlled by an authorized person or


administrator of the station. This desktop application can’t be accessed by any other person than
the administrator. There are two forms the login and administrator (home) forms each are
depicted as follows:

Home tab

Figure 22 Home tab section

This tab is used to change LCD display & system messages to administrator. It display list of
available buses and changed bus tag numbers. And it also help the admin of the system to know
what the LCD is displaying currently.

31
Registering new bus

Figure 23 Registering new bus tab on administrator form

This tab is used to register a new bus to server and to view list of buses that are already exist.
The bas tag number, owner/association, owner/association phone, bus number and base name are
entered and the picture of the bus, if any, is uploaded by the officer, the bus level and bus total
capacity are filled by system depending on officers choose.

32
Updating bus information

Figure 24 Updating bus information tab on administrator form

This tab is used to update bus information. Whenever the administrator enter bus tag number, the
whole information about the bus will be displayed on the text fields by the system if bus tag
exist/valid. If the administrator want to change any information he/she can edit any of the fields
after information is field by the system.

33
Assigning bus for Semirit

Figure 25 Assigning bus for semirit tab on administrator form

This tab is add/assign bus semirit. The admin only to choose bus tag then the system will fill
every information about the bus including the picture if any. The admin only enter number of
ticket sold and select date of travel & time at which the bus leave station. The price information
is calculated and filled by the system depending on the level, destination information provided
by the officer. Pricing is done depending on the how far the destination is from Addis Ababa.

34
Updating station destination information

Figure 26 Update destination information tab on administrator form

This tab is used to add/update/search/delete destination information with price information. If


officer wants to search/update/delete destination information destination id is only needed.

4.5.3 System website


This website enables live connection between customers of Addis Ababa bus station and station
to check up their assigned bus status weather the bus is inside station or not, even to know detail
information about the ticket and bus information without going to the station from anywhere.
Also any suggestions are taken into consideration to improve website and station services via
text area.

The main objective of this website is to decrease customer’s chance of losing their bus and as a
result their ticket will be expired by creating an online system which will display all information
about station buses status. Customers can check their bus tag from anywhere so as to prepare
themselves for the journey.

Also this website provides a full information about booking and any pricing information of
different destinations like amount, rate added (if any) and kilometer information. So there is no
need to get in trouble between the customers and station officers.

35
Home page

Figure 27 home page

This page display information about Addis Ababa bus station website why it is developed and
what information it has for the customers. It also help the station administrators to post
advertisements and latest news about the station.

Review page

Figure 28 Review page

36
This page display information like list of currently available buses & list of buses for future
journey with full booking information. This page also display some information about ticking
information of the station. Additionally, it display list of buses for tour and travel.

Station page

Figure 29 Station page

This page acts as LCD display inside the station. Information like available buses, incoming
buses, changed buses and list of all buses that are already leave the station is displayed here. In
addition, it helps customers to check there bus status in which they are assigned for.

Contact page

Figure 30 Contact page

37
If any customers or any user wants to comment, suggest or question the station, he/she can use
this page. He/she can write his/her comment, suggestion or question on the text fields and send to
the station.

About page

Figure 31 About page

This page contains information about background of Addis Ababa bus station and about website.

38
Chapter Five

5 Conclusions and recommendations


5.1 Conclusions
This paper enclosed the documentation phase of the final project. The document explain RFID
Based customer service notification system for Addis Ababa National Bus Station from the
problems that are faced on the current system of the station to the design of the system from the
hardware to the software part by introducing the RFID technology which has brought a vast
difference in day­to­day life.

As part of this project, the project team conducted some activities in an effort to assess the
feasibility of using RFID technology to better manage some problems of Addis Ababa National
Bus station by interfacing the RFID reader and reading from its serial port to the system
application software, building the database and interfacing it with the application software and
website for the station using (ASP.NET, C# and CSS).

The designed automated RFID system of Addis Ababa bus station can solve problems of the
customers like time and energy wasted to find their bus. The system also reduce customer’s
chance of losing their property and expiration of ticket. Additionally, this system informs
customers about booking information, like type and level of available buses with their pricing
information of future travels before they buy ticket. The system can help the officers and
administrators of the station by providing fast and comfort service for their customers. The
administrator can also easily control everything about station by using this automated system.

As a result of various activities conducted through this project, project team developed different
findings like RFID technology and its basic components and applications of RFID, Working on
complicated problems on C#, ASP.NET, SQL Server & Proteus, and Building website driven
database.

39
5.2 Recommendations
Based on the findings generate from the activities of this project, project team offers have the
following recommendation for better performance of the system:

 Tracking exact location of the bus inside the station where it stops
 Online payment system for the booking system
 Text message announcement for the customers if they are late or miss the bus
 Accident report to families of the customers and station officers like where accident
happened
 The website and desktop application would be developed using Multilanguage rather now
we are limited to English so as to address every customers.

40
References
1. EM­18 RFID reader module (https://electrosome.com/shop/em­18­rfid­reader­module/ ).
Retrieved May 11, 2015
2. UART interface with PIC16F877A (https://www.pantechsolutions.net/UART­interface­
with­pic16f877a/). Retrieved May 11, 2015
3. The RS232 primer (http://www.ethernut.de/en/documents/rs232primer.html) Retrieved
May 19, 2015
4. Radio­frequency identification­ Wikipedia, the free encyclopedia
(http://en.wikipedia.org/ wiki/radio­frequency­identification).Retrieved May 11, 2015
5. RFID Application, RFID Technology, Radio Frequency Identification (http://www.
fibre2 fashion.com/industry­article/11/1023/rfid­applications1.asp). Retrieved June 10,
2015
6. RFID technology applications (http://www.technovelgy.com/ct/technology­article.asp).
Retrieved June 3, 2015
7. Ethiopian Road Transport Authority ­ Wikipedia, the free encyclopedia(http://en.wikipedi
a.org/ wiki/ Ethiopian­Road­Transport­Authority). Retrieved June 10, 2015
8. mikroElektronika, (2009). PIC Microcontrollers­Programming in C by Milan Verle,1st
edition
9. MikroC PRO for PIC, Proteus ISIS Professional v7.8 SP2, Visual Studio 2012, SQL
Server Management Studio help manuals
10. PIC18F45K22, EM­18 RFID Reader, MAX232 Data Sheet
11. PIC Lab Manual1.doc by Munammet, September 12,2011

41
Appendices

Appendix A: Circuit diagram of the system

Figure 32 System database entity relationship diagram

42
Appendix B: Sample MikroC code
Configuring RFID reader and reading RFID tag

UART1_Init(9600); // Initialize UART module at 9600 bps

Delay_ms(100); // Wait for UART module to stabilize

UART1_Write_Text("Check EM­18 RFID Reader port");

UART1_Write(10);

UART1_Write(13);

if(UART1_Data_Ready()){

for(i=0;i<4;) {

if(UART1_Data_Ready()){

mytag[i] = UART1_Read();

i++;

}}}

Configuring 20x4 LCD display and displaying tag information

// LCD module connections

sbit LCD_RS at LATB4_bit;

sbit LCD_EN at LATB5_bit;

sbit LCD_D4 at LATB0_bit;

sbit LCD_D5 at LATB1_bit;

sbit LCD_D6 at LATB2_bit;

sbit LCD_D7 at LATB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;

sbit LCD_EN_Direction at TRISB5_bit;

43
sbit LCD_D4_Direction at TRISB0_bit;

sbit LCD_D5_Direction at TRISB1_bit;

sbit LCD_D6_Direction at TRISB2_bit;

sbit LCD_D7_Direction at TRISB3_bit;

// End LCD module connections

Void main(){

Lcd_Init(); // Initialize LCD

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

Lcd_Out(1,1,"Welcome To AANBS"); // Welcome Message

Delay_ms(1000);

Lcd_Out(1,1,"TagNo");

Lcd_Out(1,9,"­­­­Status­­");

if(dcol==3) {

Lcd_Out(2,6,"Inside Station");

Lcd_Out(2,1,output);

for(k = 0; k < 4; k++) {

temp1[k]=output[k];

}dcol+=1;

else if(dcol==4) {

Lcd_Out(3,1,output);

for(k = 0; k < 4; k++) {

44
if(temp1[k ] == output[k]) ++statch;

if(statch==4) status1=1;

if(status1){

Lcd_Out(3,6,"Leave Station");

status1=0;

statch=0;

}else{

Lcd_Out(3,6,"Inside Station");

status1=1;

statch=0;

for(k = 0; k < 4; k++) {

temp2[k]=output[k];

}dcol+=1;

else if(dcol==5) {

Lcd_Out(4,1,output);

for(k = 0; k < 4; k++) {

if(temp1[k ] == output[k]) ++statch;

else if(temp2[k ] == output[k]) ++statch2;

if(statch==4) status1=1;

45
if(statch2==4) status2=1;

if(status1){

Lcd_Out(4,6,"Leave Station");

status1=0; statch=0;

else if(status2){

Lcd_Out(4,6,"Leave Station");

status2=0; statch2=0;

}else{

Lcd_Out(4,6,"Inside Station");

status2=1; statch2=0;

for(k = 0; k < 4; k++) {

temp3[k]=output[k];

} dcol+=1;

} else {

for(k = 0; k < 4; k++) {

temp1[k]=temp2[k]; }

for(k = 0; k < 4; k++) {

temp2[k]=temp3[k]; }

for(k = 0; k < 4; k++) {

temp3[k]=output[k]; }

status1=status2;

46
status2=status3;

for(k = 0; k < 4; k++) {

if(temp3[k ] == output[k]) statch2++;

else statch2=0;

if(statch2==4) status3=1;

if(status1){

Lcd_Out(2,6,"Leave Station");

status1=0;

statch=0;

}else{

Lcd_Out(2,6,"Inside Station");

status1=1;

statch=0;

if(status2){

Lcd_Out(3,6,"Leave Station");

status2=0;

statch2=0;

}else{

Lcd_Out(3,6,"Inside Station");

status2=1;

statch2=0;

47
}

if(status3) Lcd_Out(4,6,"Leave Station");

else Lcd_Out(4,6,"Inside Station");

Lcd_Out(2,1,temp1);

Lcd_Out(3,1,temp2);

Lcd_Out(4,1,temp3);

dcol+=1;

}}

48
Appendix C: Sample C# code
Configuring and reading tags from RFID reader

using System.IO.Ports;

…….

SerialPort sp;

private void sErial(string Port_name) {

if (combPort.SelectedIndex != ­1) {

sp = new SerialPort(Port_name, 9600, Parity.None, 8, StopBits.One);

sp.DataReceived+=new
SerialDataReceivedEventHandler(DataReceivedEventHandler);

sp.Open();

lblReaderStat.Text = "Reader Status: Connected!";

lblReaderStat.ForeColor = System.Drawing.Color.Green;

} else {

sp.Close();

lblReaderStat.Text = "Reader Status: Disonnected!";

lblReaderStat.ForeColor = System.Drawing.Color.Red;

}}

private void DataReceivedEventHandler(object sender, SerialDataReceivedEventArgs e) {

SerialPort sp = (SerialPort)sender;

string w = sp.ReadLine();

if (w != String.Empty) {

Invoke(new Action(() => richTextBox1.AppendText(w))); }}

49
Connecting to database server

using System.Data;

using System.Data.SqlClient;

……

private static SqlConnection con;

……

con=newSqlConnection(@"DataSource=localhost\sqlexpress;InitialCatalog=AACustomerServic
eDB;Integrated Security=True");

…..

try{

con.Open();

…….

finally {

con.Close();

…..

…..

50
Adding new bus

……

try{
byte[] img = null;
FileStream fs = new FileStream(imgLoc, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
img = br.ReadBytes((int)fs.Length);
int TagNum = Convert.ToInt32(txtBusTag.Text);
string OName = txtOwnerName.Text;
string BName = txtBusName.Text;
int BNum = Convert.ToInt32(txtBusNumber.Text);
string BLevel = comboLevel.Text;
int cap = Convert.ToInt32(comboCap.Text);
string query = string.Format(
@"INSERT INTO BusList VALUES ({0}, '{1}', '{2}', '{3}',{4},
'{5}',{6},@img)",
txtBusTag.Text, OName, txtOwnerPhone.Text, BName, BNum, BLevel, cap);
com.CommandText = query;
com.Parameters.Add(new SqlParameter("@img", img));
try {
con.Open();
com.ExecuteNonQuery();
MessageBox.Show("New Bus Registered!");
}finally {
con.Close();
com.Parameters.Clear();
}
} catch (Exception ex) {
MessageBox.Show(ex.Message);}

51
Appendix D: Sample ASP.NET codes
Mater page

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs"


Inherits="AABusStation._content._shard.Main" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Home</title>
<link href="../../_style/main.css" rel="stylesheet" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div id="warpper">
<div id="banner">
<h1>Addis Ababa Bus Station Customer Service</h1>
</div>
<div id="nav">
<ul id="bar">
<li id="Home" class="active" runat="server"><a href="Home.aspx" accesskey="1"
title="Home" >Home</a></li>
<li class="book" id="Booking" runat="server"><a href="Booking.aspx"
accesskey="2" title="Review" >Review</a>
</li>
<li id="Station" runat="server"><a href="Station.aspx" accesskey="3" title="Station
Information" >Station</a>
</li>
<li id="Contact" runat="server"><a href="Contact.aspx" accesskey="4"
title="Contact" >Contact</a></li>

52
<li id="About" runat="server"><a href="About.aspx" accesskey="5" title="About"
>About</a></li>
</ul>
<div id="LoginInfo">
<asp:Label ID="lblLog" runat="server" Text="Welcome Gust!"></asp:Label>
<img src="../_content/_pic/logimg.gif" alt="User Picture" style="height: 30px; width:
30px; " />
<asp:LinkButton ID="linkbtn" runat="server" OnClick="linkbtn_Click">Log
In</asp:LinkButton>
</div>
</div>
<div id="mainContent">
<asp:ContentPlaceHolder ID="CPHmmain" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="footer">
<p>All right is reserved &copy; 2007</p>
</div>
</div>
</form>
</body>
</html>

53
Appendix E: Sample SQL Query
Select bus information by bus tag number and date of travel statement

"SELECT * FROM BusInfo WHERE TagNum =1234 AND sdate='6/13/2015’" ;

Update bus information

“UPDATE busList SET ownername=@oname, ownerphone=@ophone, busname=@bname,


busnum=@bnum, buslevel=@blevel,cap=@cap, buspic=@img where TagNum=4567”;

Delete bus information

“DELETE FROM semirit where BusTag=4567”;

54

You might also like