Developing an inexpensive Fleet Monitoring System using off the shelf Telematics devices
Tags: telematics, fleet
Published: 2022-08-20 16:06:22

# Overview
In speaking with LCV and HGV fleet operators in South Asia and Africa a common request was to suggest a simple, inexpensive fleet monitoring system that would obviate the need to install expensive hardware on their vehicles and pay a recurring subscription fee.

We created a fleet monitoring system to address this need and made it available to the wider market. The system consisted of the following components:

- A stand-alone Web Application, accessible through any web browser allowing the fleet operator to view the status of their vehicles in real-time.
- A telematics device that uses a published protocol to send messages to a server-side component.
- A server-side component that manages communication with the telematics devices installed on the vehicles.
# The Web Application
The application has two sub-modules

- View Fleet
- Reports
## View Fleet
This module allows user to view the current status of their fleet in real-time.
### Initial View


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2kjlxie6cv34ykmn26p.png)

This view shows the last positions of the Vehicles overlaid on a Map.

- The Map is automatically zoomed in to contain all vehicles for which the position is known,  extra areas not containing vehicles are not be displayed. For instance if all vehicles are in the UK, the map is zoomed in to display the UK ONLY.
- The last position of a vehicle is displayed as a marker (rectangle/box) with RED denoting IGNITION OFF and GREEN denoting IGNITION ON
- The registration number of the Vehicle is displayed in the marker.
### Displaying Vehicle Details

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ntd7lmozt4av8fnbclv0.png)

- Clicking on the Marker displays an overlay that displays additional information about the Vehicle and the following fields are displayed:
  - Registration Number
  - Name of the Driver (if telematics device supports this)
  - Last update timestamp
  - Speed
  - Direction
  - Altitude *(not available currently)*
  - Address of position – *from Reverse Geocoding*
  - Current Run ID – if integrated with Haulier Enterprise (Link)
  - Current Load ID – if integrated with Haulier Lite (Link)
  - Show History (Link)
  - Show Additional Information (Link)
### Show History
The Show History Link displays the recorded GPS positions of the vehicle as available in the system going back in time overlaid on the map and displayed in a Grid below the map – this functionality allows a user to replay the location history of a particular vehicle and see where it may have been at any point in the past.

See Below:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/no2jcbovpkgqg67r4g1g.png)

- The Map shows the GPS positions recorded.
- The bottom part of the screen shows the GPS positions and additional information
- The User may change the date range of the history – in which case the map and the grid will refresh with the GPS positions recorded in the date range.
- The date range is any range upto 7 days.
- Clicking on the Reason column displays the same Additional Information overlay that is displayed on the View Fleet screen.
### Show Additional Information
Clicking on Additional Information changes the screen and replaces the overlay with the Additional Information.

The following information is displayed in the Additional Information popup and is derived from the Telematics device:

- Door: OPEN or CLOSED
- Fuel: %age in Tank
- Temp: Engine Temperature in Deg. C
- RPM: Engine RPM
- ACC: ON (or OFF) – Accelerator State
- ALARMS: Overspeed, Service Required, Airbag etc.
- Code: Diagnostic Code if any
- Avg. Fuel: Current Avg. Fuel consumption in kmpl.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zdy3xpexvtkidmneelsq.png)

## Reports
The reports module has the following:

- Daily Mileage
- Monthly Mileage

### Daily Mileage

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vnr9hhtje5p1j1tputjz.png)

- Parameters
  - Vehicle Registration
  - Date Range
  - Displays two graphs:
    - Litres of Fuel Consumed for each day in the date range
      - Display Fuel Consumed when moving
      - Display Fuel Consumed when Idle
    - Kms travelled for that day
  - Date Range is limited to 30 days.
  - Displays Average Statistics for the period on the right.

### Monthly Mileage

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypmc6msfotm1nirgle02.png)

- Parameters
  - Vehicle Registration
  - Date Range
  - Displays two graphs:
    - Litres of Fuel Consumed for each month in the date range
      - Displays Fuel Consumed when moving
      - Displays Fuel Consumed when Idle
    - Kms travelled for that month
  - Date Range is limited to 12 months.
  - Displays Average Statistics for the period on the right.

# ` `Telematics Device
To install on the vehicle we choose the Kitarm KT-2000G which has OBDII port and internal communication and GPS module. It supports GPRS, SMS, TCP, UDP and OTA. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkm1nh8uey4d5pcix19m.png)

The device supports 3G and 2G communication with an optional add-on 4G-LTE module. To communicate back to the server the device uses a simple JSON protocol. Prior to installing the device we flashed each device with the endpoint URL and connected to the vehicle using a simple inexpensive connector:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hb976yhp6ezaccujoivs.jpeg)

The connector connected to the battery and starter of the vehicle and the ECU through a port on it. We successfully trialed this configuration with a TATA Motors 1616 and 1613 Truck.
# Server-Side component
The server-side component was developed with an AWS Lambda endpoint and AWS SQS to queue up the messages from various vehicles. The specific protocol i.e. format of the message and commands from the device is specific to the device that we chose, however the AWS Lambda endpoint has been developed such that the specific protocol is abstracted from the other functionality:

- The Server-side Lambda has 3 main functions:
  - Receive the incoming message through a JSON endpoint.
  - Parse the incoming message – to extract the data.
  - Write the data to an AWS RDS database (MySql).
  - Sending a response to the device on the backend of the received request.
- Should we need to change the device then only the code for 2&4 needs to be changed.

# Conclusion
This simple fleet monitoring application is relatively fully featured with a low upfront cost and minimal recurring expenses.