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

SCHOOL OF ENGINEERING AND TECNOLOGY

DEPARTMENT OF ELECTRONIC ENGINEERING

NEMERAI TRUST

H150118E

SUPERVISOR: MR V. KUNO

HIT 300 REPORT

TITLE: RFID, GSM AND GPS BASED SCHOOL BUS TRACKING SYSTEM

A project submitted in partial fulfilment of the requirements of a Bachelor of Technology

Honors Degree in Electronic Engineering

NOVEMBER 2017
COPYRIGHT
All rights reserved. No part of this research may be reproduced, stored in any retrieval system
or transmitted in any form or by any means, electronic mechanical, photocopying, recording or
otherwise for purpose, without the prior written permission of the author or of Harare Institute
of Technology on or behalf of the author.

i
DECLARATION
I Nemerai Trust do hereby declare that this research project is original. No portion of the work
contained in this report has been submitted in support of any other degree or qualification of
this or any other university or institute of learning.

STUDENT SIGNATURE……………………………………………………….

SUPERVISOR (MR V KUNO)


SIGNATURE……………………………………………………………………….

DATE……………………………………………………………………………………

ii
DEDICATION

I dedicate this project to my family. Your love and never-ending support made this project a
success.

iii
ABSTRACT

In present time due to increase in number of kidnapping and road accident cases, parents always
worry about their children. The project recommended an RFID, GPS, GSM based school bus
tracking system which updates the parents about their child’s transit activity. The GPS
continuously takes input data from the satellite and stores the latitude and longitude values in
pic18f45k22 microcontroller. To identify the identity of the child an RFID card was used.
Whenever a child boards a bus, the RFID tag located in his or her identity card will be detected
by the RFID reader present in the bus and the system will identify the child and send a message
to the particular number of parent which is predefined in the program consisting of the current
location and time. An android application created would then convert the coordinates and show
the location on a map. In this way the parents will be able to keep record of their child's
whereabouts.

iv
ACKNOWLEDGEMENTS

Firstly, I would like to thank all my lecturers who tirelessly shared their knowledge with me
up to this stage. Special mention goes to my supervisor Mr V Kuno who has been a source of
inspiration and guidance ever since I embarked on this project. I also want to thank my parents
for their social and financial support throughout the whole project. It was indeed costly but
they footed all the bills from the start even up to the end. I thank all my friends for the helping
hand they offered throughout the course of the project. Special mention goes to Patson Ngoshi
and Amos Sibanda.

Most importantly I thank God for His love and the Lord Jesus Christ for His grace. This project
is an evidence of the unmerited favour and strength that was working in me. Indeed, it was not
by power nor by might but by the Spirit of the Lord.

v
TABLE OF CONTENTS

COPYRIGHT .............................................................................................................................. i
DECLARATION .......................................................................................................................ii
STUDENT SIGNATURE………………………………………………………. ................ii
DEDICATION ......................................................................................................................... iii
ABSTRACT .............................................................................................................................. iv
ACKNOWLEDGEMENTS ....................................................................................................... v
CHAPTER 1: INTRODUCTION .............................................................................................. 1
1.1 Background of study ............................................................................................................ 1
1.2 PROBLEM DEFINITION ................................................................................................... 2
1.3 PROBLEM SOLUTION ...................................................................................................... 2
1.4 AIM ...................................................................................................................................... 2
1.5 OBJECTIVES ...................................................................................................................... 3
1.6 SCOPE OF STUDY ............................................................................................................. 3
CHAPTER TWO ....................................................................................................................... 4
2.1 LITERATURE REVIEW AND TEORETICAL BACKGROUND .................................... 4
2.2 THEORETICAL BACKGROUND ..................................................................................... 9
2.2.1 GPS TECHNOLOGY ....................................................................................................... 9
2.2.2 NEO-6M GPS module .................................................................................................... 11
2.2.3 GSM SIM900 .................................................................................................................. 12
OVERVIEW OF AT COMMMANDS .................................................................................... 13
2.2.4 RFID READER .............................................................................................................. 14
CHAPTER 3: METHODOLOGY ........................................................................................... 15
3.1 Overview of the system ..................................................................................................... 15
3.2 SYSTEM BLOCK DIAGRAM ......................................................................................... 15
3.3 SYSTEM DESCRIPTION ................................................................................................. 16
3.4 CIRCUIT DESIGN ............................................................................................................ 18
3.4.1 Interfacing microcontroller with GPS ............................................................................. 19
3.4.2 Interfacing microcontroller with GSM AND RFID........................................................ 19
3.4.3 Interfacing microcontroller with LCD ............................................................................ 20
3.4.4 Power regulator circuit diagram...................................................................................... 21
3.4.5 In circuit serial programming (ICSP) connections ......................................................... 22

vi
3.5 SOFTWARE IMPLEMENTATION ................................................................................. 24
3.5.1 Developing the c program ............................................................................................... 24
Communication via AT commands ......................................................................................... 28
3.5.2 Testing the microcontroller program .............................................................................. 30
3.6 Hardware implementation .................................................................................................. 31
3.6.1 Remote circuit PCB design ............................................................................................. 31
3.6.2 PCB circuit implementation ............................................................................................ 32
3.6.3 Prototype wiring.............................................................................................................. 34
CHAPTER 4: RESULTS AND DISCUSSIONS .................................................................... 35
4.1 GPS module with the environment .................................................................................... 35
4.2 RFID reader communication with the microcontroller ...................................................... 35
4.3 Microcontroller communication with the GPS module ..................................................... 35
4.4 Microcontroller communication with GSM module.......................................................... 35
4.5 Analysis of the system behaviour ...................................................................................... 35
CHAPTER 5: CONCLUSIONS AND RECOMMENDATIONS ........................................... 37
5.1 Project summary ................................................................................................................ 37
5.2 Project achievement. .......................................................................................................... 37
5.3 Future recommendations .................................................................................................... 37
Bibliography ............................................................................................................................ 38
APPENDIX A: Mikro C program for the project .................................................................... 39
APPENDIX B:DATA SHEETS .............................................................................................. 53
Table 1: RFID RDM 6300 data sheet ...................................................................................... 53
Table2: GPS NEO 6M Data Sheet ........................................................................................... 55
PIC18F45K22 PIN DIAGRAM ............................................................................................... 56

vii
LIST OF FIGURES

Figure 1.1.1 showing crime distribution against children [2] .................................................... 1


Figure 2. 1.1: Showing ARM 7 Based system [4] ..................................................................... 5
Figure 2.1.2 : Showing pic 18 based children safety system [8] ............................................... 9
Figure 2.2.1. 1 : Showing Orbiting satellites image [9] ........................................................... 10
Figure 2.2.2.1: Showing neo-6m GPS module [10]................................................................. 11
Figure2.2.3.1: Showing GSM sim 900 module ....................................................................... 12
Figure 2.2.4.0.1: Showing rdm6300 RFID reader [12]............................................................ 14
Figure 3.2. 1:Showing System block diagram ......................................................................... 16
Figure 3.3.1: Showing system flow diagram ........................................................................... 17
Figure 3.4.1: Showing Schematic diagram .............................................................................. 18
Figure 3.4.1.1: Showing the Interfacing of GPS to microcontroller ........................................ 19
Figure 3.4.2. 1: Showing the connections for interfacing GSM and RFID to microcontroller20
Figure 3.4.3. 1: Showing LCD connections to microcontroller for simulation ....................... 21
Figure 3.4.4.1: Showing the power regulation circuit diagram ............................................... 22
Figure 3.4.5.1: Showing in circuit serial programming connections ....................................... 23
Figure 3.5.1.1: Showing LCD module connections on port B of the microcontroller ............ 25
Figure 3.5.1.0.2: Showing the program for initialization of the microcontroller .................... 26
Figure 3.5.1. 3:Showing the program for concatenating GPS data ......................................... 27
Figure 3.5.1. 4: Showing the program for the RFID ................................................................ 27
Figure 3.5.1. 5: Showing code for sending message................................................................ 28
Figure 3.5. 1.6: Showing interface blocks ............................................................................... 29
Figure 3.5.2. 1: Showing GPS capturing coordinates using Proteus 8.5 ................................. 30
Figure 3.6.1.1: Showing circuit PCB design ........................................................................... 31
Figure 3.6.1. 2: Showing 3D view of the remote circuit PCB ................................................. 32
Figure 3.6.2.1: Showing the circuit as printed on gloss paper ................................................. 33
Figure 3.6.2.2: Showing the circuit on PCB ............................................................................ 33
Figure 3.6.3.1: Showing GSM GPS RFID and LCD module connections .............................. 34
Figure 4.5.1: Showing the application upon receiving a text message with coordinates ........ 36

viii
LIST OF ABBREVIATIONS

RFID Radio Frequency Identification


GPS Global Positioning System
GSM Global System for Mobile communication
LCD Liquid Crystal Display
USB Universal Serial Bus
TTL Transistor Transistor logic
SMS Short Message Service
AT Attention

ix
CHAPTER 1: INTRODUCTION

1.1 Background of study

School buses play an essential role in transporting school children everyday all over the world.
While there are several problems that might disturb the parents with respect to the travel of
school going kids, this project looks into initiating the safety of school children through a
school bus tracking system that will help the school kids to travel in a more secure way.
According to recent crime statistics, an estimated 60% of children were exposed to violence,
crime or abuse within past few years. [1]

Another report from June 2012, by the FBI in conjunction with the Department of Justice Child
Exploitation and Obscenity Section showed the crime rate distribution against children as
demonstrated in figure 1 below. [2]

Figure 1.1.1 showing crime distribution against children [2]

1
Figure 1.1.1 above clearly shows that the school child is vulnerable to attacks, rape, kidnapping
or abuse and most of such unfortunate scenario happens on their way to school. Safety of the
children has become every parent’s primary concern. Therefore, to ensure a peace of mind of
each parent the system will keep the parents updated about their child’s transit activity. The
system monitors the embarking and disembarking of the child in and out of the bus through the
utilization of RFID, GSM, GPS technologies. It has to be placed on the bus entrance door such
that whenever a child enters or exits the bus, their RFID tag on their ID card is detected by the
RFID reader via radio waves. Each child has to carry a tag that contains a unique number such
that he or she will be identified by the system while entering or exiting the bus. Information
such as location, date, time and child details will be automatically send in form of an SMS to
the corresponding parent’s mobile phone via GSM. Moreover, the same data can be used to
determine the time of departure and arrival. If the bus departs and arrives successfully from the
source to destination, parents will also be informed.

1.2 PROBLEM DEFINITION

Children Safety has become the topmost concern and priority of parents these days. This is due
to the increase in number of kidnapping, abuse, rape and road accident cases. Such unfortunate
scenario may take place on their way to and from school. This leaves the school child
vulnerable to attacks or abuse. Also, almost every parent is an office goer, thus it becomes very
difficult to take their child to and from school on a daily basis. Parents are often worried if their
child has reached their destination safely. They need to trust that their child is safe.

1.3 PROBLEM SOLUTION

To eliminate this problem the school bus tracking system will confer an acknowledgement
message to the parents about their child’s transit activity.

11

1.4 AIM

2
To design and implement an RFID, GSM and GPS based school bus tracking system.

1.5 OBJECTIVES

• To Interface an RFID reader, GSM, and GPS module with the pic18f445k22 microcontroller.

• To develop a mikro C program that will enable the microcontroller to capture data from RFID
reader and retrieve location details from the GPS module and send them via GSM.

• To create an interface which upon receiving coordinates will be able to show location of the
bus on a map.

1.6 SCOPE OF STUDY

• RDM 6300 RFID reader


• GSM SIM900 modem and AT commands
• PIC 18f45k22 microcontroller
• GPS module
• Mikro C Programming

3
CHAPTER TWO

2.1 LITERATURE REVIEW AND TEORETICAL BACKGROUND

This segment is an assessment of the already existing vehicle monitoring systems that utilized
RFID, GPS and GSM technologies. The key constituents of this project will be analysed in
detail, beginning with work done in similar projects. This will be followed by a glance on the
theory behind the core components used in the project.

Remote monitoring and tracking of object devices have been around for years. Research has
showed that there are many studies that made use of Radio Frequency identification (RFID) as
a system that transmits the identity of an object using radio waves by Kumar [3]. This identity
is transmitted in a form of serial number that distinguishes each object from others. The RFID
system consists of an RFID reader and an RFID tag. The tag consists of the microchip that is
connected to an antenna. The microchip can store a maximum of 2 KB of data, which may
include data and information about the product, manufacturing date, and destination.
Furthermore, the author also observed that the ability of the reader field decreases quickly with
increasing distance.

G. Bharathi, L. Ramurthy proposed a system to trace the missed student using GSM- GPS
technology [4]. An ARM 7 is used to process the given information and to send the appropriate
location of the missed student by adopting the GSM technology. The Missed Student Latitude
and Altitude locations are determined by adopting the GPS Technology. The ARM based
system is as shown below.

4
Figure 2. 1.1: Showing ARM 7 Based system [4]

The system gave real time notifications and updates about child location using GPS and
Biometric identification from a few minutes before child entered the bus till the child reached
their destinations. This system was integrated with high performance STM32 ARM Controller.
However, the major drawback was that it was difficult for the children to place their ARM
detection correctly on the scanner. This often lead to inaccurate data, if the scanner did not
detect the Child’s tag by the ARM Controller. Also, the system cost was very high due to the
use of STM32 ARM Controller which is expensive.

Another study carried out by Shafaat [5] for the Emirates Transport in Dubai applied new
technologies in order to upgrade transport services and raise the level of traffic safety during
the transfer the school students and as well as, to allow families of the students to trace the
route of their children while they are in school buses. This system consists of three techniques,
such as smart card, tracking device and the golden rule. The student scans the card when he/she

5
come up to the bus via a device fixed in the bus and he should do the same thing when he got
off from the bus. Based on that parent receives a text message during the student scan of the
card when entering and exiting. The tracking device technique also will enable parents to
determine the route of the bus to follow its path on a map that can be found via a mobile phone,
once the student entered the bus, and scanned the card. On the other hand, the golden rule,
which is a golden box drown on the area of parking buses inside a red box that is bigger than
it is to warn students from bypassed. In order to alert them to not cross the road when there is
a vehicle and it avoid deadly stampedes or presenting in front of the bus moving, for their own
safety to avoid exposure to any harm. Since implementation, it was observed that the use of
this system has led to many positive results, as it has significantly reduced the number of
incidents of schools.

Another research [6] by Professor. S.P. GODSE showed an efficient and systematic way of
using RFID tracking applications coupled with smart phone technologies to fulfil the key
security and monitoring purposes. The professor investigated the effects of variable
localization of RFID tags from reader and power loss, inefficiency and distance constraints
caused due to equal power allocations to the tags. Reducing the number of reader by using
smart antenna and increasing coverage area, several other sectors will be hopefully able to
leverage the benefits of RFID technology and smart antenna using adaptive algorithm.

The Haversine formula is an equation important in navigation, giving great-circle distances


between two points on a sphere from their longitudes and latitudes [7]. These names follow
from the fact that they are customarily written in terms of the haversine function, given by

The haversine formula is used to calculate the distance between two points on the Earth’s
surface specified in longitude and latitude.

6
Where,

Lat=Latitude
Long=Longitude
R=Earth Radius I.e. Radius 6,371km

The algorithm worked as follows:

1. Start
2. Get the current location coordinates of the bus from the GPS.
3. Get the coordinates of the prominent locations and bus stop from the area set to which
the current location coordinates of the bus correspond.
4. Calculate the Haversian distance between the coordinates obtained from step 1 to each
of the coordinates obtained in step 2.
5. Calculate the minimum Haversian distance from the results of step 4.
6. Return the minimum obtained distance from step 5 to the server.

Another research Ben and Abdullah [8] introduced a system that monitors children inside the
bus in a safe manner. It used a combination of RFID, GPS and GPRS technologies. Each
student carries a unique RFID card. The card is embedded in each of the student’s school bags.
Whenever a student enters or exits from the bus, the reader records the time, date, and location

7
and then transfer the data into a secure database and this does not require any action from the
drivers and students.

The system enables parents to receive instant SMS alerts within 10 minutes of the designated
pick up and drop off points, reducing the time the child spends on the street. The system will
also notify the parents via SMS when the student boards from the bus or when entering and
leaving the school, this will make the parents take the appropriate action because they have
precise answers to boarding statue and times. If the child is still inside the bus for a
predetermined period after running the bus engine, and bus’s doors are closed, a message will
be sent to school management, and the system will display the location of the bus.

In addition, the system includes a web -based reporting that makes it fast and easy access to
get accurate information, such as student report that provides a data and time for all the
activities of loading and unloading by students, and bus report that provides all student
ridership data by bus. The system diagram by Ben and Abdullar is as shown below:

8
Figure 2.1.2 : Showing pic 18 based children safety system [8]

2.2 THEORETICAL BACKGROUND


This section highlights the theoretical aspects leading to the development of the project. It
includes the concept of GPS and GSM communication. The major components of the project
being RFID, GPS and GSM modules and how these three serial devices can be multiplexed
on one serial port of the pic18f45k22 microcontroller.

2.2.1 GPS TECHNOLOGY


The GPS is a U.S owned utility that provides users with positioning, navigation and timing
services. It is a network of orbiting satellites that send precise details of their position in space
back to earth. The signals are obtained by GPS receivers, such as navigation devices and are
used to calculate the exact position, speed and time at the vehicles location.

9
GPS is well-known for its military uses and was first developed by the US to aid in its global
intelligence efforts at the height of the Cold War.
Ever since the early 1980s, however, the GPS has been freely available to anyone with a GPS
receiver [9]. Airlines, shipping companies, trucking firms, and drivers everywhere use the GPS
system to track vehicles, follow the best route to get them from A to B in the shortest possible
time.

Figure 2.2.1. 1 : Showing Orbiting satellites image [9]

GPS satellites circle the Earth twice a day in a precise orbit. Each satellite transmits a unique
signal and orbital parameters that allow GPS devices to decode and compute the precise
location of the satellite. GPS receivers use this information and trilateration to calculate a user's
exact location. Essentially, the GPS receiver measures the distance to each satellite by the
amount of time it takes to receive a transmitted signal. With distance measurements from a few
more satellites, the receiver can determine a user's position and display it electronically.

10
2.2.2 NEO-6M GPS module
The NEO-6M GPS module was used in this project to capture the coordinates from the orbiting
satellites. The data sent down to earth from each satellite contains a few different pieces of
information that allows the GPS receiver to accurately calculate its position and time.

Figure 2.2.2.1: Showing neo-6m GPS module [10]

11
2.2.3 GSM SIM900

GPRS/GSM Module is an ultra-compact and reliable wireless module. It is a breakout board


and minimum system of SIM900 Quad-band GSM/GPRS module. It can communicate with
controllers via AT commands (GSM 07.07, 07.05 and SIMCOM enhanced AT Commands).
This module support software power on and reset.

Figure2.2.3.1: Showing GSM sim 900 module

12
The GPRS is configured and controlled via its UART using simple AT commands.

OVERVIEW OF AT COMMMANDS

TABLE 2.2.3.1 Displaying an overview of AT Commands

13
2.2.4 RFID READER
RFID is an acronym for “radio-frequency identification” and refers to a technology whereby
digital data encoded in RFID tags are captured by a reader via radio waves. RFID methods
utilize radio waves to accomplish this. At a simple level, RFID systems consist of three
components: an RFID tag or smart label, an RFID reader, and an antenna. RFID tags contain
an integrated circuit and an antenna, which are used to transmit data to the RFID reader (also
called an interrogator). The reader then converts the radio waves to a more usable form of data.
Information collected from the tags is then transferred through a communications interface to
the pic18f45k22 microcontroller. An RDM 6300 RFID reader was used in this project.

Figure 2.2.4.0.1: Showing rdm6300 RFID reader [12]

14
CHAPTER 3: METHODOLOGY

3.1 Overview of the system


The core function of the developed system is to monitor the embarking and disembarking of
school children in and out of the school bus through the utilization of RFID, GSM, GPS
technologies. It should send information such as location, date, time and name of child in form
of an SMS to the corresponding parent’s mobile phone via GSM whenever a tag a swiped. The
system utilizes a pic18f45k22 microcontroller which has two UART ports so as to
accommodate all the three serial communication devices mentioned above. The GPS
continuously takes input data from the satellite and stores the latitude and longitude values in
the microcontroller. The microcontroller will then pass the coordinates to the GSM whenever
they are required. The system has to be placed on the bus entrance door such that whenever a
child enters or exits the bus, their RFID tag on their ID card is detected by the RFID reader via
radio waves. The system will then compare the scanned number on the RFID tag with the
numbers predefined in the program. After a particular child is identified an acknowledgement
message is then send to the corresponding parent in form of an SMS.A Google maps
application interface will then open a map to show the location of the bus.

3.2 SYSTEM BLOCK DIAGRAM


The system block diagram of the system in figure 3.2.1 below shows how the main components
of the system are interconnected. As shown in the block diagram below the major system
components are the GPS, GSM, RFID and microcontroller. The diagram gives a visual aid on
the components working relationships.

15
Figure 3.2. 1:Showing System block diagram

3.3 SYSTEM DESCRIPTION


The system obtains the location of the school bus by using the GPS module which acquires the
latitude and longitude coordinates from the satellite after a tag is swiped on the RFID reader.
The microcontroller then parses the GPRMC string to separate the latitude from the longitude
as well as the date and the time. The pic18f45k22 microcontroller then sends these coordinates
via the GSM to the parent’s mobile phone. An android application will then convert the
coordinates into a real location on a map.

16
Figure 3.3.1: Showing system flow diagram

17
3.4 CIRCUIT DESIGN
This section describes the design of the circuit. The main design aspects being the interfacing
of the GSM module, GPS module, RFID reader and LCD to the microcontroller.

Figure 3.4.1: Showing Schematic diagram

18
3.4.1 Interfacing microcontroller with GPS

The GPS module required four pins namely VCC, TX and GND

Figure 3.4.1.1: Showing the Interfacing of GPS to microcontroller

3.4.2 Interfacing microcontroller with GSM AND RFID


The GSM module required three pins which are VCC of 5volts supply, TX and GND.

The RFID reader also required three pins namely VCC, RX and GND.

19
Figure 3.4.2. 1: Showing the connections for interfacing GSM and RFID to microcontroller

3.4.3 Interfacing microcontroller with LCD


A 16 x 2 LCD was used which contained three sections: the power section, the data section and
the control section. The power section was powered using the power supply (pins VSS, VDD,
A, K and VO). The data pins D0 to D3 were left hanging since the LCD was using in 4bit
mode. The control pins RS, EN were connected to the microcontroller on port D together with
the data pins D4 TO D7 as shown in figure 3.4.3.1 below.

20
Figure 3.4.3. 1: Showing LCD connections to microcontroller for simulation

3.4.4 Power regulator circuit diagram


The power regulator circuit was designed to power the whole circuit with a supply voltage of
5V. The supply powered all the devices that required a 5v dc supply namely, microcontroller,
GSM, GPS, RFID and LCD. The source of voltage supply was a 12-volt dc battery whose
voltage went through the power regulation circuit and produced 5v dc. Figure 3.4.4.1 below
shows the regulator circuit diagram.

21
Figure 3.4.4.1: Showing the power regulation circuit diagram

3.4.5 In circuit serial programming (ICSP) connections


ICSP is a way of programming a PIC while it is still attached to the circuit. It avoids the
movement of the microcontroller in and out of the programmer which usually damages the
microcontroller pins. It requires the five pins namely VCC, GND, PGD, PGC and MCL.

22
Figure 3.4.5.1: Showing in circuit serial programming connections

23
3.5 SOFTWARE IMPLEMENTATION
The microcontroller software program was developed using Mikro C compiler which was used
to acquire GPS data, parse the data then concatenate it and send it to the GSM module via
UART. Google maps application software was ten used to show the real location on map.

3.5.1 Developing the c program

The C program was developed using Mikro C ide and the code was tested using Proteus 8.5
simulation software. The main parts of the C program being: initialization of the LCD and
UART modules, RFID memory compare, parsing of the GPS data, concatenation of the data,
and sending data via GSM to mobile phone. Below are a few snippets showing some of the
main parts of the program.

24
Figure 3.5.1.1: Showing LCD module connections on port B of the microcontroller

25
Figure 3.5.1.0.2: Showing the program for initialization of the microcontroller

26
Figure 3.5.1. 3:Showing the program for concatenating GPS data

Figure 3.5.1. 4: Showing the program for the RFID

27
Figure 3.5.1. 5: Showing code for sending message

Communication via AT commands

AT commands are used to control modems. The abbreviation AT is from the word ATtention.
Each command starts with the abbreviation AT. The commands can be used by GPRS/GSM
modules. In order to send an SMS from the GSM module, the command AT+CMGS is used.

AT+CMGF=1 - this AT command sets the GSM module in SMS mode and it will then be
prepared to send.

AT + CMGS = \+263777613167\ " – this command takes the recipient number as an argument.
The number is written in international format.

These AT commands were used in the program in order to send a message to the parent’s
mobile phone.

28
The diagram below on figure 3.5.1.6 shows the interface of the MIT AppInventor Code blocks
web platform where the interface was developed.

Figure 3.5. 1.6: Showing interface blocks

Figure 3.5.1.7: Showing the interface display


29
3.5.2 Testing the microcontroller program
The GPS module was connected to the PC via a USB to TTL cable which was connected to the
com serial in Proteus software. The program was loaded in the microcontroller for testing. The
GPS responded as according to the program by displaying the captured coordinates on the
terminal window as shown in the snippet below in figure 3.5.2.1.The LCD also displayed
properly.

Figure 3.5.2. 1: Showing GPS capturing coordinates using Proteus 8.5

30
3.6 Hardware implementation
This section shows the steps in the development of the printed circuit board until it was a
complete system with all the described components necessary to perform the system
functionality as highlighted in earlier chapters.

3.6.1 Remote circuit PCB design


The PCB was designed using Proteus design software. It was a continuation of the schematic
developed for the simulation used for testing the C program. The arrangement of the
components on the PCB was aimed at maintaining a logical design for presentation purposes
and also for avoiding unnecessary jumpers.

Figure 3.6.1.1: Showing circuit PCB design

31
Figure 3.6.1. 2: Showing 3D view of the remote circuit PCB

3.6.2 PCB circuit implementation


The PCB design circuit was printed using a laser jet printer on gloss paper. The gloss paper
was ironed while on the PCB and the immersed in water to remove the part of the paper which
had stuck on the PCB. The board is then immersed in etching solution which reacts with the
exposed copper leaving the ink and the copper beneath it untouched. The end result is just a
PCB with only the required tracks.

32
Figure 3.6.2.1: Showing the circuit as printed on gloss paper

Figure 3.6.2.2: Showing the circuit on PCB

33
3.6.3 Prototype wiring
The section shows the hardware interfacing of the components used in the project the main
components being the GSM, GPS, RFID reader, LCD and microcontroller.

Figure 3.6.3.1: Showing GSM GPS RFID and LCD module connections

34
CHAPTER 4: RESULTS AND DISCUSSIONS
The project was generally a success. The planned objectives were met.

4.1 GPS module with the environment


The GPS module was able to capture the coordinates in any orientation in space and inside a
closed room. It had minimal interference to other radio and microwave devices such as mobile
phones.

4.2 RFID reader communication with the microcontroller


The RID reader could read all the tags whose numbers were predefined in the program and the
microcontroller was able to compare these numbers and identify the owner of the tag.

4.3 Microcontroller communication with the GPS module


The GPS module managed to communicate with the microcontroller as it was able to receive
coordinates and display them on the LCD.

4.4 Microcontroller communication with GSM module


The GSM and microcontroller were able to communicate only after a tag was swiped. The
GSM would successfully send an SMS to the parent’s mobile phone.

4.5 Analysis of the system behaviour


All the tests were done in an area were the GSM network is quite established and hence no
network disruptions were experienced throughout the implementation and testing process.
Therefore, the system could perform efficiently. It was able to retrieve data from the GPS
module and concatenate the data into longitude, latitude, date, time and date. All this data was
passed to the GSM which would then send them to the parent’s mobile phone in form of an
SMS. An android application waiting for the message in the mobile phone would successfully
convert the GPS coordinates into a location on map and the result is as shown on figure 4.5.1
below.

35
Figure 4.5.1: Showing the application upon receiving a text message with coordinates

36
CHAPTER 5: CONCLUSIONS AND RECOMMENDATIONS

The project was an excellent experience. A lot was learnt.

5.1 Project summary


The aim of the project was to provide a way to inform parents about their school children’s
whereabouts. This was achieved by acquiring coordinates of the location of the school bus
using a GPS module and send them via GSM. These coordinates were to be received by an
application interface which would then open a map showing the location of the child. In this
way, parents will be well updated about their child’s transit activity.

5.2 Project achievement.


The hardware and software components of the system managed interact with each other so as
to meet the project objectives. The system was able to determine the child who had swiped tag
at that time and inform the respective parent. The application interface was well capable of
opening the map upon receiving the GPS coordinates.

5.3 Future recommendations

Incorporation of a passive RFID reader in place of the active one since the active RFID tags
can continuously send signals to the reader hence eliminating the swiping of tags.

A finger print scanner could also be used instead of an RFID reader since the tags can easily
be lost.

A database can be added to the system so as to accommodate as many school children as


possible as well as reducing the length of the program.

37
Bibliography
[1] Anon., 2011. Smart school bus monitoring and tracking system. IEEE Trans. Single
processing, 55 (9), 200-205. Available Online:
http://www.hammruki.com/html/products/monitoring.html

[2] Anon., 2012. School Bus Tracking – Student Tracker. Single processing. 3(1), 34-45.
Available Online] : http://www.sifa.com/school_bus.php.

[3] C. Kumar, “RFID based embedded system for vehicle tracking and prevention of road
accident”. International Journal of Engineering Research-, Vol.1, No. 6, pp3-5, 2012.

[4] Finkenzeller, Klaus, RFID Handbook: Fundamentals and applications in contact- less smart
cards and identification, John Wiley & Sons, Ltd., 2003.

[4]H.ben, & Abdullah, k.,“Smart tracking system for school buses using passive rfid
technology to enhance child safety”. Traffic and logistics engineering-,. vol.1,no.2,pp.191-
196,2013..

[5] S. Shafaat, UAE launches smart school buses to improve students’ safety system to offer
parents direct access to bus status”. 1 (2). Available
Online:http://www.emaratalyoum.com/local-section/education/2013-04-22-1.568158

[6] Zonar, 2013. Zpass: Student Ridership Tracking. International research.4 (1), 20-25.
Available Online: http://www.zonarsystems.com/products/zpass-student-tracking/.

38
APPENDIX A: Mikro C program for the project

#include "rfid uart.h"

// LCD module connections

sbit LCD_RS at RB0_bit;

sbit LCD_EN at RB1_bit;

sbit LCD_D4 at RB2_bit;

sbit LCD_D5 at RB3_bit;

sbit LCD_D6 at RB4_bit;

sbit LCD_D7 at RB5_bit;

sbit LCD_RS_Direction at TRISB0_bit;

sbit LCD_EN_Direction at TRISB1_bit;

sbit LCD_D4_Direction at TRISB2_bit;

sbit LCD_D5_Direction at TRISB3_bit;

sbit LCD_D6_Direction at TRISB4_bit;

sbit LCD_D7_Direction at TRISB5_bit;

// End LCD module connections

/******************************Variable
declarations*****************************************/

double longitude,latitude,speed_mps; // GPRMC and GPGGA

float degrees, minutes;

unsigned int UTCHour, UTCMin, UTCSec, UTCDay, UTCMonth, UTCYear; // GPRMC

39
char statusF; // Status byte, 'A' is OK

short flag,i;

int res;

char is_it_trust[] = "33001FAAD95F";

char is_it_spog[] = "33001FAA0F89";

char is_it_tom[] = "0B0032F7F739";

unsigned char shifted[100];

/******************************Saving strings to ROM


Memory*****************************************/

const char *lat = "lat =";

const char *lon = "lon =";

char date[] = "Date";

char time[] = "Time";

/***********************DEFINITION OF
FUNCTIONS**********************************/

void initNMEA(void) ; // init UART and variables

unsigned short parseNMEA(void) ; // parse NMEA, return 0 if no errors, see time_Out above

void copySpeed(char *) ; // copy field[12] or cal value to speed[] up to '\0' terminator

unsigned int strToInt(char *) ; // returns integer value of argument, times 100 to lose DP

char waitChar(void) ; // wait for byte from UART

char getField(char, char) ; // call waitChar() until delimiter, or runout

int charToInt(char c){ return (c - 48);}

void print_UTCdate(void);

40
void print_UTCtime(void);

void print_Speed(void);

void print_distance(void);

void print_Coordinates(void);

char msg[21]; //declare array set to max size required plus 1 [for terminator] for copying into

// copy const to ram string

char * CopyConst2Ram(char * dest, const char * src){

char * d ;

d = dest;

for(;*dest--- = *src--;)

return s;

// Global constants

const char EOL = '\r' ; // \r is CR escape sequence for end of NMEA sentence

// Global variables for NMEA interface

volatile char speed[15] ; // quick storage for speed data

// Global variables not needed for NMEA interface

41
volatile char field[15] ; // temporary buffer for each NMEA field

volatile unsigned short checksum ; // running checksum from NMEA input

void initNMEA(void)

{ // initialise UART

// initialise stuff

ANSELB = 0;

ANSELC = 0;

ANSELD = 0;

ANSELA = 0;

ANSELE = 0;

INTCON.GIE = 1;

INTCON.PEIE = 1;

PIE1.RC1IE = 1;

PIR1.RC1IF = 0;

IPEN_BIT = 0;

UART1_Init(9600); // Baud = 9600

delay_ms(250);

UART2_Init(9600);

Delay_ms(250) ; // allow to stabilise

TRISB = 0;

PORTB = 0;

TRISD.B0 = 0;

Delay_ms(50);

42
Lcd_Init(); // Initialize LCD

delay_ms(50);

Lcd_Cmd(_LCD_CLEAR); // Clear display

msgR.B1 = 1;

msgR.B2 = 1;

msgR.B3 = 1;

unsigned short waitChar(void)

while(!UART2_Data_Ready());

return UART2_Read() ; // return character from UART

void parse_gps(void)

char gpsHdr[]="$GPRMC," ; // string to search for in UART RX stream

unsigned short c,i;

i= 0;

while(1){

c = waitChar() ; // wait for next character from UART

string[i] = '\0';

break;

43
string[i] = c;

i++;

if( memcmp(string,gpsHdr,7)==0){

strcpy(str,strtok(string,gpsHdr));

UTCHour = 2 + 10*charToInt(str[0]) + charToInt(str[1]);

UTCMin = 10*charToInt(str[2]) + charToInt(str[3]);

UTCSec = 10*charToInt(str[4]) + charToInt(str[5]);

if(UTCHour>=24) UTCHour = UTCHour - 24; // Changing UTC time to UTC +2 hours

//Data status (V=navigation receiver warning)

strcpy(str,strtok(0,","));

statusF = str[0];

// Latitude (float dddmm.mmmm = 10 char)

strcpy(str,strtok(0,","));

latitude = atof(str);

// get decimal format

degrees = trunc(latitude / 100.0f);

minutes = latitude - (degrees * 100.0f);

latitude = degrees + minutes / 60.0f;

strcpy(str,strtok(0,",")); // 'N' or 'S' (1 char)

if (str[0] == 'S') latitude *= -1.0;

44
// Longitude (float dddmm.mmmm = 10 char)

strcpy(str,strtok(0,","));

longitude = atof(str);

degrees = trunc(longitude / 100.0f);

minutes = longitude - (degrees * 100.0f);

longitude = degrees + minutes / 60.0f;

strcpy(str,strtok(0,",")); // 'E' or 'W' (1 char)

if(str[0] == 'W') longitude *= -1.0;

//Speed over ground in knots

strcpy(str,strtok(0,","));

speed_mps = atof(str); // convert to mps

speed_mps *= 0.51444444;

// parse UTC date

strcpy(str,strtok(0,","));

UTCDay = 10*charToInt(str[0]) + charToInt(str[1]);

UTCMonth = 10*charToInt(str[2]) + charToInt(str[3]);

UTCYear = 2000 + 10*charToInt(str[4]) + charToInt(str[5]);

45
//**********************AT commands initialization**************

const char AT[]="AT\r\n"; //

const char noecho[]="ATE0\r\n"; //command to gsm for no echo

const char mode_text[]="AT+CMGF=1\r\n"; //command to send msg

const char mobile_no[]="AT+CMGS=\"+263777613167\"\r\n"; //command containing


number to be sent msg

char terminator = 0x1A;

const char *empty = "AT+CMGD=1,4\r\n";

//********************String transmit function****************

void send_to_GSM1(char *s)

while(*s)

UART1_WRITE(*s++);

void UART_Write_CText(const char *cptr)

char chr;

for ( ; chr = *cptr ; ++cptr ) UART1_Write(chr);

void Send_Msg()

46
UART_Write_CText(AT);

delay_ms(1000);

UART_Write_CText(noecho);

delay_ms(1000);

UART_Write_CText(mode_text);

delay_ms(1000);

UART_Write_CText(mobile_no);

delay_ms(1000);

void send_txt(){

char u[] = "m/s. ";

char lat[] = "Lat = ";

char lon[] = "Lon = ";

char sp[] = "ground speed = ";

Send_Msg();

sprintf(send, "%s%f. %s%f. %s %d/%d/%d. %s %d:%d:%d"


,lat,latitude,lon,longitude,date,UTCDay,UTCMonth,UTCyear,time,UTCHour,UTCMin,UTC
Sec);

delay_ms(100);

send_to_GSM1(send);

void print_Coordinates(void){

47
sprintf(buffer, "%s %f. ",CopyConst2Ram(msg,lat),latitude); // Format ww and store
it to buffer

Lcd_out(1,1,buffer);

sprintf(buffer, "%s %f.",CopyConst2Ram(msg,lon),longitude); // Format ww and store


it to buffer

Lcd_out(2,1,buffer);

delay_ms(10);

void main()

int j;

initNMEA(void);

while(1){

Lcd_Out(1,1," SCHOOL BUS ");

LCD_Out(2,1,"TRACKING SYSTEM");

parse_gps();

if(msgR.B0 == 1){

LATD.B0 ^= 1;

if(statusF == 'A'){ // return 0 if gps data is valid

Lcd_Cmd(_LCD_CLEAR);

Lcd_Out(1, 1, "LOCATING DONE!");

memset(send,' ',100);

print_Coordinates();

send_txt();

48
delay_ms(500);

Lcd_Cmd(_LCD_CLEAR);

else if(statusF == 'F'){

Lcd_Cmd(_LCD_CLEAR);

Lcd_Out(1, 1, "LOCATING FAILED!");

delay_ms(500);

statusF = 0;

LATD.B0 ^=0;

for(j=0;j<12;j++){

shifted[j] = response[j+1];

}j=0;

LCD_CMD(_LCD_CLEAR);

Lcd_Out(1,1," IDENTIFYING ");

LCD_Out(2,1,shifted);

delay_ms(2000);

if(memcmp(is_it_trust,shifted,12) == 0){

LATD.B0 ^= 1;

if(msgR.B1 == 1){

send_to_gsm1(" TRUST AS EMBARKED ON

49
THE SCHOOL BUS!");

UART1_write(0X1A);

delay_ms(200);

UART1_WRITE(0X0D);

delay_ms(2000);

msgR.B1 = 0;

else if (msgR.B1 == 0){

send_to_gsm1(" TRUST HAS


DISEMBARKED THE SCHOOL BUS!");

UART1_write(0X1A);

delay_ms(200);

UART1_WRITE(0X0D);

delay_ms(2000);

msgR.B1 = 1;

if(memcmp(is_it_spog,shifted,12) == 0){

LATD.B0 ^= 1;

if(msgR.B2 == 1){

send_to_gsm1(" SPOG HAS EMBARKED


ON THE SCHOOL BUS!");

UART1_write(0X1A);

delay_ms(200);

UART1_WRITE(0X0D);

50
delay_ms(2000);

msgR.B2 = 0;

else if (msgR.B2 == 0){

send_to_gsm1(" SPOG HAS


DISEMBARKED THE SCHOOL BUS!");

UART1_write(0X1A);

delay_ms(200);

UART1_WRITE(0X0D);

delay_ms(2000);

msgR.B2 = 1;

if(memcmp(is_it_tom,shifted,12) == 0){

LATD.B0 ^= 1;

if(msgR.B3 == 1){

send_to_gsm1(" TOM AS EMBARKED ON


THE SCHOOL BUS!");

UART1_write(0X1A);

delay_ms(200);

UART1_WRITE(0X0D);

delay_ms(2000);

msgR.B3 = 0;

else if (msgR.B3 == 0){

51
send_to_gsm1(" TOM HAS
DISEMBARKED THE SCHOOL BUS!");

UART1_write(A);

delay_ms(200);

UART1_WRITE(0);

delay_ms(2000);

msgR.B3 = 1;

msgR.C = 0;

LCD_CMD(_LCD_CLEAR);

LATD.B0 =0;

52
APPENDIX B:DATA SHEETS

Table 1: RFID RDM 6300 data sheet

53
54
Table2: GPS NEO 6M Data Sheet

55
PIC18F45K22 PIN DIAGRAM

56
57
58

You might also like