RailLynk - Train
Tracking and Smart
Ticketing for Sri Lankan
Railway

Revolutionizing Sri Lankan railway travel with integrated tracking and smart ticketing solutions.

Train with Sunset

Introduction: Transforming Sri Lankan
Railway Journeys

Current Challenges:

  • Inefficient Ticketing: Long lines cause daily passenger delays and frustration.
  • No Real-Time Tracking: Passengers lack live updates, causing missed connections and uncertainty.

RailLynk's Vision:

  • Card-Based Ticketing
  • Automated Fare Deduction
  • Transaction Management
  • Real-Time Train Tracking

Key Features: Seamless Travel, Smart Operations

Real-Time Train Tracking
Provides passengers and station operators with accurate, live updates on train positions
Smart Ticketing
Card-Based Ticketing: Customers tap their smart card to enter and exit stations.
Passenger Management
Complete passenger registration, profile management, and travel history tracking system.
Station Operations
Efficient station management tools for platform allocation and passenger flow control.

Solution Architecture

Solution Architecture for Smart Ticketing

Solution Diagram 1

Solution Architecture for Tracking

Solution Diagram 2

System Functionality & Integration

Smart Card Security (AES Encrypted RFID)

Each RFID card uses AES encryption and contains 16 memory blocks. We use Block 0 to store the card UID and Block 2 to store travel data such as start station ID, travel time, and available balance. This enables secure offline user verification even when backend access is unavailable.

Online & Offline Ticketing Modes

The system operates in two modes: Online Mode verifies the card balance and syncs with the backend in real time. Offline Mode authorizes passengers locally using card data and stores travel logs in ESP32 flash memory. Once online, all stored logs are synced securely to the backend.

ESP32 with Dual-Core Processing

The ESP32 uses its dual-core architecture efficiently. One core handles RFID scanning and user interaction, while the other manages backend communication (via GSM), card transaction processing, and GPS data updates , all in parallel.

GPS + GSM for Train Tracking

A SIM808 module connects GPS with GSM functionality. It captures the live location of the train and transmits it through a 2G GSM network. A proxy server then upgrades this signal to HTTPS to ensure secure communication with cloud servers.

Flash Memory for Offline Logging

When the system is offline, all tap-in and tap-out data (station ID, time, fare details) are written to local flash memory. This ensures nothing is lost. When internet is restored, the ESP32 pushes this data to the backend.

Real-time Display & Feedback

The LCD connected via an I2C interface provides instant visual feedback, showing card status, balance alerts, validation success, failure, or error messages. This helps both users and system administrators in debugging or verifying actions.

Technology Stack

Backend

  • Django Framework:
    Used as the main backend framework for handling business logic, APIs, and database interactions.
  • MySQL Database:
    Stores core data such as passenger profiles, station data, and travel logs.
  • Neo4j Graph DB:
    Manages dynamic relationships between stations for optimal route planning and real-time tracking.

Frontend

  • React.js:
    Powers a responsive and interactive user interface for both passengers and administrators.
  • JWT Tokens & Protected Routes:
    Ensures secure access to sensitive pages passenger dashboards.
  • Role-Based Access (UI):
    Dynamically adjusts UI based on user roles (e.g., admin, Station Staff, passenger).

Cloud

  • AWS EC2:
    Hosts backend services and APIs on a scalable cloud environment.
  • AWS Amplify:
    Hosts the React-based frontend securely with continuous deployment.

  • AWS RDS:
    Managed MySQL instance for secure and reliable database operations.

Security

  • AES Encryption (Data):
    Ensures sensitive data like NIC numbers are encrypted.
  • JWT Validation (Backend):
    Every request is authenticated using server-side token validation.
  • Role Permissions:
    Prevents unauthorized access to protected resources by enforcing user roles in both frontend and backend.
  • HTTPS-secured APIs:
    All client-server communication is encrypted using TLS for maximum security.

Hardware

ESP32

ESP32 Microcontroller

Processes data, controls LCD, connects to AWS, and manages RFID scanner and Wi-Fi.

RFID Card

RFID Card

Stores passenger NIC, travel time, station ID, and card validity.

RFID Scanner

RFID Sensor

Reads and writes to the RFID card, triggers train access logging.

LCD Screen

LCD Display

Shows travel info, validation messages, and debug outputs.

SIM808

SIM808 GPS + GSM

Receives GPS signals and transmits coordinates to cloud (AWS) via GSM.

I2C Module

I2C Converter

Enables serial-to-parallel communication for the LCD screen.

3D Models & Prototypes

From design to reality – development of the scanner and door system.

Scanner Prototype 1
Scanner Prototype 2
Scanner Prototype 3
Door Prototype

Final Product

Smart Scanner

Smart Scanner

The smart scanner allows passengers to tap in and out using an RFID smart card. It verifies card validity, checks balance, logs entry/exit stations and timestamps, and updates fares securely, both online and offline.

Automated Electric Door

Automated Electric Door

The electric door opens only for authorized passengers. It checks card validity and balance before unlocking. At destination, it verifies trip completion and allows secure exit, ensuring controlled station access.

Software Functionality Overview

Our smart railway web app is designed to streamline operations, simplify travel, and ensure seamless interaction between Passengers, Station Officers, and Admins. Each user role gets a dedicated dashboard tailored to their tasks and responsibilities.

Passenger Dashboard

Easily manage your journey with a smart card-enabled system designed for convenience.

  • Secure login and profile management
  • View recharge history and transactions
  • Real-time train search and location tracking
  • Journey history via smart card usage
  • Recharge with Google Pay
Passenger Dashboard

Station Dashboard

Station staff can access powerful tools to register passengers, monitor activity, and view daily station performance.

  • Register new passengers and delete accounts
  • View daily stats and passenger counts
  • Monitor real-time train arrivals and departures
  • Analyze passenger flow graphs
  • Operational insights for better management
Station Dashboard

Admin Controls

Admins oversee the entire system: register stations, analyze revenue, and monitor all stations and train movement live.

  • Register passengers and operators
  • Review monthly revenue reports
  • Access live train tracking maps
  • Analyze station usage and statistics
  • Oversee full system operations
Admin Dashboard

Train Tracking

Live Train Tracking Demo

Comprehensive Testing Strategy

Front-End Testing

  • Tools: Jest & React Testing Library
  • Unit Tests: Individual components and functions tested separately
  • Integration Tests: Recharge form + balance update working together
  • CI/CD: GitHub Actions for automated testing on every push/merge

Back-End Testing

  • Tool: Postman
  • API Testing:
    • Passenger login & authentication
    • Card scan validation and response
    • Recharge and balance updates
  • Tested data flow, response codes, and error handling

Hardware Testing

  • Manual testing with ESP32 + RFID + Scanner
  • Validated:
    • Card reading accuracy
    • Network reliability under load
    • Monitored power consumption and device resets
Testing Screenshot 1 Testing Screenshot 2

Security & Performance

Security

  • Data Encryption: AES (Advanced Encryption Standard) used for storing and transmitting sensitive card and transaction data securely.
  • Frontend:
    • JWT Tokens for user authentication
    • Protected Routes to restrict unauthorized access
    • Role-Based Access for different user permissions (e.g., admin, station officer, passenger)
  • Backend:
    • JWT Validation on all protected API endpoints
    • Role Permissions enforced through middleware
    • HTTPS APIs to ensure secure communication

Performance

  • Optimized API design for low-latency communication between frontend and backend.
  • Multicore processing in ESP32 for parallel tasks: RFID reading and GSM communication.
  • Offline data caching and sync mechanism for uninterrupted ticketing in poor network zones.
  • Efficient memory use in embedded devices (flash storage, dynamic allocation).

Our Mission

The RailLynk project is more than just a ticketing system, it’s a step toward smarter, safer, and more efficient public transportation. By combining secure RFID technology, real-time GPS tracking, and a robust backend system, we aim to deliver a reliable solution for both passengers and railway operators.

Our goal is to modernize the railway experience with automation, transparency, and connectivity, making travel seamless and accessible to all, even in remote areas with limited connectivity.

Team

Member 1

Peiris T.M.S.U

E/20/284

Member 2

Perera K.M.S

E/20/286

Member 2

Panawennage L.S

E/20/279

Member 2

Dissanayaka D.M.N.H

E/20/078

Supervisor

Supervisor

Dr. Isuru Nawinne

© 2025 RailLynk Project. Built with passion for a smarter Sri Lanka Railway.