Week 10 - Nov 6 - 12


     This will be last week in the design phase of the IoT on Wheels Design Challenge and for my trafficpredictor project. This blog will be a walkthrough of the completed module 1. Check out Part 1 of this blog - Traffic Predictor #8 - Predicting the best route to avoid traffic [Part 1 of 2] for a better understanding of the progress.

Module 1 - Traffic prediction with machine learning

To be covered in this blog,

Completed App (Android)

Functionality explained

Database Schema

Machine Learning model


Completed App (Android) & Functionality explained

     I have already given an insight of how the trafficpredictor mobile app looks like in

     In this blog, I will explain the completed app in detail with the functionality of the traffic predictor project followed by. The various screens or activities (if I were to say the Android way) are categorized as follows:


  • Home

         This is the page where the user lands once the user successfully logs in. This page contains details about the user and the last trip user has taken to. It also has buttons to redirect a user to Maps and Auto Pilot Screens.

App Home         

  • Maps

        This is the main interaction screen related to the trafficpredictor project. The first screenshot in the gallery below is the main Maps screen. It has almost all GMaps Option using GMaps API.

      1. We can locate our current location using LOCATE ME button.
      2. We can Search addresses in both From and To text box. Also, we can mark the same on the MAP shown below all the buttons. This is used along with the PREDICT button. The From and To GPS latitude and longitude locations marked will be queried to the database. This will return a match from the list of available traffic free predicted data which is machine learned. [Refer the second screenshot in the gallery below, for an example of the predicted route marked in green].
      3. REGISTER button will provide the user's Journey ID using this API - https://traffic-predictor.000webhostapp.com/JourneyId.php. Hit this and you will receive a message like {"success":true,"journey_id":15} in JSON format.
      4. START and STOP buttons are used to mark the start and end of user's journey. The data (GPS latitude and longitude of current location) collected from when the user starts the journey will be stored along with the generated Journey ID. This is to keep the data as one set of entry.


{gallery} Maps Screen

App Maps

Image: Maps Screen

App Predicted Maps

Image: Predicted Map Route from my Journeys!


  • Auto Pilot

          For details on the Auto-Pilot functionality check out my blogs - Traffic Predictor #10 - Evading traffic like a Bat and Traffic Predictor #11 - Module 2 and 3 [Completed] . The GET SPEED button fetches the best speed for your current location. The GO LIVE displays your current speed and next to it a text (Move) which describes whether you have traffic or not from the Hardware communicating through Bluetooth. Also, we have a toast (below GO LIVE button) displaying the Bluetooth's MAC address.

App AutoPilot

  • About

          This screen displays what the application is all about. This gets data from the webpage - https://traffic-predictor.000webhostapp.com/About.

App About

  • Connect Device

           This is used to connect the hardware through Bluetooth. We have buttons to turn ON and OFF the Bluetooth. Also, LOAD DEVICE LIST to display the list of paired devices.

App ConnectBT


Database Schema

      The database for the trafficpredictor project has the below tables

          1. User - To store the user profile data.

          2. gpsData - To store the GPS Co-ordinates when the user sets out for a journey.

          3. machineLearn - To store a formatted version of gpsData with one row for a full journey.

          4. predictedData - To store the best route with less traffic_count and less duration.

          5. predictedData_Arc - To act as a backup of predictedData storing the records whenever they are inserted, updated or deleted from predictedData.

Database Schema


Machine Learning model

     Below is the machine learning model for my trafficpredictor project, I managed to model my thoughts and give it below. It is self-explanatory, I believe. I designed the below on Gliffy.




Progress made so far,

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||   90%

{tabbedtable} Tab LabelTab Content
Entry & Introduction

IoT on Wheels Design Challenge - Traffic predictor and auto pilot mode

Traffic Predictor #1 - The Official Announcement

PlanTraffic Predictor #3 - The Plan
Initial Setup

Traffic Predictor #2 - Quest for the Code Editor

Traffic Predictor #4 - Finally, the kit arrives

Module 1

Traffic Predictor #5 - Machine Learning and Building a case for the kit

Traffic Predictor #6 - Into the traffic [Part 1 of 2]

Traffic Predictor #7 - Into the traffic [Part 2 of 2]

Traffic Predictor #8 - Predicting the best route to avoid traffic [Part 1 of 2]

Module 2 & 3

Traffic Predictor #10 - Evading traffic like a Bat

Traffic Predictor #11 - Module 2 and 3 [Completed]

IntegrationYet to Begin
Revisions and Hardware, Software ListTraffic Predictor #9 - Revisions and Hardware, Software list