How To Live-Track A Bus On A Map
In the course of building Chalo over the last 6 years, I’ve met many people who felt that live tracking a bus on a map must be as simple as installing a GPS device on the bus and then turning on a live location stream. “Why is this such a big deal?” some have asked. One person even suggested that we should just give a smartphone to the bus driver and track the phone itself – Et Voilà!
In theory, it ought to be that simple; but, as we discovered while building Chalo’s live tracking service, reality was far from simple.
Step 1: Route And Bus Stop Mapping
Before one can install the first GPS device to track a bus, there is basic foundational work to be done to digitise every bus route and every bus stop in the city.
In developing countries like India, urban centres and their populations have grown rapidly over the last few years. Public transport services like buses have been playing catch-up with the spreading urban sprawl. However, basic service information such as exact bus routes, stop lists, and schedules have been maintained manually with legacy paper-based processes. There has been little to no computerisation outside of the central offices of transport operators.
New bus stops have mushroomed up in newly built neighbourhoods, driven by local demand, and many often remain unmarked for years altogether. These unofficial bus stops are a hallmark of many of India’s smaller cities. Bus routes have also deviated slightly every few months as new roads have been built and old ones get congested. With a series of small deviations, the present-day bus routes are significantly different from those originally planned routes several years ago. Lastly, and most importantly, schedules, which are the make or break factor for any transport operator, have fallen in disarray with new stops, different routes, and ever-worsening traffic congestion.
Chalo’s first step in introducing live tracking in any city is to consolidate all this information and digitise it to reflect the real-world scenario. Exactly as one would expect, this is a completely manual exercise.
We deploy team members who trace every bus route laboriously through the city, mapping every turn and every bus stop along the way down to a metre of precision. Our tech team has built a dedicated route-mapping app to automate certain aspects of this process, such as polyline creation. Mapping this information precisely is key to eventually delivering a high-quality live bus tracking service and accurate live arrival time information to passengers.
Step 2: Installing GPS Devices
Once the route information is digitised, we install GPS devices on every bus. With our earliest GPS installations, we realised quickly that the standard devices used by fleet operators at the time would not suffice. It was common practice to use devices with lower location accuracy and a location update frequency of every 1-2 minutes. These devices operated on the older 2G telecom networks, and hence also suffered from latency issues. Operators chose these primarily to save on the initial cost of purchasing the devices, as well as on the ongoing maintenance and telecom charges.
Meanwhile at Chalo, we had set ourselves an ambitious goal of delivering tracking accuracy of a few metres, and a live arrival time that’s accurate to within seconds of the actual arrival time of the bus. However, if you receive the location of the bus once every 1-2 minutes, and that location itself is not accurate, all it takes is one missed location ping to suddenly be one bus stop behind on your live arrival time. That means that a user relying on Chalo will miss their bus!
We worked with partners to develop specifications tuned towards delivering accurate locations with very high frequency location updates – once every 5-10 seconds. We optimised device firmware to minimise telecom network latency, and reduced data packet sizes to improve network transmission time. Since 4G networks are still intermittent in our cities, we had to develop these improvements within the constraints of legacy 2G networks. We also purpose-built our own technology platform to process live location data packets in milliseconds.
The Smartphone Experiment
We honestly did try tracking smartphones as well, but that simply didn’t work out for reasons, which seem obvious in hindsight.
Firstly, the devices themselves are not purpose-built for such an activity. This is a highly processor-intensive and energy-intensive activity, and the smartphone device architecture has not been designed for 16 hours of continuous live location tracking. GPS chipsets in smartphones vary in accuracy and can take several seconds to establish a location accurate to within 3 metres, which makes them unsuitable for Chalo’s live tracking purposes. Plus, smartphone operating systems have several other services running in parallel that compete for processor and network bandwidth and further drain energy. Lastly, as a portable external device, they are simply not as reliable as permanently installed dedicated hardware is. They get damaged easily in the harsh operating environment of public transport; and budget smartphones are not dust-proof or weatherproof either.
Secondly and more importantly, a smartphone solution has a high reliance on human intervention that simply does not scale well. In our short-lived experiment of a few days, we encountered absurd problems such as the driver forgetting to charge the smartphone overnight, or, as it happened in one case, forgetting the phone itself at home. We spent several hours trying to figure out why the bus was stuck in a residential area and not moving at all!
Lastly, GPS devices come with their own advantages. From simple things like ignition detection to accessories such as panic buttons, fuel sensors, RFID readers, camera connectivity, and more, they contribute rich data that significantly adds to Chalo’s live tracking dataset and for building future applications.
There is no better hardware solution than a dedicated GPS device for delivering a highly sensitive consumer-grade live tracking service.
Step 3: The Human Challenge
At the outset, we had certainly not anticipated that one of the greatest challenges to delivering live tracking to bus travellers would not be technological, but human.
With a GPS device on their bus, the driver and conductor suddenly feel watched. Even though our intention was not to track their performance, it is basic human nature that they should resent this, and especially because neither the transport operator nor Chalo had taken them into confidence and involved them in the execution of the project.
Incredulously, rats would eat up the wires of GPS devices every other day. Devices would malfunction inexplicably or be found damaged. In some extreme cases, they would go entirely missing. Things are always crystal clear in hindsight, and this was a hard-earned lesson for us.
We learnt that we must always involve the bus crew from the initial days of implementation and invest time in earning their confidence. Their initial resistance converts to enthusiasm once they see a demo of the Chalo App and how it benefits passengers on their bus. Our advertising agency pitched in to come up with a training communication theme of having a bus full of happy passengers, which helped deliver the message.
By involving them in the larger mission of the project, over time conductors and drivers have become key members in delivering a successful live tracking project. They are the first to reach out to inform Chalo whenever there is a deviation or a service disruption of any kind. They also help bus passengers download the Chalo App and demo it for them. Ingeniously, some bus crew members have even learnt to use the Chalo App to track the bus just ahead and behind them, so they can maintain an even frequency on their route.
Step 4: Mapping Buses To Their Routes
In most cities, the depot manager at the bus depot assigns a route to the bus driver and conductor. This is a manual process and a bus, along with its driver-conductor pair, could end up travelling on different routes through the day. The decision of which route to dispatch a bus on is dynamic, based on current conditions, and not pre-determined. It varies based on the buses available in the depot at any time, and is impacted by traffic conditions, road obstructions, breakdown of vehicles, and even more mundane factors such as staff attendance.
For Chalo, when a bus trip begins, it is critical to know the route that the bus is embarking on. Without this, we have no way of knowing its intended path, and hence no way of displaying the route on a map or calculating live arrival times.
In the early days in any city, we have team members stationed at such dispatching points who update our systems matching a bus to a specific route as it leaves the depot. They also train the depot staff on how to update Chalo’s systems to show a bus correctly on the Chalo App. A bus appears live to passengers on the Chalo App only when it is mapped correctly to the route it is travelling on.
Over the first few weeks, our artificial intelligence-based live tracking engine uses predictive algorithms to learn the behaviour of the citywide bus network and start predicting the route of the next bus. We verify these predictions against the data reported by our dispatching teams. Once a high degree of accuracy is established, the system’s automated predictions are used to map buses to their routes. Any deviations from the predicted route are re-calculated, and buses that cannot be mapped to known routes are immediately removed from the live app to avoid confusion.
We also track when a bus deviates from its route with a very high degree of accuracy. This can happen for a variety of reasons like traffic accidents, road closures, road works, etc. Our live tracking engine predicts where the bus is likely to join back on its original route and keeps Chalo App users informed of the revised live arrival times accordingly. This information is also sent to our city operations team, who can publish alerts and service disruption information on the Chalo App to keep bus passengers updated in near real-time.
Our Secret Sauce – Chalo’s Live Tracking Tech Platform
We’ve touched upon some aspects of Chalo’s live tracking technology stack already – the optimisations for sheer processing speed, machine learning algorithms for route predictions, and artificial intelligence-based live arrival time calculations. But, if you ask any member of our tech team, they will tell you that the key to the success of the Chalo App is down to one word – scale!
Over a standard 16 hours of service time, each bus can generate 11,520 live location updates. That’s 170 million location updates a day for the 15,000 buses that Chalo currently live tracks across 23 cities. With each location update, live arrival times for every bus at every bus stop along its route are re-calculated. Using a simple assumption of 30 stops on average per route, that is a whopping 5 billion live arrival time calculations every day.
Chalo maintains an exceedingly high accuracy goal on these 7 billion arrival time calculations. We aim to achieve a live arrival time prediction within 1 minute of the actual arrival time for 97% of all bus arrivals.
Our micro-services based architecture ensures that any hiccups in one part of the platform do not affect any other part, and with principles such as fault tolerance and auto scaling, we have been able to achieve an uptime of 99.98%. It takes a large cloud-hosted infrastructure across all 3 of the world’s top providers – Amazon, Google, and Microsoft – to achieve this scale, speed, and accuracy.
The Journey So Far…
It has taken us 6 years to bring the time taken from initiating a GPS location ping from a bus to displaying it live on your phones down from 120 seconds to millisecond measurements. With each iteration, we still see lots of room for improvement.
More importantly, we have found new applications that overlap live tracking data with other live data streams to help passengers. By combining live tracking data along with live ticketing information, we have recently introduced the ‘live passenger indicator’ feature in some cities. Passengers can now see how crowded the bus is in real-time and choose to take a different less crowded bus. In usual times, this helps with comfort and convenience, as passengers can choose a bus with available sitting space. Moreover, in these times of COVID-19 precautions, it is an important aspect for safety and in our fight against the coronavirus menace.
It has been quite a journey so far, just putting a live bus on a map. At each stop along the way we have learnt something new – sometimes in solving a technological challenge, and sometimes a human one. We are looking forward to what the next few years will teach us now.
About the Author:
Vinayak Bhavnani is responsible for the Product and Technology at Chalo. He has been a part of Chalo since its inception in 2014 and is passionate about using technology to make the everyday commute easier, simpler and convenient for the overwhelming majority of people in the country. At Chalo, Vinayak oversees development of all products – for consumers, bus operators, and regulatory partners – and the entire technology platform, spanning live tracking, ticketing, payments, cards, and more. Under his guidance, Chalo has become one of the few companies in the world to have built the entire technology stack for public transport operations management.
Published in Telematics Wire