You are on page 1of 85

PROJECT DOCUMENTATION

Automated Sri Lanka Railway
Ticket Issuing System
Submitted by
Sivasankar Sutharshan
Student No: HN/12/41/11
Edexcel No: DZ63843

Project Coordinator: Mr. T. Anis Saboordeen

BTEC HND in Computing and Systems Development
BRITISH COLLEGE OF APPLIED STUDIES – CITY CAMPUS

Automated Sri Lanka Railway Ticket Issuing System

CERTIFICATION
This is to certify that this project, the entire design and creation of the Automated Sri Lanka
Railway Ticket Issuing System was carried out and submitted as true work of Sivasankar
Sutharshan of Registration number DZ63843 under the supervision of senior lecturer & Project
Coordinator Mr. Anis saboordeen of the Department of school of computing, British College of
Applied Studies – Sri Lanka in partial fulfillment of the requirements for the award of BTEC
HND in Computing Systems Development.

------------------------------------------------Mr. Anis Saboordeen

-------------------------------------------Date

Project Coordinator / Senior Lecturer of
BCAS

2

Automated Sri Lanka Railway Ticket Issuing System

Acknowledgement
I would like to thank my lecturer Mr.Anis Saboordeen for offering his precious time, continuous
help and support regarding this project for its success. My heartfelt of gratitude goes to you
for helping me at every step with necessary guidance.
Secondly, I wish to thank BCAS library for providing books efficiently which helped me
extremely, to gain knowledge on the subject matters and as guidance for this project.
Thirdly, I would like to thank my friends and batch mates for everything that they have done to
help me with this project, and also my parents for providing me with all necessary equipment
and support.
Finally, I thank BCAS to giving me such individual project to gain my knowledge most practical
in Project Design Implementation and Evaluation.

3

Automated Sri Lanka Railway Ticket Issuing System

Abstract
In present situation, the Sri Lanka Railway ticketing Issuing system is more tedious. People
are standing in long queues for getting tickets especially in public mode of transportation. This
leads to unnecessary time wastage and energy waste. Some Railway departments without
taking tickets causing and lead huge loss to the transport department of Sri Lanka Railways.
This paper attempts to provide a feasible solution for this problem of manual ticketing by the
implementation of Automated Railway Ticket Issuing System.
This report also presents the details on the architecture, integration and different design
aspects of Automated Railway Ticket Issuing System. Wide operating range, low cost of
equipment and reliability are some of the major advantages of this proposed project. It is
envisioned that the Automated Railway Ticket Issuing System shall eventually replace the
manual ticketing systems of Sri Lanka Railways and hence provide a feasible way for better
transportation facilities.
This report gives a detailed description about the project including feasibility study, research,
cost analysis, project millstones and final outcome of the project. It also suggests further
improvements that can be carried out for achieving a better system in future.

4

Automated Sri Lanka Railway Ticket Issuing System

Abbreviations
IDE - Integrated Development Environment
RTIS - Railway Ticket Issuing System
ARTIS - Automated Railway Ticket Issuing System
RTC - Real Time Clock Module
I2C - Interface to Communicate
LCD - Liquid-crystal display
VDC - Volts Direct Current
GND - Ground
SDA - Serial Data Line
SCL - Serial Clock Line

5

Automated Sri Lanka Railway Ticket Issuing System

Contents
Acknowledgement ............................................................................................................................. 3
Abstract ................................................................................................................................................ 4
Abbreviations ...................................................................................................................................... 5
1.

Introduction ............................................................................................................................... 10
1.1. Aim of the Project ................................................................................................................... 10
1.2.

Project Objectives .............................................................................................................. 10

2.

Literature Review ..................................................................................................................... 12

3.

Analysis & Detailed Investigation ........................................................................................ 14
3.1. The present situation ............................................................................................................. 14
3.2. Drawbacks and requirement analysis ................................................................................. 15
3.3. Proposed solutions for each drawbacks ............................................................................. 17

4.

Software Requirements .......................................................................................................... 19

5.

Hardware Requirements......................................................................................................... 19
5.1. Arduino Mega 2560 ................................................................................................................ 20
5.2.

Arduino Ethernet Shield .................................................................................................... 22

5.3.

Coin Acceptor (Programmable 6 Coin Type) ................................................................. 24

5.4.

Mini Thermal Receipt Printer ............................................................................................ 26

5.5.

I2C Serial Enabled 16x2 LCD Module Display Screen ................................................ 29

5.6.

5x4 Matrix 20 Key Membrane Switch Keypad ............................................................... 31

5.7.

Piece Piezo Buzzer ............................................................................................................ 33

5.8.

I2C RTC DS1307 Real Time Clock module ................................................................... 35

5.9.

YWROBOT Relay (5VDC) ................................................................................................ 36

6.

Cost Analysis ............................................................................................................................ 38

7.

Project Progress Plan ............................................................................................................. 40

8.

System Design .......................................................................................................................... 43

9.

8.1.

The Overview of RTIS System Design ............................................................................ 43

8.2.

How RTIS System Works For Passengers .................................................................... 44

8.4.

How RTIS System Works For Administrators ................................................................ 45

8.5.

RTIS System Web Interface ............................................................................................. 46

8.6.

Arduino IDE and Sketch Overview in the concern of RTIS ......................................... 47

Implementation of RTIS .......................................................................................................... 49
9.1.

Block Diagram of the Automated Railway Ticket Issuing System .............................. 49

6

Automated Sri Lanka Railway Ticket Issuing System
9.2.

Tiny RTC I2C real time clock module block Diagram & Coding ................................. 50

9.3.

5x4 Matrix 20 Key Membrane Keypad block Diagram & Coding ............................... 53

9.4.

I2C Serial Enabled 16x2 LCD Module Block Diagram & Coding ................................ 56

9.5.

Ywrobot Relay (5VDC) with Coin Acceptor Block Diagram & Coding ....................... 57

9.6.

Coin Acceptor 4 Coin Programmable Block Diagram & Coding ................................. 58

9.6.1.

Coin Parameters Setting ........................................................................................... 59

9.6.2.

Reset All Coin Parameters........................................................................................ 59

9.6.3.

Coin Acceptor Parameters Setting .......................................................................... 60

9.6.4.

Dip Switch Functions Setting .................................................................................... 62

9.7.

Thermal Receipt Printer Block Diagram & Coding ........................................................ 65

9.8.

Piezo Buzzer Block Diagram & Coding .......................................................................... 68

9.9.

Ethernet Shield Diagram & Coding.................................................................................. 70

9.10. Actual Output of the Automated RTIS System once the entire code implemented.. 71
10.

Testing .................................................................................................................................... 72

10.1. Conclusion ............................................................................................................................. 74
11.

Evaluation .............................................................................................................................. 75

11.1 Current Status of Manual SL Railway Ticket Issuing System – Evaluation ................. 76
11.2. Current Failures of Manual SL Railway Ticket Issuing System – Evaluation ............. 77
11.3. Best Solution to Overcome Current issues – Evaluation ............................................... 77
11.4. User Friendly of Automated RTIS – Evaluation ............................................................... 78
11.5. Performance speed of Automated RTIS – Evaluation .................................................... 78
11.6. Conclusion ............................................................................................................................. 79
12.

Contingency Plan ................................................................................................................. 80

13.

Conclusion ............................................................................................................................. 82

14.

References & Bibliography................................................................................................ 84

Table 1 Specifications of Arduino Mega Board ............................................................................. 22
Table 2: Coin Acceptor Pin Definition ............................................................................................. 26
Table 3: Thermal Printer Pin Definition ........................................................................................... 28
Table 4: I2C LCD Pin Definition ....................................................................................................... 31
Table 5: Keypad Pin Definition ......................................................................................................... 33
Table 6: Piezo Buzzer Pin Definition ............................................................................................... 34
Table 7: RTC I2C Pin Definition ....................................................................................................... 36
Table 8: Ywrobot Relay Pin Definition ............................................................................................ 38
Table 9: Total cost for Project Components ................................................................................... 38
Table 10: Total Cost for Maintenance ............................................................................................. 39
7

Automated Sri Lanka Railway Ticket Issuing System
Table 11: Total Cost for Developing ................................................................................................ 39
Table 12: Total Cost for RTIS Project ............................................................................................. 39
Table 13: Project WBS ...................................................................................................................... 42
Table 14: RTC I2C Coding ............................................................................................................... 52
Table 15Keypad Coding.................................................................................................................... 54
Table 16: LCD I2C Coding ................................................................................................................ 56
Table 17: DIP Switch Setting ............................................................................................................ 62
Table 18: Coin Acceptor Coding ...................................................................................................... 64
Table 19: Thermal Printer Coding ................................................................................................... 68
Table 20: Buzzer Coding................................................................................................................... 69
Table 21: RTIS Test Plan .................................................................................................................. 74
Table 22: Contingency Plan ............................................................................................................. 81

Figure 1: Arduino Mega 2560 ........................................................................................................... 20
Figure 2: Arduino Mega Pin out Diagram ....................................................................................... 21
Figure 3: Ethernet Shield .................................................................................................................. 22
Figure 4: Ethernet Pin out Diagram ................................................................................................. 23
Figure 5: Coin Acceptor..................................................................................................................... 24
Figure 6: Thermal Printer .................................................................................................................. 26
Figure 7: 2.1mm Jack ........................................................................................................................ 28
Figure 8: Wiring Printer with Arduino .............................................................................................. 29
Figure 9: I2C LCD Display ................................................................................................................ 29
Figure 10: I2C LCD Back cover ....................................................................................................... 30
Figure 11: 5*4 Matrix Keypad ........................................................................................................... 31
Figure 12: Piece Piezo Buzzer ......................................................................................................... 33
Figure 13: RTC I2C ............................................................................................................................ 35
Figure 14: RTC Pin Definition........................................................................................................... 36
Figure 15: Ywrobot Relay ................................................................................................................. 36
Figure 16: Ywrobot Relay Pin Definition ......................................................................................... 37
Figure 17: Project Timeline ............................................................................................................... 42
Figure 18: RTIS Flow Chart for Passengers .................................................................................. 44
Figure 19: RTIS Flow Chart for Administrators.............................................................................. 45
Figure 20: RTIS Web Interface ........................................................................................................ 46
Figure 21: Arduino IDE Tool ............................................................................................................. 48
Figure 22: RTIS System Block Diagram ......................................................................................... 49
Figure 23: RTC I2C Block Diagram ................................................................................................. 50
Figure 24: Actual Output RTC Coding ............................................................................................ 52
Figure 25: Actual Output of RTC I2C Module ................................................................................ 53
Figure 26: Keypad Block Diagram ................................................................................................... 53
Figure 27: Actual Output of the Keypad Coding ............................................................................ 55
Figure 28: Actual Output of Keypad Wiring .................................................................................... 55
Figure 29: LCD I2C Block Diagram ................................................................................................. 56
Figure 30: Actual Output of LCD I2C Wiring .................................................................................. 57
Figure 31: Relay with Coin Acceptor Block Diagram .................................................................... 57
8

Automated Sri Lanka Railway Ticket Issuing System
Figure 32: Actual Output of Relay with Coin acceptor.................................................................. 58
Figure 33: Coin Acceptor Block Diagram ....................................................................................... 58
Figure 34: Dip Switch......................................................................................................................... 62
Figure 35: Actual Output of Coin acceptor coding ........................................................................ 64
Figure 36: Actual Output Coin Acceptor Wiring ............................................................................. 65
Figure 37: Thermal Printer Block Diagram ..................................................................................... 65
Figure 38: Actual Output of the Thermal Printer............................................................................ 68
Figure 39: Buzzer Block Diagram .................................................................................................... 68
Figure 40: Actual Output of Buzzer ................................................................................................. 69
Figure 41: Ethernet Shield Block Diagram ..................................................................................... 70
Figure 42: Actual Ouput of Ethernet Shield.................................................................................... 70
Figure 43: Actual Output of RTIS System ...................................................................................... 71
Figure 44: Questionnaire................................................................................................................... 76
Figure 45: Current Manual Railway Status .................................................................................... 76
Figure 46: Current Manual Railway Failures.................................................................................. 77
Figure 47: Best Solution .................................................................................................................... 77
Figure 48: User Friendly Evaluation ................................................................................................ 78
Figure 49: RTIS Peforamnce Speed ............................................................................................... 78

9

Automated Sri Lanka Railway Ticket Issuing System

1.Introduction
Assessment is looked into a service sector as a whole to progress the established and
proposed network systems and techniques used. Railway is been considered which is one of
the major public service sector in Sri Lanka.
Background and the idea is develop an automated railway ticket issuing system. Considering
such a goal reveals cost effectiveness and the ability and capability of its use that suits the
best for Sri Lankan railway department. Further this idea of establishment would reduce time
wastage, better use of replacement, reduction in cost of labour, satisfaction for customers,
reduction of frauds, easy accessibility and overall better service for passengers.
These description are the objectives that would derive to our problem definition of Automated
Railway Ticket Issuing System being implemented to reduce the long ticket queues which
occur in peak hours, as the aim of this project is to incur a low cost and efficient model of a
system which can be used to reduce the congestion at ticketing queues.

1.1. Aim of the Project
Automated Railway Ticket Issuing System designed to reduce the long ticket queues which
occur in peak hours. The aim of this project to come up with a low cost and efficient model of
a system which can be used to reduce the congestion at ticketing queues.

1.2. Project Objectives
The main goal of this project is to develop an Automated Railway Ticket Issuing System which
is cost effective and suits the Sri Lankan Railway department context. The system will
effectively reduce the time taken to obtain a ticket at a ticketing counter. It will aim to reduce
long queues at ticket counters thus reducing time wastage. The objective of a project as
follows:
 Develop an efficient system that can replace the current traditional system.
 To minimize the usage of human resources involved in issuing tickets.
 To minimize the cash involvement in purchasing a ticket.
 To minimize the time required to obtain a Railway Ticket.
 Should be able to facilitate a large number of subscribers.
 To build a long term customer relationship between passengers and Sri Lanka Railway
transport department.
 To eliminate frauds which are done by passengers.
10

Automated Sri Lanka Railway Ticket Issuing System
 To provide user friendly and easier system to Sri Lanka Railway department to do their
job efficiently.
 Save time and ultimately make the journey pleasant for the commuters.
 Make all the railway schedules easily accessible to the general public.
 To enhance the speed and the availability of the Railway ticket issuing process and
thereby to provide a better service for the passengers.

11

Automated Sri Lanka Railway Ticket Issuing System

2. Literature Review
The system implementation of automated ticket issuing grabs the efficiency and reduction on
labour act which results the passengers to deal directly, feel free to operate as no third party
interaction.
“The solution allows to overcome the extreme human intervention to the current ticket
issuance process. The proposed system will be an automated system so that SLRD will be
able to manage their ticketing transaction efficiently.”
http://www.slideshare.net/razmik1/railway-ticket-issuing-system-online
As for the proven statement of fact, the act of the system concretes its output once it is been
implemented. The highlighted gained betterment would be overall less interaction of labour
and efficient.
“MobiTiki is an automated train ticketing system designed to reduce the long ticket queues
which occur in peak hours.”
http://lms.uom.lk/sf/shantha/Project-web-sites/2007-08/Grp-04Mobitiki/Website/documents/Mobitiki%20DraftReport_Group04_final_ver1.pdf
As for the fact, it is clearly stated or proved that automated ticketing system reveals reduction
on queues as it keeps control during busy hours. Therefore the designed system achieves its
aim for sure, efficient model at lower cost.
“In Pakistan passengers get a ticket at the counter, it is a time consuming process and
create problems if passengers are in hurry during rush hours. So it becomes necessary
to implement an automatic train ticketing machine, which contain all destination tickets and
easy to use for all passengers for 24 hours”.
http://www.taibahu.edu.sa/iccit/alliccitpapers/pdf/p707-qureshi.pdf
This statement clearly highlights the problem definition of the assessment and also the exact
solution is mentioned as the implementation of automated ticket machine which clearly states
the concrete path at which the assessment is progressed.
These facts supports and strengthens the mention solution of suggestion and it leads to its
implementation on Sri Lankan Railway Operation as well.

12

Automated Sri Lanka Railway Ticket Issuing System
“The Ascom Easy Ticket is a railway ticket issuing system used in Britain, consisting of a
series of self-service (passenger-operated) machines at railway stations. Having been
introduced in 2003 by several Train Operating Companies (TOCs) [13].”
http://www.taibahu.edu.sa/iccit/alliccitpapers/pdf/p707-qureshi.pdf
As modern use on 2003 it is proved at Britain the use of automated ticketing was implemented
as for the required which must have highlighted several functions to overcome their current
problems. For Sri Lankan use and the possibility of implementation was considered in
preparation of the machine as for the possibilities it was prepared, the implementation would
highlights reduction on Sri Lankan Railway Operating System.
“Main features • High speed ticket issuance • High Reliability • User friendly GUI • Quick
response, User Friendly, GUI starting window, Select Destination, Date of Departure, Number
of Passengers Select the Class Transaction Detail Payments Successful Payment”
http://www.slideshare.net/razmik1/railway-ticket-issuing-system-online
These features are commonly been used on an automated ticket machine. This applies to the
introduced machine which holds all these features and its use and possibility of
implementation was considered on terms of Sri Lankan environment.
Railway Ticket Issuing System (2012)
Automated Train Ticket System (2008)
Automated Train Ticket System(2012)

13

Automated Sri Lanka Railway Ticket Issuing System

3.Analysis & Detailed Investigation
3.1. The present situation
It becomes difficulty of monitoring the process. From the government side it is difficult to
monitor the railway transportation system in a simple manner this is because of poor public
relationship.
A long queue at the ticket counter is something regularly experienced by the train commuters
using the Sri Lankan railways. The gravity of this problem is clearly visible in the morning and
in the evening, just after office hours have ended. Other than the obvious wastage of time in
the queues, the stress and frustration created by this problem, on people daily, is another
major concern.
The main reason for long queues at ticket counters is, in most stations there are not enough
ticket counters to handle the peak time crowd. But it is not practicable to increase the number
of ticket counters just to serve at peak time. Another reason is the time taken for one
passenger to buy a ticket. The person at the counter has to issue the ticket and deal with the
“change”. This increases the time taken to complete the transaction which means more time
consuming.
The current Railway Ticketing System dispense train tickets at railway stations in the absence
of sales persons sometimes. Automated Railway Ticket Issuing System has been
implemented in many countries as the number of passengers increases day by day, but not
yet in Sri Lanka. In Sri Lanka passengers get a ticket at the counter, it is a time consuming
process and create problems if passengers are in hurry during rush hours. So it becomes
necessary to implement an Automated Railway Ticket Issuing System.
In the developed countries of Europe and in the USA there are automated ticketing systems
which use smart cards. Through the use of these cards they have successfully addressed the
above questions. In fact most of these smart card systems have almost eliminated the queues.
In some countries this transaction can be done via the user’s credit card.
The solution to these problem is to automate the system. But I have to consider the Sri Lankan
context when deciding how to automate the system. The credit card system is obviously not
suited since a significant number of train commuters do not use credit cards. If I consider the
smart card systems the initial cost of these systems are huge. And the cost of maintaining
such high tech system will most probably outweigh the benefits provided by it.

14

Automated Sri Lanka Railway Ticket Issuing System
The system I have suggested is an automated system. The automated part addresses the
problem of long queues. The proposed RTIS aims to solve the problem of dealing with actual
money. By this way, the time taken in exchanging money and receiving the railway ticket will
be completely eliminated.
The solution implements a Railway Ticket Issuing System (RTIS) for the Sri Lanka Railways
Department (SLRD). The solution allows to overcome the extreme human intervention to the
current ticket issuance process. The proposed system will be an automated system so that
SLRD will be able to manage their ticketing transaction efficiently in future by the
implementation of proposed ARTIS (Automated Railway Ticket Issuing System).

3.2. Drawbacks and requirement analysis
Current situation of the Railway Operating System highlights several drawbacks that steps
forward as a problem, as a result requirements being not fulfilled. These issues are derived in
several forms such as:
 Public mode of transportations:
In present situation, the Sri Lanka Railway ticketing Issuing system is more tedious.
People are standing in long queues in order to get their tickets. This pattern of
experience itself is a problem where the people get more frustrated and they lose their
valuable time.

 Peak hour situation:
In such situation, because of poor public relationship there is no special actions taken
to handle busy hours. Main reason is that there are not enough ticket counters to
handle and also the employees are not active enough to perform at their best as the
nature of public service sector comes into play.

Example: This problem is clearly visible in the morning and in the evening, just after
office hours have ended.
 Issue of ticket and dealing with the “money”:
Issue of ticket and change of transactions are performed manually. The consumption
of time leads to more queues and error of transaction is possible which leads to
misunderstanding.

15

Automated Sri Lanka Railway Ticket Issuing System
 Human Resources:
This process involves a significant amount of human resources which results in high
cost and the provided service is not at its best to satisfy the customers. Delivering
wrong message, lack of knowledge and poor customer relationships are been figured
out.

Example: when a passenger is questioning, wrong message are delivered or for the
sake of saying. Different labours work at each counters and as per their turns, the
passenger will not be able to check out with the same person.
 Language issue:
Normally at public service sector the majority of the labours stick to their mother
tongue and the flexibility in other languages are very poor. This leads to a barrier as
the passenger would be willing or be comfort at his/her preferred language.

Example: if the labour has to assist a foreigner as for his/her needs, the preferred
language by the passenger should at least be managed by the labour.
 Ticket details and print:
Details mentioned on the tickets are not clearly visible and print is manually done at
low quality. Issue of tickets are manually done where the efficiency lacks as the
labours are active enough.

Example: Date mentioned on back of the ticket is not usually clear enough as a result
fraud is possible.
 Collection of tickets and manual records:
Collection of tickets at each station manually seeks an idea or just a record of saying
the number of tickets issued and collected. Collection of tickets are not followed
properly to figure the exact records. Possibilities for frauds are high.

16

Automated Sri Lanka Railway Ticket Issuing System

3.3. Proposed solutions for each drawbacks
Current environment of the railway department of Sri Lanka highlights its problem in its
operation as the proposed suggestion would provide solutions as the implementation takes
place.

 Change in the pattern of experience:
This is where the machinery is replaced instead of a labour in issuing the tickets for
the passengers. As it is programmed, machine is efficient enough to operate
according to the rush of the passengers and as for their operations. Due to this
replacement, the passengers move at a speed as they are free to deal direct and no
third party (labour) is involved.
Movement along the passengers would be fast, reducing the time consumption and
pattern of operation would be efficient.
 Peak hours situation:
During these hours as for the problem, the proposed implementation would increase
the efficiency in providing the tickets. The passengers are directly involved in obtaining
the tickets as for their hurry they will be able to operate the machine.
Also the operating machine could be located at preferred numbers as for the comfort
that would reduce the stress and problems at peak hours.
 Issue of ticket and dealing with the “money”:
Quick progress in issuing the tickets as the machine is involved each passenger can
manage their own time individually and also the error in issuing or the transactions are
followed automatically.
 Human resources:
Solution is that the machine would replace the labour as a result the cost of labour is
reduced which would impact directly on the quality of work as well. No issues on
delivering the message regarding the issue of tickets as it’s automatically done directly
with the passenger no third party involved.
 Language issue:
Flexible and comfort by using the system as it demonstrates standard language
(English).
17

Automated Sri Lanka Railway Ticket Issuing System

 Ticket details and records:
Details mentioned are accelerated automatically where date time are mentioned
clearly to avoid fraud. Issue of tickets cannot be faked or replaced since the records
are followed be serial codes.
Issue of the tickets and its records are automatically saved as records where proper
and standard way of records are followed throughout for any reference.

18

Automated Sri Lanka Railway Ticket Issuing System

4. Software Requirements
For the development of Automated Railway Ticket Issuing System, the following development
tools and software packages are required and will be used as identified:
 Arduino IDE 1.5.5 (used for development of the prosed system)
 Adobe Dreamweaver CS6 (used for the purpose of creating a website as part of the
system)
 Fritzing IDE (used for the purpose of drawing diagrams)
 Adobe Photoshop CS6 (used for the purpose of drawing diagrams)

5. Hardware Requirements
The proposed Automated Railway Ticket Issuing System must require following system
requirements in order to run smoothly.
 Processor : 3000 MHz
 RAM : 1GB (minimum)
 Hard Disk : 40 GB (minimum)
 Monitor : 17 inches (favorable)
 Operating System: Windows XP/Vista/ or 7
The Automated Railway Ticket Issuing System must require following hardware components
in order to build it.
 Arduino Mega 2560 R3
 Arduino Ethernet shield R3 with micro SD connector
 Coin Acceptor 4 Coin Programmable
 Thermal Receipt Printer
 I2C Serial Enabled 16x2 LCD Module Display Screen
 5x4 Matrix 20 Key Membrane Switch Keypad
 Piezo Buzzer - PS1240
 Breadboard
 Tiny RTC I2C real time clock module
 Ywrobot Relay (5VDC)
 Jumper Male and Female Wires

19

Automated Sri Lanka Railway Ticket Issuing System

5.1. Arduino Mega 2560
The Arduino Mega 2560 is a microcontroller
board based on the ATmega2560 which has 54
digital input/output pins (of which 15 can be used
as PWM outputs), 16 analog inputs, 4 UARTs
(hardware serial ports), a 16 MHz crystal
oscillator, a USB connection, a power jack, an
ICSP header and a reset button.
Figure 1: Arduino Mega 2560

It contains everything required to support the
microcontroller. This can be simply connect it to

a computer with a USB cable or power it with an AC-to-DC adapter or battery to get started
on the board.
The Mega 2560 R3 also adds SDA and SCL pins next to the AREF additionally. There are
another two new pins placed near the RESET pin; one is the IOREF which is used to allow
the shields to adapt to the voltage provided from the board and other pin is a not connected
and is reserved for future purposes.
The Mega2560 R3 differs from all previous boards in that it does not use the FTDI USB-toserial driver chip. Instead, it features the ATmega16U2 programmed as a USB-to-serial
converter which means this board now uses an ATMega16U2 instead of the ATMega8U2 chip.
This allows for faster transfer rates and more memory.
Revision 2 of the Mega2560 board has a resistor pulling the 8U2 HWB line to ground, making
it easier to put into DFU mode.
This Mega 2560 R3 Arduino board has chosen for RTIS project because Arduino based ARTIS
has many advantages over existing microcontroller based ARTIS, some of these advantages
are; simple structure, high reliability, speed, an open-source platform, flexible, easy-to-use
hardware and software, number of input/output ports, performance and less power
consumption which are all very important in every design.
Apart from this, Arduino board designed to make it easier to control projects and Mega 2560
R3 has more FLASH memory and extended interface features with add-on shields to build
complex circuits within the project.

20

Automated Sri Lanka Railway Ticket Issuing System
The Arduino Mega 2560 R3 Pin out diagram given below:

Figure 2: Arduino Mega Pin out Diagram

Arduino Board Mega 2560(NA)
Specifications of Arduino Mega 2560 R3 board

Microcontroller

ATmega2560

Operating Voltage

5V

Input Voltage (recommended)

7-12V

Input Voltage (limits)

6-20V

Digital I/O Pins

54 (of which 15 provide PWM output)

Analog Input Pins

16

21

Automated Sri Lanka Railway Ticket Issuing System
DC Current per I/O Pin

40 mA

DC Current for 3.3V Pin

50 mA

Flash Memory

256 KB of which 8 KB used by boot loader

SRAM

8 KB

EEPROM

4 KB

Clock Speed

16 MHz

Table 1 Specifications of Arduino Mega Board

5.2. Arduino Ethernet Shield
This is an Arduino Ethernet Shield which
allows an Arduino board to connect to the
internet for different purposes. It is based
on the Wiznet W5100 Ethernet chip.
The Wiznet W5100 provides a network (IP)
stack capable of both TCP and UDP. It
supports up to four simultaneous socket
Figure 3: Ethernet Shield

connections. The Ethernet shield connects

to an Arduino board using long wire-wrap headers which extend through the shield. This keeps
the pin layout intact and allows another shield to be stacked on top.
The Ethernet Shield has a standard RJ-45 connection, with an integrated line transformer and
Power over Ethernet enabled. The shield also includes a reset controller, to ensure that the
W5100 Ethernet module is properly reset on power-up.
This Arduino Ethernet Shield has chosen for RTIS project to act as webserver to host a
Railway Website for the Railway Administrators to change the tickets prices and to do
administrative works. Apart from this there is an onboard micro-SD card slot in this shield,
which can be used to store files of website for serving over the network. It is compatible with
the Arduino Mega.
The shield must be assigned a MAC address and a fixed IP address using the Ethernet Begin
function on the sketch. A MAC address is a globally unique identifier for this device. This
Ethernet shields come with a sticker indicating the MAC address to should use with them. To
use the shield, all require is, mount it on top of an Arduino Mega board.
Arduino Ethernet Shield(NA)
22

Automated Sri Lanka Railway Ticket Issuing System

The Ethernet Pin out diagram given below:

Figure 4: Ethernet Pin out Diagram

 Arduino communicates with both the W5100 and SD card using the SPI bus (through
the ICSP header). This is on D11, D12, and D13 on "classic" format Arduino models,
and pins D50, D51, and D52 on the Arduino Mega.
 D10 is used to select the W5100 and cannot be used for general I/O.
 D4 is used for the SD card and can only be used for general I/O if the SD slot is not
occupied.
 D2 is used if a solder bridge is placed across the "INT" pads to connect it to the W5100's
INT pin.
 On the Mega, the hardware SS pin, D53, is not used to select either the W5100 or the
SD card, but it must be kept as an output or the SPI interface won't work.
 A0 is connected to the SD slot's write protect (WP) pin and A1 is connected to the card
detect switch. Both are pulled high by 10k resistors on the Ethernet shield. These pins
therefore cannot be used for analog input with the shield unless they are bent back or
clipped off before inserting the shield into the Arduino Mega.
23

Automated Sri Lanka Railway Ticket Issuing System

5.3. Coin Acceptor (Programmable 6 Coin Type)

It’s a coin acceptor. It’s an electronic coin acceptor
with high reliability. This coin validator/acceptor
module has the ability to accept up to 6 different
coins.
Any coin from 15mm to 29mm in diameter can be
used to this acceptor. Each coin is assigned a
number of pulses, so for example, a 1 rupee coin
should be 1 pulse, a 2 rupee coin, 2 pulses, and a
Figure 5: Coin Acceptor

5 rupee coin, 5 pulses.

When a valid coin is inserted, the output line will pulse for 20-60ms (which is configurable).
The acceptor looks for diameter, thickness, dropping speed, etc to determine if a coin is valid.
This coin acceptor also has a coin reject, so can be programmed the controller can tell the
coin acceptor not to take any more coins, as well as a (very loud) alert beeper.
This coin acceptor has chosen for RTIS project because it’s widely used in amusement
facilities, vending machines and so on with high reliability and less cost effective compare to
other acceptors. As per my project, this will be used to accept coins as set on the controller in
order to get a receipt of a railway transport ticket.
Main Features of Coin Acceptor
 Capable of accepting all worldwide coins.
 Enable to recognize 6 groups of coins in different denomination.
 Enable to forbid accepting all coins
 Enable to release coins in jam
 Intelligent control and high accuracy
 Self-programming without PC
 Automatic self-test for problems and prevent not only electric shock but also from
electromagnetic interference.
 Serial or Pulse-Width Output with Selectable Speed/Baud Rate
Coin Acceptor - Programmable (6 coin types) - COM-11636 (NA)

24

Automated Sri Lanka Railway Ticket Issuing System
Specifications of Coin Acceptor
 Coin Size:
Diameter:17 – 30.5mm
Thickness:1.25 – 3.2mm
 Working Environment:
Working Temperature 0°C to 50°C
Storage Temperature:-30°C to55°C
Ambient Humidity:Up to 95% RH non-condensing
Working Voltage:Normal 12VDC
Min 10VDC
Max 15VDC
Working Current:Stand by 50mA
Max 450mA
Communication Interface:Standard parallel port -- 10Pin
Special serial port -- 5Pin
Installation Position:On any plane, the angle can't be more than 2 degrees
between coin acceptor and vertical.

Pin Definition:
Coin Acceptor

Arduino Mega 2560

Red Line Wire

DC+12V (V+)

White Line Wire

COIN Signal (COIN)

Black Line Wire

Ground(GND

25

Automated Sri Lanka Railway Ticket Issuing System

Brown line Wire

Counter (COUNTER), (when
don’t connect to counter, this
line can be unused)

Blue Line Wire

Control line (CONTROL), (if
necessary)

Table 2: Coin Acceptor Pin Definition

5.4. Mini Thermal Receipt Printer

It’s a thermal printer which also known as
receipt printers. It will print simple strings
passed to it via TTL serial, bitmap images
and it even generates several different
formats of barcodes. Its need a 3.3V-5V
TTL serial output from the microcontroller
to print text, barcodes, bitmap graphics
and a QR code.
Figure 6: Thermal Printer

The thermal printer takes 2.25" (57mm) wide thermal paper with a max roll diameter of 1.5
(39mm). The back panel has 2 3-pin connectors; one for power and one for serial
communications. The thermal printer ships with default 19200bps baud rate. It will also need
a 5 to 9VDC regulated power supply which can provide 1.5A or more during the high-current
print when taking prints.
The print head has a rated life of 50km which means this printer can handle a distance of 30
miles of printing before the head hits its rated limit.
This Mini Thermal Receipt Printer has chosen for RTIS project because it’s widely used in
ticket machine print, weight machine print, queue machine print and so on with high reliability
and less cost effective compare to other mini thermal printers. This printer also suits RTIS
because it’s easy to make Bold, underline, inverted text, variable line spacing, left/center/right
justification, barcodes in 11 standard formats with adjustable height and custom bitmap
graphics. As per my project, this will be used to take print of Railway tickets that as set on the
Arduino controller.
Thermal Receipt Printer (NA)
26

Automated Sri Lanka Railway Ticket Issuing System
Main features of Mini Thermal Receipt Printer
 Smart appearance
 Easy paper loading
 Low noise thermal printing
 Different interfaces optional
 Front panel make paper replacement easily
 Easily embedded to any kinds of instruments and meters
 Generates several different formats of barcodes
Specifications of Mini Thermal Receipt Printer
 Print:
Printing Method:Thermal Dot Line
Printing Speed:50-80mm/s
Resolution:8 dots/mm, 384 dots/line
Effective Printing Width:48mm
 Character:
Character Set :ASCII,GB2312-80(Chinese
Print Font:ANK:5×7, Chinese: 12x24,24×24
 Paper Specification:
Paper Type: Thermal paper
Paper Width:57.5± 0.5mm
Paper Roll Diameter:Max: 39mm
 Paper Specification:
Paper Type: Thermal paper
Paper Width:57.5± 0.5mm
Paper Roll Diameter:Max: 39mm
 Reliability:
MCBF:5 million lines
 Interface: Serial(RS-232,TTL), Parallel

27

Automated Sri Lanka Railway Ticket Issuing System
 Insert Depth: 50mm
 Power Supply (Adapter): DC5V-9V
Outline Dimension (WxDxH):111x65x57mm
 Physical:
Installation Port Size:103 x 57mm
Color:Beige/Black
 Environment:
Operating Temp:5°C ~ 50°C
Operating Humidity:10% ~ 80%
Storage Temp:-20°C ~ 60°C
Storage Humidity:10% ~ 90%

Pin Definition:
Thermal Receipt Printer

Arduino Mega 2560

Green Wire

Digital Pin 5

Yellow Wire

Digital Pin 6

Black Wire

GND

Red Wire attached to DC

(+) Plus

Power Jack

Black Wire attached to DC

(-) Mines

Power Jack
Table 3: Thermal Printer Pin Definition

Red wire and Black wire which comes from the Printer DC should be connected to 2.1mm jack
adapter as shown below according to pin definition:

Figure 7: 2.1mm Jack

28

Automated Sri Lanka Railway Ticket Issuing System
At the Arduino end, the green wire connects to digital pin 5, yellow goes to digital pin 6 and
black to any of the GND pins as shown below according to pin definition:

Figure 8: Wiring Printer with Arduino

5.5. I2C Serial Enabled 16x2 LCD Module Display Screen

It’s an I2C LCD display which can be used to
display two rows of characters, and each row
is 16 characters.
It has four address pins, high-speed I2C
interface 3400KHZ, and including LCD
16characters

x

2lines

with

LCD-STN

negative blue type is white character on blue
background. LCD text & numeric display
interface to I2C bus are SCL and SDA and
Figure 9: I2C LCD Display

support LCD contrast adjustment with fine
adjustment of a trimpot to any desired

contrast setting and support LED backlight-white to turn on or turn off the LED backlight with
program control LED backlight to save power and including pull-up resistors to "pull-up" the
signals to prevent SCL line & SDA line from floating.
With this I2C interface LCD module, it’s able to realize data display via only 2 wires. This I2C
interface LCD module has chosen for RTIS project because it uses only two pins on
microcontroller and works over the I2C/TWI bus, widely used in all projects and this module
actually cost no more resources at all compare to other LCD modules.
Serial IIC/I2C/TWI 1602 16x2 Character LCD Module, NA
Features of I2C Serial Enabled 16x2 LCD
 Easy to use, make your project convenient and concise.
 I2C 16X2 LCD, less pins and easy to be controls
 Two line (2 x 16) characters
29

Automated Sri Lanka Railway Ticket Issuing System
 5x8 dots with cursor line
 +5V supply
 Serial Interface I2C, SPI or RS232/TTL
 Display mode: STN/Gray/Positive/Transflective
 High operating temperature range: -20C - +70C
 Driver: SPLC780D with PIC16F690 providing high level functions. (These functions
provide ease of use without needing to understand the low level LCD controller
instructions and timing requirements.)
 Direct access to low level controller is available for advanced control.
 Space reserved for eight custom characters.
 16 software setable brightness levels for backlighting.
 No additional components required to drive backlight.

Figure 10: I2C LCD Back cover

1. Trimpot Variable Resistor 10KΩ ± 10%, 0.5w to fine adjust LCD contrast to any desired
contrast setting.

2. JP4 Jumper & JP5 Jumper (Default) connect to pull up resistors for enable pull up resistors
to "pull-up" the signals to prevent SCL line & SDA line and set default value (5Vdc) when
there is no signal at the input. SCL is a serial clock line and SDA is a serial data line.
3. Microchip MCP23008 provides 8bit I/O port expander with serial interface which can
interface to several devices up to 8 devices on one bus. Each device must have a different
address, three address pins, parallel I/O expansion for I2C bus or SPI applications, highspeed I2C interface 3400 KHz, voltage supply 1.8V to 5.5V, current 1mA.
4. A2, A1, A0 Jumpers will be set device address to interface conneted device. This I2C LCD
Blue Board sets address = 0 (Default). A2, A1, A0 jumpers are disable.
5. I2C Bus Connector to connect other boards on I2C bus are SCL line and SDA line. I2C bus
connector consists of +5V, SCL, SDA and GND pin.
30

Automated Sri Lanka Railway Ticket Issuing System

6. JP6 Jumper will be set RW pin to write data to LCD or read data from LCD This I2C LCD
Blue Board sets default to write data to LCD by solder JP6 jumper to connect GND. RW pin
is cleared (0). Optional is set RW pin to read data from LCD by de-solder JP6 jumper to
disconnect GND. RW pin is (1).
7. Pin Header 16pins connect between I2C and LCD.
Pin Definition:
I2C Serial Enabled 16x2

Arduino Mega 2560

LCD Module
Pin 1

GND

Pin 2

VCC (+5V)

Pin 3

SDA ( Pin 20)

Pin 4

SCL ( Pin 21)

Table 4: I2C LCD Pin Definition

5.6. 5x4 Matrix 20 Key Membrane Switch Keypad
This keypad has 20 buttons, 20 button pad can
be split up into four, 4 button pads arranged in
a telephone-line 5x4 grid.
It's made of a thin, flexible membrane material
with an adhesive backing so that can attach it
to nearly anything. .
The Keypad 5x4 features a total of 20 buttons
in Matrix form. This is a membrane keypad with
no moving parts.
Figure 11: 5*4 Matrix Keypad

Only need 9 microcontroller pins (4-columns and 5-rows) to scan through the key pad. This
5x4 Matrix Keypad has chosen for RTIS project to provides a useful human interface
component for the people who using it.

31

Automated Sri Lanka Railway Ticket Issuing System
Features
 Ultra-thin design
 Adhesive backing
 Excellent price/performance ratio
 Easy interface to any microcontroller
 Keypad with additional four functional buttons
Key Specifications
 Maximum Rating: 24 VDC, 30 mA
 Interface: 9-pin access to 5x4 matrix
 Operating temperature: 32 to 122 °F (0 to 50°C)
 Dimensions: Keypad, 2.7 x 3.0 in (6.9 x 7.6 cm)
Specifications
 Cable Length: 3-1/3" or 85mm (include connector)
 Weight: 8g
 Connector: Dupont 8 pins, 0.1" (2.54mm) Pitch
 Mount Style: Self-Adherence
 Max. Circuit Rating: 24VDC, 30mA
 Insulation Spec.: 100M Ohm, 100V
 Dielectric Withstand: 250VRms (60Hz, 1min)
 Contact Bounce: <=5ms
 Life Expectancy: 1 million closures
 Operation Temperature: -20 to +40 °C
Overview process of 5x4 Matrix Keypad
5x4 matrix keypads use a combination of five rows and four columns which are used to provide
button states to the host device, typically a microcontroller. Underneath each key is a
pushbutton, with one end connected to one row, and the other end connected to one column.
Pin Definition:
5x4 Matrix Keypad

Arduino Mega 2560

Pin 1 (Colum)

Digital Pin 27

32

Automated Sri Lanka Railway Ticket Issuing System

Pin 2 (Colum)

Digital Pin 28

Pin 3 (Colum)

Digital Pin 29

Pin 4 (Colum)

Digital Pin 30

Pin 5 (Row)

Digital Pin 22

Pin 6 (Row)

Digital Pin 23

Pin 7 (Row)

Digital Pin 24

Pin 8 (Row)

Digital Pin 25

Pin 9 (Row)

Digital Pin 26

Table 5: Keypad Pin Definition

How to Connect and Read a Keypad with an Arduino (NA)

5.7. Piece Piezo Buzzer

Piezo buzzer is used for making beeps, tones and alerts.
By using these speakers, can create simple music or
user interfaces. .
When subjected to an alternating electric field they
stretch or compress, in accordance with the frequency of
the signal thereby producing sound.
Figure 12: Piece Piezo Buzzer

This also known as Piezo transducer operating at DC voltage. Encapsulated in a cylindrical
plastic coating, it has a hole on the top face for sound to propagate. A yellow metallic disc
which plays an important role in the producing sound can be seen through the hole.
This Piezo buzzer has chosen for RTIS project for making beeps sounds when errors occurs.
This has been used because light weight, simple construction and low price make it usable in
various applications like car/truck reversing indicator, computers and call bells compare to
other buzzers.
Piezo Speaker (NA)

33

Automated Sri Lanka Railway Ticket Issuing System
Specifications of Piece Piezo Buzzer
Diameter

: 30 ±0.5mm

Height

: 20 ±0.5mm

Weight

: 7.5g

Rated Voltage

: 12v DC

Operating Voltage: 3v-24v
Rated Current (Max): ≤30mA
Min Sound Output at 10cm: 87-95db
Resonant Frequency: 3000±500HZ
Operating Temperature: -20°C to 50°C
Storage Temperature: -30°C to 80°C
Features Piece Piezo Buzzer
 The PS series are high-performance buzzers that employ unimorph piezoelectric
elements and are designed for easy incorporation into various circuits.
 They feature extremely low power consumption in comparison to electromagnetic units.
 These buzzers are designed for external excitation, the same part can serve as both a
musical tone oscillator and a buzzer.
 They can be used with automated inserters.

Pin Definition:
Piece Piezo Buzzer

Arduino Mega 2560

Black Wire

GND

Red Wire

Digital Pin 9 or as set on the
controller

Table 6: Piezo Buzzer Pin Definition

34

Automated Sri Lanka Railway Ticket Issuing System

5.8. I2C RTC DS1307 Real Time Clock module

This is the Real Time Clock (RTC) Module which uses the
DS1307 to keep track of the current year, month, day as well
as the current time.
The end of the month date is automatically adjusted for
months with fewer than 31 days, including corrections for leap
Figure 13: RTC I2C

year.

The clock operates in either the 24 hour or 12 hour format with AM/PM indicator. The DS1307
RTC module has a built-in power-sense circuit that detects power failures and automatically
switches to the backup supply. Timekeeping operation continues while the part operates from
the backup supply.
The DS1307 RTC is accessed via the I2C protocol, low power, full binary-coded decimal
(BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially
through an I2C, bidirectional bus. The module comes fully assembled and pre-programmed
with the current time (MST).
This I2C RTC DS1307 Real Time Clock module has chosen for RTIS project because it’s
widely used in data logging, clock-building, time stamping, timers, and alarms and keep track
of time even if it is reprogrammed, or if the power is lost. This includes a small CR1225 Lithium
coin cell battery that will run the RTC for a minimum of 9 years (17 years typical) without an
external 5V power supply. As per my project, this allows Arduino microcontroller to provides
seconds, minutes, hours, day, date, month, and year information for the Railway Ticket to be
printed whenever Railway ticket purchased by users.
Features of I2C RTC DS1307 Real Time Clock module
 Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month, Month,
Day of the week, and Year with Leap-Year Compensation Valid Up to 2100
 56-Byte, Battery-Backed, General-Purpose RAM with Unlimited Writes
 I2C Serial Interface
 24C32 32K I2C EEPROM Memory
 Programmable Square-Wave Output Signal
 Automatic Power-Fail Detect and Switch Circuitry
 Consumes Less than 500nA in Battery-Backup
 Mode with Oscillator Running
35

Automated Sri Lanka Railway Ticket Issuing System
 Optional Industrial Temperature Range: -40°C to +85°C
 Available in 8-Pin Plastic DIP or SO
 Underwriters Laboratories (UL) Recognized
Specifications of I2C RTC DS1307 Real Time Clock module
 Length: 24.21mm/0.95in
 Width: 30.44mm/1.2in
 Height: 5mm/0.2in
 Weight: 4g/0.14oz
 Mounting holes are 3.3mm(0.13in) diameter, 30mm(1.1in) apart
 This board/chip uses I2C 7-bit address 0x68
Pin definition:

Figure 14: RTC Pin Definition

Tiny RTC-Module

Arduino Mega 2560

DS1307
VCC

5V (VCC)

GND

GND

SDA

D20 (SDA)

SCL

D21 (SCL)

Table 7: RTC I2C Pin Definition

Real Time Clock Module (DS1307), NA

5.9. YWROBOT Relay (5VDC)
This is a 5V 1-Channel Relay interface board which be able
to control various appliances, and other equipment with large
current. It can be controlled directly by Micro-controller
(Arduino, 8051, AVR, PIC, DSP, ARM, ARM, MSP430, TTL
Figure 15: Ywrobot Relay

logic).
36

Automated Sri Lanka Railway Ticket Issuing System
It has 5V 1-Channel Relay interface board, and each one needs 15-20mA Driver Current
Standard interface that can be controlled directly by microcontroller. Indication LED’s for Relay
output status.
This YWROBOT 1 RELAY (5VDC) has chosen for RTIS project because it’s widely used,
equipped with high-current relay, AC250V 10A ; DC30V 10A, compatible with Arduino and
indicate LEDs for Relay output status. This relay has been used to switch off/on the coin
acceptor by providing the 5V.
Specifications of YWROBOT RELAY (5VDC)
Size: 53mm*28.3mm*19.3mm
Net weight: 18g
PCB color: black
With 4 fixed screw holes, hole diameter 3.1mm, convenient installation and fixation
Features of YWROBOT RELAY (5VDC)
 1 relay expansion board
 Can control a variety of household appliances, and high current loads
 Equipped with high-current relay, AC250V 10A DC30V 10A
 Support 5V voltage
 Independent wiring in contact area , safe and reliable
 Standard interface that can be expanded in a variety of development boards
 Equipped with screw holes for easy installation
 Applicable to a variety of platforms including Arduino / AVR / ARM
Pin definition:

Figure 16: Ywrobot Relay Pin Definition

Interfacing the relay modules to the Arduino (NA)
37

Automated Sri Lanka Railway Ticket Issuing System

YWROBOT Relay (5VDC)

Arduino Mega 2560

VCC

5V (VCC)

GND

GND

IN

D2 (Any Digital Pin)

+

+ wire in the device need to
be connected

-

- wire in the device need to
be connected

Table 8: Ywrobot Relay Pin Definition

6.Cost Analysis
A cost analysis is used to evaluate the total anticipated cost of a proposed RTIS project
compared to the total expected benefits in order to determine whether the proposed
implementation is worthwhile for Sri Lanka Railway Department before start to work on project.
Based on the cost analysis, the decision can be taken further to work on it or not. As per the
project which I have done is cost and benefit for Sri Lanka Railway Department.
The cost analysis as follows:
Product components

Quantity

Price in
$

Price in
(LKR)

Coin Acceptor 4 Coin Programmable

1

$39.95

5217.47 Rs

Thermal Receipt Printer

1

$49.95

Arduino Mega 2560 R3

1

$58.95

7698.28 Rs

Arduino Ethernet shield R3 with micro SD connector

1

$45.00

5876.55 Rs

Serial Enabled 16x2 LCD - White on Black 5V

1

$24.95

3258.22 Rs

Button Pad 4x4 - LED Compatible

1

$9.95

1299.37 Rs

Piezo Buzzer - PS1240

1

$1.50

195.88 Rs

DS1307 Real Time Clock Module

1

$9.00

1172.34 Rs

Jumper Wires Premium 6" M/F Pack of 100

48

$24.95

3258.22 Rs

YWROBOT 1 RELAY (5VDC)

1

$1.44

187.51 Rs

$265.64

34600.00 Rs

Total Cost for the proposed project components

6523.47 Rs

Table 9: Total cost for Project Components

38

Automated Sri Lanka Railway Ticket Issuing System

Maintenance & Supportive Environment Cost
Item Name

Cost

Electricity

3,000 Rs

Internet

2,000 Rs

Maintenance

4,000 Rs

Total Maintenance and environment cost

9,000.00 Rs

Table 10: Total Cost for Maintenance

Implementing & Developing Cost
Item Name

Cost

Developing cost per day

1000 Rs

Total developing cost (40 days x 1000)

40000 Rs

Training cost

5000 Rs

Total Implementing & Developing Cost

45,000 Rs

Table 11: Total Cost for Developing

Total Proposed RTIS Project Cost
Item Name

Cost

Total Cost for the project components

34,600.00 Rs

Total Maintenance and environment cost

9,000.00 Rs

Total Implementing & Developing Cost

45,000 Rs

Total RTIS Project Cost

88,600 Rs

Table 12: Total Cost for RTIS Project

39

Automated Sri Lanka Railway Ticket Issuing System

7. Project Progress Plan

WBS

1.0

Task name

Project Proposal (Problem
Definition)

1.1
2.0

Starting date

Finishing date

DD/MM/YYYY

DD/MM/YYYY

01/06/2014

01/06/2014

Project approval

01/06/2014

01/06/2014

Initiation research

02/06/2014

05/06/2014

2.1

Railway ticket issuing
system development
research

02/06/2014

02/06/2014

2.2

Project planning

03/06/2014

05/06/2014

2.2.1

Feasibility study report

03/06/2014

03/06/2014

2.2.2

Cost Analysis (Budget )

04/06/2014

04/06/2014

2.2.3

Time management

05/06/2014

05/06/2014

Analysis and Design

06/06/2014

11/ 06/ 2014

Project analysis

06/06/2014

09/ 06/ 2014

3.0
3.1
3.1.1

Gathering requirements

06/06/2014

06/06/2014

3.1.2

Problem analysis

06/06/2014

07/06/2014

3.1.3

Railway system analysis
(Object analysis)

08/06/2014

09/06/2014

10/06/2014

11/06/2014

3.2

System design

40

Automated Sri Lanka Railway Ticket Issuing System

3.2.1

Railway ticket issuing
Web page design

10/06/2014

10/06/2014

3.2.2

Sketch design

11/06/2014

11/06/2014

12/06/2014

14/ 07/2014

12/06/2014

18/06/2014

12/06/2014

13/06/2014

14/06/2014

18/06/2014

19/06/2014

07/ 07/ 2014

19/06/2014

23/06/2014

24/06/2014

25/06/2014

26/06/2014

27/06/2014

28/06/2014

07/07/2014

Interconnecting the all
coding with devices

08/07/2014

13/07/2014

Testing and evaluation

14/07/2014

16/07/2014

4.0

Code Implementation

4.1

Creation of Railway
ticketing Webpage
4.1.1
HTML coding
4.1.1
Coding PHP

4.2

Coding the devices
4.2.1
Coding Ethernet
4.2.2
Coding Keypad and LCD
4.2.3
Coding RTC and buzzer
4.2.4

4.3

5.0

Coding the coin acceptor
and Thermal Printer

5.1

On time testing

14/ 07/ 2014

14/ 07/ 2014

5.2

User acceptance test

14/07/2014

14/07/2014

41

Automated Sri Lanka Railway Ticket Issuing System

5.3

15/07/2014

16/07/2014

Implementation on Actual
Railway Department

17/07/2014

18/ 07/2014

6.1

Connecting the devices
with appropriate place

17/07/2014

17/07/2014

6.2

Produce the system

18/07/2014

18/07/2014

19/07/2014

21/07/2014

6.0

7.0

Re-work

Training

7.1

Staff training

19/07/2014

20/07/ 2014

7.2

Users training

20/07/ 2014

21/ 07/ 2014

8.0

Documentation and
submitting the project

22/07/2014

23/ 07/ 2014

9.0

Close out

24/07/2014

24/07/2014

Table 13: Project WBS

The project schedule Gant chart is given below:

Figure 17: Project Timeline

42

Automated Sri Lanka Railway Ticket Issuing System

8.System Design
8.1. The Overview of RTIS System Design
The ticket issuing process of railway is currently done manually. This process involves a
significant amount of human resources. It is highly time consuming and has resulted in long
queues. Therefore by combining the existing manual system with an automated system can
provide an effective solution. The system RTIS I am developing can be installed at any place
in Sri Lanka for Railway Ticket issuing.
The Automated Railway Ticket Issuing System design and implementation on Arduino Mega
2560 R3 is proposed, this is because Arduino based ARTIS has many advantages over
existing microcontroller based ARTIS, some of these advantages are; simple structure, high
reliability, speed, an open-source platform, flexible, easy-to-use hardware and software,
number of input/output ports, performance and less power consumption which are all very
important in every ARTIS design. This system is implemented on the basis of City station
machine by using Arduino. The proposed system consist of two parts Web part and the coin
acceptance part. The information of a regular train tickets can be edited through the web by
the Railway department administrators. This is become possible by using Arduino Ethernet
shield R3. This system accepts coins in any sequence that are appropriate, and deliver tickets
when the desired amount is deposited, it also give error messages if inserted coin is not valid
or if the system handles in an unappropriated way. This is processed by Coin Acceptor (4 coin
Programmable). The Thermal Printer is used for printing railway tickets. RTC I2C real time
clock module is used to take the current time and date which is to be printed in the receipt.
The Ywrobot Relay (5VDC) is used to switch off/on the Coin acceptor to run accurately. This
system can be extended in future without changing any hardware, just by reprogramming the
system it can be enhanced for stations.
For the Implementation of proposed Automated Railway Ticket Issuing System, I use the
following components:
1. Arduino Mega 2560 R3
2. Arduino Ethernet shield R3 with micro SD connector
3. Coin Acceptor 4 Coin Programmable
4. Thermal Receipt Printer
5. Serial Enabled 16x2 LCD - White on Black 5V
6. Button Pad 4x4 - LED Compatible
7. Piezo Buzzer - PS1240
43

Automated Sri Lanka Railway Ticket Issuing System
8. Breadboard
9. Tiny RTC I2C real time clock module
10. Ywrobot Relay (5VDC)
11. Jumper Male and Female Wires
12. Arduino software tool to write sketches

8.2. How RTIS System Works For Passengers

Figure 18: RTIS Flow Chart for Passengers

As for the Flow chart, the operation of the system takes place in an automated progress. Firstly
the passenger has to mention the destination number as for the given information. As for the
selected destination, ticket prices will be displayed. In this case the passenger will have to
select the number of full tickets and/or half tickets that are required.
As for the selected tickets, total cost will be displayed. Following this, passenger will have to
insert the coin and once the payment is made, the receipt will be printed automatically.
Following these all steps as standard, finally the ticket will be issued.
44

Automated Sri Lanka Railway Ticket Issuing System

8.4. How RTIS System Works For Administrators

Figure 19: RTIS Flow Chart for Administrators

As for the Flow chart, the system can be fixed on the required station as for the following
requirements. This process is controlled by the Railway Department Administrator. Firstly the
IP address has to be mentioned as required when “D” press in the keypad. Following this step,
it require port number to establish the connection which is need to be given by the
administrator appropriately. Next will be the station ID, as for where the machine is to be fixed
and also the default station ID can be changed by the admin as for the station.
45

Automated Sri Lanka Railway Ticket Issuing System

8.5. RTIS System Web Interface

Figure 20: RTIS Web Interface

This web interface accessibility belongs to Sri Lanka Railway Department Administrators
where they can add/ edit/ delete railway station details and ticket prices. The web site
programmed by using Html and PHP through Adobe Dreamweaver. This web interface
become possible by adding Arduino Ethernet shield to Arduino board. By this, the Arduino can
be act as webserver to host the website and provide access to administrators through the
internet.
Arduino Hardware that used for the RTIS
The Arduino Mega 2560 R3 board is where the code wrote for the system is executed. The
board can only control and respond to electricity, so specific components are attached to it to
enable it to interact with so many purposes. These components can be sensors, which convert
some aspect of the physical to electricity so that the board can sense it, or actuators, which
get electricity from the board and convert it into as needed.
Arduino Software that used for the RTIS
Software programs are called sketches. Theses sketches will be created on a computer using
the Arduino integrated development environment (IDE). The IDE enables to write and edit
code and convert this code into instructions that Arduino hardware understands based on the
codes that programmed. The IDE also transfers those instructions to the Arduino board to be
work smoothly and efficiently.

46

Automated Sri Lanka Railway Ticket Issuing System

8.6. Arduino IDE and Sketch Overview in the concern of RTIS
Arduino IDE stands for Integrated Development Environment and it’s a text editor like program
which allows us to write computer code for the Arduino board, in other way the IDE programme
coded is considered as the OS of Arduino board when working in projects. In Arduino, the file
is called a sketch. The sketch is where the developed code that have written is store. When
open up the Arduino program, it means opening the IDE. It is intentionally stream lined to
keep things as simple and straightforward as possible. The Arduino IDE sends that text to a
compiler on our PC that checks our text against some rules and then builds something that
can be uploaded to the computer on the Arduino board. The computer on the Arduino IDE
accepts the uploaded data and starts making decisions about how the Arduino board
processes information and uses the hardware as coded in Arduino IDE. The Arduino board
can be work either as client or act server with a help of Arduino Ethernet Shield. Arduino
programming language is a simplified from of C/C++ programming language based on what
Arduino calls "sketches" which use basic programming structures, variables and functions.
These are then converted into legal C++ program.
Compare to other boards, in the Arduino, if there is something that is in any way controlled by
electricity, the Arduino can interface with it in some manner very simply than other micro
controllers. And even if it is not controlled by electricity, can probably still use things which are
like motors, relay and electromagnets, to interface with it. So, the selection of board is strong
enough and capable to work with RTIS all hardware components. The Arduino IDE makes
easier to write programs to the Arduino board than other text editors (IDE other software).
The button in Arduino IDE that looks like a checkmark is called “verify”. If this get press, the
code will be compiled and any errors will be displayed in the window at the bottom. So that
errors can be solved efficiently with the help of IDE. The short cut key for verify is Control + R.
The button in in Arduino IDE that looks like an arrow pointing right is the upload button. If this
get press, the sketch will be uploaded to Arduino board as coded. The short cut key for upload
is Control + U.
The button on the right side of the screen in the IDE is the serial monitor button. If this get
press, the serial monitor will be function, it’s possible to send and receive information from
Arduino board while it is running. The shortcut key for serial monitor is Shift + Control + M.
The bottom right hand corner of the window displays the current board and serial port. The
toolbar buttons allows to verify and upload programs, create, open, and save sketches, and
open the serial monitor.

47

Automated Sri Lanka Railway Ticket Issuing System

Figure 21: Arduino IDE Tool

Additional commands are found within the five menus: File, Edit, Sketch, Tools, and Help. The
menus are context sensitive which means only those items relevant to the work currently being
carried out are available.
Tutorial 03: Arduino IDE and Sketch Overview (NA)

48

Automated Sri Lanka Railway Ticket Issuing System

9.Implementation of RTIS
9.1. Block Diagram of the Automated Railway Ticket Issuing System

Figure 22: RTIS System Block Diagram

49

Automated Sri Lanka Railway Ticket Issuing System
The Block Diagram Descriptions as follows:
1. Arduino Mega 2560 R3
2. Arduino Ethernet shield R3 with micro SD connector
3. Breadboard
4. Tiny RTC I2C real time clock module
5. 5x4 Matrix 20 Key Membrane Switch Keypad
6. I2C Serial Enabled 16x2 LCD Module Display Screen
7. Ywrobot Relay (5VDC)
8. Coin Acceptor 4 Coin Programmable
9. Thermal Receipt Printer
10. Piezo Buzzer - PS1240
11. Green Led
12. Red Led
13. Jumper Male and Female Wires
The entire Automated Railway Ticket Issuing System codes implementation given in
the cd and names “RTIS Codes Implementation”.

9.2. Tiny RTC I2C real time clock module block Diagram & Coding

Figure 23: RTC I2C Block Diagram

50

Automated Sri Lanka Railway Ticket Issuing System
Tiny RTC I2C real time clock module Coding
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
int hr_24, hr_12;

void setup () {
//Initialize the serial port, wire library and RTC module
Serial.begin(9600);
Wire.begin();
RTC.begin();
//If we remove the comment from the following line, we will set up the module time and
date with the computer one
RTC.adjust(DateTime(__DATE__, __TIME__));

}
void loop () {
DateTime now = RTC.now();
//We print the day
Serial.print(now.day(), DEC);
Serial.print('/');
//We print the month
Serial.print(now.month(), DEC);
Serial.print('/');
//We print the year
Serial.print(now.year(), DEC);
Serial.print(' ');
//We print the hour
Serial.print(now.hour(), DEC);
Serial.print(':');
//We print the minutes
Serial.print(now.minute(), DEC);
Serial.print(':');
//We print the seconds
Serial.print(now.second(), DEC);
//We check the time and sent through the serial port every 3s

hr_24=now.hour();
if (hr_24==0) hr_12=12;
else hr_12=hr_24%12;
// Serial.print(hr_12, DEC);
if (hr_24<12) {
Serial.print(' ');
Serial.print("AM");
Serial.println();
delay(1000);
51

Automated Sri Lanka Railway Ticket Issuing System
}
else {
Serial.print(' ');
Serial.print("PM");
Serial.println();
delay(1000);
}
}

Table 14: RTC I2C Coding

Actual Output of the RTC I2C coding

Figure 24: Actual Output RTC Coding

52

Automated Sri Lanka Railway Ticket Issuing System

Actual output of RTC I2C module once the wiring is been implemented:

Figure 25: Actual Output of RTC I2C Module

9.3. 5x4 Matrix 20 Key Membrane Keypad block Diagram & Coding

Figure 26: Keypad Block Diagram

53

Automated Sri Lanka Railway Ticket Issuing System
5x4 Matrix 20 Key Membrane Switch Keypad coding
#include <Keypad.h>
const byte numRows= 5; //number of rows on the keypad
const byte numCols= 4; //number of columns on the keypad
//keys defines the key pressed according to the row and columns just as appears on the
keypad
char keys[numRows][numCols] =
{
{'1', '6', 'A', 'D'},
{'2', '7', 'B', 'E'},
{'3', '8', 'C', 'F'},
{'4', '9', 'U', 'R'},
{'5', '0', 'G', 'T'}
};
//Code that shows the the keypad connections to the arduino terminals
byte rowPins[numRows] = {22,23,24,25,26}; //Rows 0 to 5
byte colPins[numCols]= {27,28,29,30}; //Columns 0 to 4
//initializes an instance of the Keypad class
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, numRows, numCols );
void setup()
{
Serial.begin(9600);
}
void loop()
{
char key = keypad.getKey(); //If key is pressed, this key is stored in 'keypressed' variable
if (key != NO_KEY //If key is not equal to 'NO_KEY', then this key is printed out
{
Serial.print(key);
//if count=17, then count is reset back to 0 (this means no key is pressed during the
whole keypad scan process
}
}
Table 15Keypad Coding

54

Automated Sri Lanka Railway Ticket Issuing System
Actual Output of the Keypad coding

Figure 27: Actual Output of the Keypad Coding

Actual output of 5x4 Matrix 20 Key Membrane Keypad once the wiring is been
implemented:

Figure 28: Actual Output of Keypad Wiring

55

Automated Sri Lanka Railway Ticket Issuing System

9.4. I2C Serial Enabled 16x2 LCD Module Block Diagram & Coding

Figure 29: LCD I2C Block Diagram

I2C Serial Enabled 16x2 LCD Module Coding
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line
display

void setup()
{
lcd.init();

// initialize the lcd

// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print("Railway Ticket");
lcd.setCursor(0,1); //Start at character 4 on line 0
lcd.print("System");
}
void loop()
{
}
Table 16: LCD I2C Coding

56

Automated Sri Lanka Railway Ticket Issuing System
Actual output of I2C Serial Enabled 16x2 LCD Module once the wiring is been
implemented:

Figure 30: Actual Output of LCD I2C Wiring

9.5. Ywrobot Relay (5VDC) with Coin Acceptor Block Diagram &
Coding

Figure 31: Relay with Coin Acceptor Block Diagram

57

Automated Sri Lanka Railway Ticket Issuing System
Actual Output of the Ywrobot Relay (5VDC) with Coin Acceptor Coding

Figure 32: Actual Output of Relay with Coin acceptor

9.6. Coin Acceptor 4 Coin Programmable Block Diagram & Coding

Figure 33: Coin Acceptor Block Diagram

58

Automated Sri Lanka Railway Ticket Issuing System
9.6.1. Coin Parameters Setting
Access To Coin Parameters Setting

Clean Up All Coin Parameters

Clean Up Group Coin Parameters

9.6.2. Reset All Coin Parameters
Clean up all existing coin parameters firstly

Set the first group of coins

Set the next group of coins

59

Automated Sri Lanka Railway Ticket Issuing System
Add New Coin Parameters

Exit Coin Parameters Setting

9.6.3. Coin Acceptor Parameters Setting
Access To Coin Acceptor Parameters Setting

Recover Coin Acceptor Parameters To The Defaulted Value

Machine Charge Amount Setting A1

60

Automated Sri Lanka Railway Ticket Issuing System
Serial Output Signal Pulse-width/ RS232 Transmit Baud Rate Setting A2

Faulty Alarm Option A3

Serial Port RS232 Signal Output Format A4 (can alter the format if needed)

Press button B to select coin acceptor parameters as needed, and press button A to next
group of Coin Acceptor parameters A5.
Serial or Parallel Port Option A5

Exit the Setting

61

Automated Sri Lanka Railway Ticket Issuing System
9.6.4. Dip Switch Functions Setting

Figure 34: Dip Switch

Dip Switch

SW1

SW2

SW3

SW4

functions

Port Level

Security

Transmitting

Inhibiting

ON

NC

Special

RS232

< +1V

OFF

NO

Normal

Pulse

> +3V

Table 17: DIP Switch Setting

Mode 1—N.O.
When SW1 is on “OFF” position,
On standby, coin receiving output NPN transistor is open collector; on acceptance of enough
coins ( no less than machine charge amount), NPN transistor is turned on to short circuit for a
period of 25ms/45ms/65ms/100ms (+/-20%).here output voltage should be less than 0.7V and
max 100mA is available for electric current.
Note: it can set the period of 25ms/45ms/65ms/100ms in coin acceptor parameter A2.
Mode 2—N.C.
When SW1 is on “ON” position,
On standby, coin receiving output NPN transistor is short circuit, max 100mA is available for
electric current; on acceptance of enough coins ( no less than machine charge amount), NPN
transistor is turned on to open circuit for a period of 25ms/45ms/65ms/100ms (+/-20%).
Note: It can set the period of 25ms/45ms/65ms/100ms in coin acceptor parameter A2.
Coin Identification Security
When SW2 is on "OFF" position, it means the high security of coin acceptor identifies coins.
When SW2 is on "ON" position, it means the low security of coin acceptor identifies coins,
acceptor can accept some defected coins.
Serial Output Signal Format
Note: This option is not suitable for parallel port output mode.
62

Automated Sri Lanka Railway Ticket Issuing System

Coin Acceptor 4 Coin Programmable Coding
int OpticalCountPin = 3;
void setup()
{
// Debugging output
Serial.begin(9600);
Serial.println("Ready...");
pinMode(OpticalCountPin, INPUT);
digitalWrite(OpticalCountPin,HIGH);
attachInterrupt(1, CoinPulse2, FALLING);
}
// total amount of money collected;
float money = 0.0;
// gets incremented by the CoinPulse2;
// gets reset when coin was recognized (after train of pulses ends);
volatile int pulses = 0;
volatile long timeLastPulse = 0;
// executed for every pulse;
void CoinPulse2()
{
pulses++;
timeLastPulse = millis();
}
void loop()
{
//lcd.setCursor(0,0);
Serial.println("Please put coins");
delay(1000);
// lcd.setCursor(0,1);
Serial.println("PAID Rs");
Serial.println(money);
long timeFromLastPulse = millis() - timeLastPulse;
if (pulses > 0 && timeFromLastPulse > 200)
{
// sequence of pulses stopped; determine the coin type;
if (pulses == 1)
{
Serial.println("Received 1 Rs (1 pulses)");
money += 1.0;
}
else if (pulses == 2)
{
Serial.println("Received 2 Rs (2 pulses)");
money += 2.0;
}
else if (pulses == 5)
63

Automated Sri Lanka Railway Ticket Issuing System
{
Serial.println("Received 5 Rs (5 pulses)");
money += 5.0;
}
else if (pulses == 10)
{
Serial.println("Received 10 Rs (10 pulses)");
money += 10.0;
}
else
{
Serial.print("Unknown coin: ");
Serial.print(pulses);
Serial.println(" pulses");
}
pulses = 0;
}
}
Table 18: Coin Acceptor Coding

Actual Output of the Coin Acceptor Coding

Figure 35: Actual Output of Coin acceptor coding

64

Automated Sri Lanka Railway Ticket Issuing System

Actual output of Coin Acceptor once the wiring is been implemented:

Figure 36: Actual Output Coin Acceptor Wiring

9.7. Thermal Receipt Printer Block Diagram & Coding

Figure 37: Thermal Printer Block Diagram

65

Automated Sri Lanka Railway Ticket Issuing System
Thermal Receipt Printer Coding
#include <Wire.h>
#include <EEPROM.h>
#include "RTClib.h"
RTC_DS1307 RTC;
// If you're using Arduino 1.0 uncomment the next line:
#include "SoftwareSerial.h"
// If you're using Arduino 23 or earlier, uncomment the next line:
//#include "NewSoftSerial.h"
#include "Adafruit_Thermal.h"
#include <avr/pgmspace.h>
int printer_RX_Pin = 5; // This is the green wire
int printer_TX_Pin = 6; // This is the yellow wire
String seqno="";
int addr = 0;
long ts=0;
Adafruit_Thermal printer(printer_RX_Pin, printer_TX_Pin);
void setup () {
//Initialize the serial port, wire library and RTC module
Serial.begin(9600);
Wire.begin();
RTC.begin();
//If we remove the comment from the following line, we will set up the module time and
date with the computer one
RTC.adjust(DateTime(__DATE__, __TIME__));
DateTime now = RTC.now();
ts=now.unixtime();
Serial.begin(9600);
pinMode(7, OUTPUT); digitalWrite(7, LOW); // To also work w/IoTP printer
printer.begin();
EEPROM.write(addr, EEPROM.read(0)+1);
Serial.println(EEPROM.read(0));
seqno=String(ts) + String(EEPROM.read(0));
printer.justify('C');
printer.setSize('M');
printer.println("Fort");
printer.justify('C');
printer.setLineHeight(20);
printer.justify('C');
printer.print("Ref:");
printer.print(seqno);
printer.println();
printer.setLineHeight(); // Reset to default
printer.justify('L');
printer.setSize('S');
66

Automated Sri Lanka Railway Ticket Issuing System
printer.print
("Date:"),
printer.print(now.day(),
DEC)
,
printer.print('/')
,
printer.print(now.month(), DEC) , printer.print('/') , printer.print(now.year(), DEC);
printer.print(" "), printer.print("Time:"), printer.print(now.hour(), DEC) , printer.print(':') ,
printer.print(now.minute(), DEC) , printer.print(':') , printer.print(now.second(), DEC);
{int hr_24, hr_12;
hr_24=now.hour();
if (hr_24==0) hr_12=12;
else hr_12=hr_24%12;
if (hr_24<12) {
printer.print("AM");
}
else {
printer.print("PM");
}
}
printer.println();
printer.justify('C');
printer.setSize('M');
printer.println("ROUTE: FORT - WELLAWATTE");
printer.justify('C');
printer.setSize('S');
printer.println("(Jouney - 7.00 KM)");
printer.justify('C');
printer.setSize('S');
printer.println("FULL: 1 * 13.00 = 13.00");
printer.justify('C');
printer.setSize('M');
printer.println("TOTAL : Rs.13.00");
printer.justify('C');
printer.setSize('S');
printer.println("Depot Hotline: 0117706580");
printer.justify('L');
printer.setSize('S');
printer.println("Important:Please keep the ticket");
printer.println("until the end of transport. All");
printer.println("the purchased tickets are final");
printer.inverseOn();
printer.setSize('s');
printer.println("Tickets are issued by Srilankan");
printer.println("Railway Department");
printer.inverseOff();
printer.justify('C');
printer.setSize('S');
printer.println("Devloped By");
printer.setLineHeight(20);
printer.inverseOn();
printer.setSize('L');
printer.println("BCAS");
printer.inverseOff();
printer.setLineHeight();
printer.println("");
67

Automated Sri Lanka Railway Ticket Issuing System
printer.println("");
printer.println("");
printer.sleep();
// Tell printer to sleep
printer.wake();
// MUST call wake() before printing again, even if reset
printer.setDefault(); // Restore printer to defaults
}
void loop() {
}
Table 19: Thermal Printer Coding

Actual output of Thermal Printer once the wiring is been implemented:

Figure 38: Actual Output of the Thermal Printer

9.8. Piezo Buzzer Block Diagram & Coding

Figure 39: Buzzer Block Diagram

68

Automated Sri Lanka Railway Ticket Issuing System
Piezo Buzzer Block Coding
void setup() {
// declare pin 9 to be an output:
pinMode(9, OUTPUT);
beep(100);
beep(100);
beep(100);
delay(1000);
beep(3);
}
void loop() {
}
void beep(unsigned char delayms){
analogWrite(9, 200);
// Almost any value can be used except 0 and 255
// experiment to get the best tone
delay(delayms);
// wait for a delayms ms
analogWrite(9, 0);
// 0 turns it off
delay(delayms);
// wait for a delayms ms
}
Table 20: Buzzer Coding

Actual output of Piezo Buzzer once the wiring is been implemented:

Figure 40: Actual Output of Buzzer

69

Automated Sri Lanka Railway Ticket Issuing System

9.9. Ethernet Shield Diagram & Coding

Figure 41: Ethernet Shield Block Diagram

Ethernet Shield entire coding is attached to cd and named as “Ethernet Shield”.
Actual Output of Ethernet Shield:

Figure 42: Actual Ouput of Ethernet Shield

70

Automated Sri Lanka Railway Ticket Issuing System

9.10. Actual Output of the Automated RTIS System once the entire
code implemented

Figure 43: Actual Output of RTIS System

71

Automated Sri Lanka Railway Ticket Issuing System

10. Testing
Automated Sri Lanka Railway Ticket Issuing System Test Plan
Outcome
Inputs or test data

Actual outcome

Expected outcome

succeeded
() or not (×)

Keep null in all questions in Exception

message

and

the system and then click on function runs as follows:
Enter button.

Error

messages

“Red Led Blinks”

must be shown for all

“Beep sound from buzzer”

options listed, red led

“Station not in List”

must be blink and

“Invalid Tickets”

beep error must be

processed

Invalid Destination Station Id Exception

message

and Error

messages

Given and clicks on Enter function runs as follows:

must be shown, red

Button. Example destination “Red Led Blinks”

led must be blink and

Station Id given as “100”.

“Beep sound from buzzer”

beep error must be

“Station not in list”

processed

Invalid Ticket details given Exception

message

and Error

messages

and clicks on Enter Button. function runs as follows:

must be shown, red

Example half tickets given as “Red Led Blinks”

led must be blink and

“0” and full tickets given as “Beep sound from buzzer”

beep error must be

“0”.

processed

“Invalid Ticket Details”

When coins inserted if it is not Exception
equal

to

total

message

inserted coins only 8 Rs.

Display

to

and The exact messages

Amount. function runs as follows:

Example Total = 12 Rs and ““Shows

must be shown and

put the ticket must not be

balance”

get printed.

“The ticket won’t get printed”

72

Automated Sri Lanka Railway Ticket Issuing System

The

Correct

message

and No error message

Station given and Clicks on function runs as follows:

and error function.

Enter

Destination Successful

Example, “Green Led Blinks”

Button.

The

Exact

station

Station Id 3 given which is

“Bambalapitiya”

details

must

be

Bambalapitya

“Full Price 12rs”

shown

with

the

“Half Price 6rs’

tickets Details.

Successful

message

and No error message

The Correct half and full function runs as follows:

and error function.

tickets

Prices

Clicks

on

given

Enter

and “Green Led Blinks”

The

Button. “Bambalapitya”

Exact

details,

and half given as “0” with “Half = 0”

and

station ID 3.

station

details,

Example, Full given as “1” “Full = 1”

tickets
total

cost,

“insert

coins”

“Total cost = 12 Rs”

text must be shown.

“Insert Coins”

The Green led must
be blink.

When Inserting coins, the Successful

message

and

display should give the total function runs as follows:
cost with coin inserted total or “Green Led Blinks for each
paid amount. Example, Total coin”
charged = 12 Rs and coins “Charged = 12 Rs”
inserted 6 Rs.

“Inserted = 6 Rs”

No error message
and error function.

The Exact charged
amount and inserted
amount

must

be

shown. The Green
led must be blink.
No error message

Successful

message

and and error function.

When inserted coins equal to function runs as follows:

The Exact charged

total amount charged for “Green Led Blinks for each amount and inserted
charged coin”

amount

Inserted “Charged = 12 Rs”

shown. The Green

Amount 12Rs with a station “Inserted = 12 Rs”

led must be blink.

tickets.

Example,

amount

12Rs,

Id 3.

must

“Please wait to get receipt”

The

ticket

“Receipt from the Printer”

need

to

printed

be

receipt
be

get

from

the

printer.

73

Automated Sri Lanka Railway Ticket Issuing System
When ticket get printed the Successful

message

and No error message

welcome screen need to be function runs as follows:

and error function.

loaded

again

other “Green Led Blinks for each The Exact welcome

for

passenger.

coin”

screen

must

“Railway Ticket System”

loaded

for

“Current Location: Wellawatte”

passenger.

The correct IP address and Successful

message

and

Port No given and Default function runs as follows:
station ID changed to 3. The “Green Led Blinks”
click

on

Enter

Ticket

Issuing

192.168.5.231, port no 80, System”
station

id

3

given

The

welcome

Message

“Railway

and “Current Location: Wellawatte”

entered.

be

display

“Current

other

ticket system” must

Button. “Values Stored”

Example, the IP address “Railway

be

with

location:

Bambalapitiya”. The
Green Led blinks.

Table 21: RTIS Test Plan

10.1. Conclusion
Test plan is the scheduled plan for the testing work to be done. It is not a test design
specification it involves in Automated Railway Ticket Issuing system testing process,
establishing process and describing the tests that should be carried out before delivering to
the client.
The given test plan is processed in the developed system and there were some errors in the
beginning process identified through the test plan that are Keypad doesn’t work (no output),
coin acceptor doesn’t give pulses whenever coin inserted and the I2C LCD doesn’t give
display. These errors are identified in the beginning through the testing. The rework is done is
to solve these issues and again processed to the test stages as planned. The current results
of the test plan has no errors and the Automated Railway Ticket Issuing system functions
would be done correctly to achieve its objective and it ensures that the error handling will be
processed efficiently whenever the user inputs given error. Further, Evidence of this test plan
can be check through the ARTIS developed system.

74

Automated Sri Lanka Railway Ticket Issuing System

11. Evaluation
The process evaluation was executed by the distribution of questionnaires as a major data
collection from the people who travel by Sri Lankan Railways. The gathered data has its weight
as it’s a direct feedback and also the people who filled their questionnaire seemed
comfortable, was easy going process as their body language revealed their thoughts.
Questionnaires method have selected to get users Feedback because large amounts of
information can be collected from a large number of users in a short period of time and this
evaluation method happen to get users feedback of Automated RTIS.
Compared to other methods, questionnaires is the cheapest method of data gathering and
frequently viewed as quick and easy to do. When data gathered, it can be used to compare,
easy to measure problems or failures and changes. The time taken to do questionnaires are
less time consuming compared to other method. Questionnaires has multiple-choice and
likert-scale-type questions which make the questionnaire easier to fill in and allow the results
to be analyzed more efficiently. This is ensuing the selection of questionnaire method is well
enough for this evaluation report.
For the purpose of getting feedback, the questionnaires will be given to 10 people who travel
by Sri Lankan Railways and the analysis will be done based on their answers. From the
following questionnaires responses, the system failures and strengths of RTIS system
identities and proper solutions taken in order to do solve the issues. The sample of
questionnaires is given below:

75

Automated Sri Lanka Railway Ticket Issuing System

Figure 44: Questionnaire

11.1 Current Status of Manual SL Railway Ticket Issuing System –
Evaluation

Figure 45: Current Manual Railway Status

This evaluation analysis shows, the more number of people agreed that the current SL Railway
Ticket Issuing System status is Poor. This is ensuring the people who travel by Railways
require a better new efficient system to increase the performance than current manual system.

76

Automated Sri Lanka Railway Ticket Issuing System

11.2. Current Failures of Manual SL Railway Ticket Issuing System
– Evaluation

Figure 46: Current Manual Railway Failures

This evaluation analysis shows, the more number of people stated that more time consuming
taken, no security and third party involvement in current SL Railway Ticket Issuing System.
This is guaranteeing the current is system is not suitable and there should be system need to
be introduce to overcome these failures. This become possible by Implementing Automated
Railway Ticket Issuing System.

11.3. Best Solution to Overcome Current issues – Evaluation
This

analysis

suggest

best

solution to the Srilanka Railways.
More people recommended to
implement Automated RTIS than
solution. This is ensuring, the
people will be satisfy with the
implementation

of

Automated

RTIS.

Figure 47: Best Solution

77

Automated Sri Lanka Railway Ticket Issuing System

11.4. User Friendly of Automated RTIS – Evaluation

Figure 48: User Friendly Evaluation

This Analysis shows that Automated RTIS is user friendly for the number of people. Even
though is user friendly, still more features and enhancements need to be implemented to cover
the rest of people who don’t think the flexibility not enough.

11.5. Performance speed of Automated RTIS – Evaluation

This analysis shows, 7 people agreed with the
performance speed of Automated RTIS. This
is depend on people knowledge to use the
technology system and it’s differ people to
people. More training and user manual must
be introduced to people to become more
familiar with the system.

Figure 49: RTIS Performance Speed

78

Automated Sri Lanka Railway Ticket Issuing System
Overall, the people are satisfied with Automated Railway Ticket Issuing System. The strengths
and weakness have been analyzed and identified by the questionnaire. The strengths of
ARTIS are more speed, solve current failures and save money to the government.
The weakness are not enough flexibility and there is no notes taken acceptor. The weakness
identified by the people feedback will be considered and overcome in future to the maximum
level by implementing Automated RTIS with more feature and more enhancements.

11.6. Conclusion
As for their feedback currently progressing SL railway ticket issuing system scores poor as
highly marked (08 people) where as good (02 people), options excellent and very good as
none. Weight of the response highlights the situation as poor and also it’s time for change in
the system of operation to make sure the customers are at least knowledgeable and
experiencing the automated system.
The purpose and introducing of automated ticketing is worth for use and probability of its
success is high as for the response from the crowd. All of the questionnaires are facing failures
in the current process, where more time consuming (10 people) and security concerns (07
people). Highly rated failures are scored or featured mainly by the automated SL railway
ticketing systems as this reveals the strength of its implementation.
Rated solutions to overcome the issues, Automated RTIS (06 people), mobile application (03
people) and web application (01 person). At this situation the implementation of automated
ticketing is supported by its high rate of selection in comparison to other given options. Also
the flexible and possibilities are high enough for its use for the Sri Lankan environment more
than the mobile application and web application as solutions.
Use of automated RTIS is flexible is rated as yes (06 people) and no (04 people), where the
support and implementation would highly be satisfied by the passengers. On the other hand,
the selected option “No” indicates the reasons as passengers who are not willing to change
or finding the process as difficulties as use of knowledge is less, pattern or addiction of use.
Impact of speed by Automated RTIS, working speedy (07 people) and not enough speed (03
people), as the people who sees Automated RTIS as not flexible may influence the use of
speed. Their way of approach or less knowledge in operation leads to more time consuming
than usual, as a result of this the procedure of the overall speed lacks. However the automated
ticketing use is highly recommended to break the addiction or pattern of ticketing operation in
Sri Lanka to step forward.

79

Automated Sri Lanka Railway Ticket Issuing System
Suggestions reveals the requirement of notes as well along with the coins, use of mobile
application and online reservations. These suggestions are fair enough and gives its
importance to set a chance for future enhancement of automated ticketing. Expected
requirements such as less time consuming and flexible no third party involved are highlighted
as the features of the automated ticketing and it fulfills the expected output of the passengers
except the use of notes its possibilities are not too far away as the enhancement of the
automated ticketing operations are implemented.

12. Contingency Plan
Problem
Priority

Problem
Description

Possibility
(High/Medi
um/Low)

Justification or Actions (avoid,
Effect (impacts)

 Railway system
project might be
01

Project is over

High

budget

failure

transfer, mitigation and
contingency)

This problem can be mitigate by using
proper project cost estimation.

 This risk may reduce

If the problem happens the contingency

the quality of project.

plan is to reduce the quality of the

 Less profit

project or reduce the functionality of the
project. Yet this might be failing the
client acceptance and may cause failing
the railway system project.

This problem can be mitigated by
proper security infrastructure (virus
guards and its updates/firewalls within
02

Virus Attack

High

The

viruses

attack the network).

may cause data loss.

In such case, the necessary backup
must be taken to offsite location so the
date can be recover even if the virus
attacks.

80

Automated Sri Lanka Railway Ticket Issuing System

Data
04

High

Corruption

 The data available
in the railway
system database
may get corrupted
 Less accessibility

Data backups should take necessary to
avoid this risk.
If

the back server available,

the

corrupted data can be recover through
the backup server.
Necessary backups needed to take
through the Automated RTIS main

Natural
08

 The entire railway

Disasters may
attack the
system such

server to backup server. The backup

system will be

server must be keep in some other

damaged.

country (off site location). So if the entire

Medium

system

as typhoons,

get

disasters,

floods and

damaged
the

require

by

natural

data

or

information can be recover through

earthquakes

back server. The damage can be
covered using an insurance policy.

Development
09

tools does not
perform

as

expected with
Automated

Medium

 The tools may not
compatible with the
railway system.

This can be mitigated by choosing a
development team with experience in
the specific tool. Yet if the problem
occurs the remaining part needs to be
outsourced.

RTIS.

Table 22: Contingency Plan

81

Automated Sri Lanka Railway Ticket Issuing System

13. Conclusion
The entire project talks about the current railway ticketing operation its issues and replacement
of an automated railway ticketing operation to solve the problems of current ticketing issues
in Sri Lanka Railway Ticketing.
Highlighted areas includes the present situation as the current network infrastructure of
operation and its techniques are looked into to figure out its major drawbacks and its problem
to the passengers. Each problem has been analyzed to figure its requirement. Proposed
solutions are satisfied by the use of automated ticketing system.
Operation of the system, proposed solutions, implemented cost and available features are
proposed to implement the RTIS. Testing, highlight any fault and its upgrades to learn the
product and feedback from the questionnaires were evaluated to rate the expected and current
situations. Finally project progress plan of estimation was shown in the form of a gantt chart.
These leads to reach the aim of this project “To come up with a low cost and efficient model
of a system which can be used to reduce the congestion at ticketing queues” and its objectives
that stepped forward to derive/ achieve the problem definition.
Areas for the future research directions are looked into the performance of the automated
ticketing as well its possibilities of implementation in SL railway.
“In the developed countries of Europe and in the USA there are automated ticketing systems
which use smart cards. Through the use of these cards they have successfully addressed the
above questions. In fact most of these smart card systems have almost eliminated the queues.
In some countries this transaction can be done via the user’s credit card.”
This is current situation in developed countries, the possibilities are could be deserved if Sri
Lankan government is willing to invest such cost, advance use of technology and if the
passengers are been adopted to such circumstances.
Operation of the ticket issuing system by the use of mobile application and web application
are recommended by the passengers and it’s possible depending on the approach and service
support by the government. The knowledge and reach on operation mode among the
passengers too plays a major role.
Suggestion about the Automated Railway Ticketing Issue highlights the use of coins and notes
and online reservations. These are directions of future enhancement as for the developed
automated ticketing machine. The possibilities are high, once the reach of its implementation

82

Automated Sri Lanka Railway Ticket Issuing System
is been well deserved the government will be willing to invest on the machine enhancement
where the acceptance of notes and online reservation will be possible.
“The ShereFASTticket system is also a passenger operated, self-service railway ticket
issuing system, developed by the Guildford-based company Shere Ltd and first introduced
on a trial basis in Britain in 1996, shortly after privatization. It has been developed and
upgraded consistently since then, and is now used by seven Train Operating Companies
(TOCs)

as

their

primary

self-service

ticket

issuing

system”.

http://www.taibahu.edu.sa/iccit/alliccitpapers/pdf/p707-qureshi.pdf
This fact highlights its possibilities at Britain and its privatization of operation takes over the
betterment of the operation. This lies on the hands of Sri Lankan government to hand over to
a privatization of operation for such procedure for the betterment or control by its power and
proceed the possibilities under the government act.
These are the further directions where the automated machine can be enhanced and as the
railway operation works efficiently, its operation of success and satisfaction among the
passengers would be high to reach demand for SL Railway Transportation.

83

Automated Sri Lanka Railway Ticket Issuing System

14.References & Bibliography
 Rashmika Nawaratne (2012), Railway Ticket Issuing System [Online], NA, Available
at: http://www.slideshare.net/razmik1/railway-ticket-issuing-system-online [1st of Jun
2014]
 Athukorala A.U.B. & Dissanayake C.P (2008), Automated Train Ticket System
[Online], NA, Available at:http://lms.uom.lk/sf/shantha/Project-web-sites/2007-08/Grp04 Mobitiki/Website/documents/Mobitiki%20DraftReport_Group04_final_ver1.pdf [2nd
of Jun 2014]
 Muhammad Ali Qureshi & Abdul Aziz1(2012), Design and Implementation of Automatic
Train

Ticketing

System

Using

Verilog

HDL

[Online],

NA,

Available

at:

http://www.taibahu.edu.sa/iccit/alliccitpapers/pdf/p707-qureshi.pdf [4th Jun 2014]
 Arduino

(NA),

Arduino

Board

Mega2560

[Online],

NA,

Available

at:

Available

at:

http://arduino.cc/en/Main/arduinoBoardMega2560 [8th Jun 2014].
 Arduino

(NA),

Arduino

Ethernet

Shield

[Online],

NA,

http://arduino.cc/en/Main/ArduinoEthernetShield [9th Jun 2014]
 SparkFun (NA), Coin Acceptor - Programmable (6 coin types) - COM-11636 [Online],
NA, Available at: https://www.sparkfun.com/products/11636 [10th Jun 2014].
 Adafruit

(NA),

Mini

Thermal

Receipt

[Online],

NA,

Available

at:

th

http://www.adafruit.com/products/597 [10 Jun 2014]
 Aliexpress (NA), Serial IIC/I2C/TWI 1602 16x2 Character LCD Module [ONLINE], NA,
Available at: http://www.aliexpress.com/store/product/Serial-IIC-I2C-TWI-1602-16x2Character-LCD-Module/110623_643288628.html [11th Jun 2014]
 Learning about electronics (NA), How to Connect and Read a Keypad with an Arduino
[ONLINE], NA,Available at: http://www.learningaboutelectronics.com/Articles/Arduinokeypad-circuit.php [12th Jun 2014]
 SparkFun

(NA),

Piezo

Speaker

[ONLINE],

NA,

Available

at:

th

https://www.sparkfun.com/products/7950 [11 Jun 2014]

84

Automated Sri Lanka Railway Ticket Issuing System
 Dfrobot (NA),

Real Time Clock Module (DS1307) [ONLINE], NA, Available at:

http://www.dfrobot.com/wiki/index.php/Real_Time_Clock_Module_(DS1307)_(SKU:D
FR0151) [12th Jun 2014]

Hobbyist (NA), Step 2: Interfacing the relay modules to the Arduino [ONLINE], NA
Available at: http://www.hobbyist.co.nz/?q=interfacing-relay-modules-to-arduino [15th
Jun 2014]

 Open source hardware group (NA), Tutorial 03: Arduino IDE and Sketch Overview
[ONLINE], NA, Available at: http://opensourcehardwaregroup.com/arduino-shortcourse-public-pages/section-0-familiarization/tutorial-3-arduino-ide-and-sketchoverview/ [20th Jun 2014].

85