Real-Time Bus Tracking System

General description: In this project we designed and built a system for tracking buses in real-time.

Contributors: Kazem Jahanbakhsh, Brendan Clement, and Nick MacDonald

Implementation period: October - December, 2012

Presented @ AngelHack 2012 Hackathon, Seattle

bus stop

Problem description and motivations:
Probably everybody has experience of waiting for a bus at bus stop without knowing when the bus will come. We know how much annoying it is! There are many reasons that may delay buses such as traffic congestion, accident, and etc. It's really painful to wait for a bus without having any clue what happened. In large cities such as Seattle (OneBusAway), Vancouver, and San Francisco we have seen that governments have installed GPS on buses in order track them in real-time. But, what about small cities?

The problem that we wanted to solve was to design, prototype and build a system which tracks buses in real-time without using any hardware structure.

Technical details:
In AngelHack 2012 hackathon event in Seattle [1], we built an autonomous system which tracks buses in real-time without any hardware cost. Our system uses information from bus riders' smartphones in order to track buses.

Collecting bus location data:
First of all, we built an iPhone application for collecting bus locations in real time. This application allows us to collect and analyze real data from buses. The main goal was to compute delay distributions of buses. Below, you see a snapshot of application where it shows bus stops for bus route #6 in Victoria, BC.

collect data app

We got on several buses and collected bus arrival times at each bus stops by using our data collector applications. Below, you see the delay distribution of those buses. Although most buses are on time, there are cases when buses run late or even early! We want to build an application which inform people if a bus is going to be late or early.

The following table shows the delay statistics for buses that we rode:

collect data app

System design:
Our system doesn't need any hardware infrastructure and it's based on collecting information from people smartphones who are on buses. In particular, we designed a system by which we can collect information from people cellphones in an autonomous way without bothering people to manually share any data with our servers. We intended to build an application for tracking and reporting bus locations for iPhones and Android phones. This application allows people to check the bus that they want to catch in real-time on Google map. On the other hand, when a person who is running our bus tracking application on her cellphone gets on a bus we detect that event and send the bus locations from her cellphone to our server. However, the data that we send to our servers is anonymous and our system cannot detemine/identify the source of information. This assures user's privacy.

For doing so, we built a client/server system. In particular, we built a server side application on AWS cloud for collecting bus locations in a city from bus riders' smartphones. The server was responsible for filtering data and making sure that data (bus locations) are reliable before pushing them to our MySql database. For each city, our system already had offline schedule (GTFS data) in its database. Therefore, in the worst scenario we could report offline schedule for a bus if we didn't have any real-time location data for that specific bus.

For the client side, we built an iPhone application to be installed on users phones. This application was basically responsible to collect location of a bus that user wants to catch from the server and displays it on a Google map for user view. Moreover, the client application had two machine learning components in order to detect when a person gets on the bus and send the real-time location of the bus along with its number to our server periodically. Our classifiers were using GPS and voice data collected by GPS sensor and microphone. We recorded and analyze these two sources of data in order to detect when the person cathces the bus.

It is importatnt to highlight the major role that crowdsourcing and machine laerning components play in our system for tracking buses in real time. The following figure shows two experiments that we ran by recording environment noises from a bus and Staples. As we see, audio time signal and its fft significantly differ when a person is on a bus (left pictures) than when she is shopping inside Staples.

audio data

You can watch our video pitch in AngelHack 2012 from here ---> Angel hack team Canada seattle 2012

***Please also don't hesitate to drop me a note at "k DOT jahanbakhsh AT" if you have any comments or questions.

[1] AngelHack Hackathong Fall 2012


You should follow Follow @kjahanbakhsh me on Twitter.