How to Make a GPS tracking device for Vehicle and Fleet Tracking

Internet of Things

How to Make a GPS tracking device for Vehicle and Fleet Tracking

You are probably looking at GPS tracking systems for vehicles, likely because you want to:

  • Leverage analytics to streamline operations
  • Make remote operations more transparent and easy
  • Instill new insurance models to lower risks
  • Eliminate revenue leakage with connectivity
  • Reduce theft
  • Increase operational transparency

This list goes on…

But, what I am going to show you here is not just what you can do to build such solutions, I will also show you how exactly I helped billion dollar organizations and small business implement such solutions with zero risks.

That too in less than 5 months (from idea to production testing!).

When I got my first assignment on a fleet tracking solution, I’d to fail multiple times to know what would exactly work. And failures come with a cost!

After reading this blog post, you would not only be able to figure out your need but also become a subject matter expert to drive such initiatives with confidence. I wish someone had written this when I was starting.

Nonetheless, here’s your roadmap towards location based services and GPS vehicle tracking systems –

What is GPS car tracking and how does it work?

It is important to know how GPS based car tracking work for vehicle fleet systems in order to build a system that can actually work for you. The location tracking with GPS is precise to 1-2 meters of the vehicle being tracked. GPS based car tracking systems also allow us to track:

  • Movement
  • Direction
  • And, speed of the object being tracked

GPS based vehicle tracking wasn’t just another revolution for compliance and tracking, but was also a key component for location based services and analytics.

So, how do GPS based vehicle tracking systems actually work?

We have hundreds of satellites orbiting around our planet with time clocks perfectly synchronized (they are atomic clocks). GPS devices on the other hand don’t have an atomic clock, so they are pretty inaccurate and require continuous adjustment based on signals the satellite’s end. All of that happens within your hardware.

Now, your GPS device cannot request any information from satellites. The reason behind that is pretty simple – your hardware doesn’t have enough power to ask for information. What GPS tracking devices rather do is to fetch broadcasted location signals from these satellites.

When Satellites orbit around the Earth:

  • They have well known orbits and location trajectories
  • Push out information on their time and location

Now, when a signal is received on the GPS vehicle tracking system, your GPS hardware solution has a program in it that compares the incoming timestamp information. This timestamp information is then compared to a hardware clock’s time on to calculate the distance from the satellite.

All you need is three satellites broadcasting this information to your GPS located on your vehicle. This triangulation results in extremely accurate location information that is accurate down to 0.5-2 meters.

That’s how GPS tracking works.

But, you are looking for GPS vehicle tracking systems, right?

Talking on broad terms, GPS vehicle tracking systems can be of three types:

  • Mobile app based GPS vehicle tracking: You consume and use information directly from mobile. Rather than creating another GPS based device, you end up creating a mobile app that uses GPS sensors instead.
  • OBD II based vehicle GPS tracking: All vehicles manufactured after 2004 have an onboard OBD II interface in it. An OBD II based port is similar to a USB port that you see on your computer. It allows an external hardware to communicate with your vehicle and get information from it
  • Hybrid OBD II based solution: In some of the large scale insurance and remote fleet management programs that I’ve been a part of, we saw cellular connectivity adding unnecessary expenses to these programs. That was increasing the risk index of the vehicle fleet tracking projects. As most of the mobility programs already had a cellular plan in it, it was easy to have an OBD II type interface push information over Bluetooth low energy to a mobile app.

Now that you know what those three different type of vehicle GPS tracking systems are, let’s now look at the components that are involved in making these solutions.

Talking at a very high level, we have the following components that are a part of a GPS based vehicle tracking solution:

  • A phone, or a hardware based GPS receiver
  • A casing that holds your hardware
  • Car adapter – You can actually have a design where you won’t even need an adapter
  • Firmware that helps this hardware to work
  • Direct power supply or an inbuilt rechargeable battery
  • Cellular or BLE connection module
  • Cloud application

What GPS tracking features people like to use?

Some of the features that GPS vehicle tracking systems bring to the table are:

  • Fuel mileage optimization: We do see a lot of companies using algorithmic optimization for greener business operations when it comes to large scale fleet deployments. But how does miles travelled correlates with gas consumption, when there are more to fuel consumption. You would be shocked to see how much driving patterns, misuse and engine conditions impact fuel level consumption
  • Theft reduction via Geofencing, action tracking and remote kill switch
  • Remote fleet management
  • Driving restricted to the restricted speed limits
  • Creating a smart driving assistant
  • Understanding driver fatigue
  • Automotive Dead Reckoning

How can you make your own GPS tracking system(software, app and hardware)?

GPS vehicle tracking system can be broken down into 3 different parts:

  • GPS vehicle tracking hardware
  • Mobile app
  • Cloud application

Building a GPS vehicle tracking hardware

There are a lot of options to build a vehicle tracking hardware:

  • Get a custom hardware built based upon your specs
  • Use a completely off the shelf solution and integrate it with your solution
  • Modify an off the shelf solution and integrate it with you system

We will go step by step into these, first let’s see how you can build a custom vehicle tracking solution.

What I am going to walk you through isn’t a very easy-to-follow section. But if you are really serious about building your IoT based GPS vehicle fleet tracking product, you should be able to follow.

Let’s first look at customized IoT product development.

Building a custom GPS vehicle tracking system

It is easy to perceive hardware as just hardware with components placed on it, but in reality is a solution that is built by taking good (or bad) engineering decisions.

When I look into engineering design, I first list down all possible problems that we might have to deal with and opportunities that we have here.

Common challenges that we see while building GPS vehicle tracking systems:

  • Vehicle movement, especially in speed generates vibrations and stress. In rural areas, vibration and high impact conditions and create issues 
  • Signal performance and power consumption
  • Internal interference due to presence of other electronic components
  • Supporting new as well as old bluetooth versions
  • Supporting multiple electrical protocols

Opportunities that I currently see with building GPS vehicle tracking systems:

  • Smarter PCB design
  • Reduction of form factor

After building such devices repeatedly over the time, I would prefer to go for a solderless design. This is important here as we have a PCB that will be placed in an environment where it will be subject to high degrees of vibration and impact. Note that we are talking about designing an OBD based IoT tracking device that relies over BLE to push automotive data to a mobile.

Screwless, solderless design

As seen in the image below, I will design the PCB in way that it will be held in its place using compression forces.

Solderless Design

Soldering usually concedes when put under heavy vibrations. And, adding screws increases the chances that your PCB might break when put under stress.

One more thing that any seasoned hardware developer would notice is the fact that since we are looking at multiple PCB layers here, we should add grounding connections between the antenna connectors. This will lower the interference between them.

A 4 Layered PCB

I forgot to mention that the PCB assembly in itself would be a 4 layered PCB design so that we can make the GPS vehicle tracking device extremely compact.

Layers of custom hardware design
Layers of custom hardware design

There’s an extended copper wiring at the corners of this PCB board(Image below). This exposed copper wiring isn’t a design mistake, it is deliberately placed to reduce extremely electromagnetic interference from the surroundings. If this isn’t properly taken care of, your GPS readings can go haywire.

Copper Wiring

To make sure that the device can operate with mobile phones that have older and new versions of Bluetooth, I placed a LBMA15Q1BX module in this design. This BLE module can support mobile phones back from 2012.

The GPS unit selected within this PCB design was G7020 from Ublox.

The way I designed this, PCB had Bluetooth and GPS antennas integrated in the same flexible adhesive backed part, to be placed near the front cover. This not only minimizes the PCBs size, but also increases the radio performance as I increased the distance between the antenna and any other radio blocking components within this PCB.

When it comes to microcontroller, I went with STM32L151 as the microcontroller, it has 16MB Flash memory, MX25L1606E as the NOR Flash and LIS3DH accelerometer. The components can be seen in the image below

GPS device hardware building components

Add copper to increase performance

When you look at the finished PCB of my project, you would find that it has both sides of the same color as the outside layers are ground. I deliberately added and filled it with copper to increase the performance of the radio modules.

Making this hardware talk to automotive

So far from what we have, we don’t have anything can talk to an automotive, and neither can fetch information from it. In a blog post that I wrote earlier, I’d mentioned that microcontrollers are always used for specific purposes.

We’d a microcontroller on top layers and we won’t be able to use it for an entire different use case like fetching information and managing the interface with an automotive. In my design, you can find a powerful microcontroller STM32F205 placed on the bottom layer that talks to your vehicle using NCV7356 module. I have even placed an indication to notify driver visually in case of an emergency.

Vehicles usually supply 12 Volts, we need to convert it

On the bottom layer, you can also find that I’ve placed a voltage comparator LM239QT that converts 12V coming from the vehicle to usable 5V using a voltage regulator.

More explanation on why the design is like this?

As you saw earlier, I had one microcontroller on the top layer and one very powerful microcontroller at the bottom layer. A lot of people actually asked me on why I chose two different microcontrollers.

The reason is simple I don’t OVERDESIGN!

Note that I’ve a definition of overdesign and safe design. I would rather do safe design than overdesign. Overdesign costs you a lot more and could make your product looks the edge from a pricing point of view.

In the case of this OBD based GPS tracking device, fetching data, transmitting it and controlling other modules required a slightly more expensive microcontroller, that’s why I went with STM32F205 here. Whereas, the top layer required a microcontroller for a lightweight merging of data from GPS, accelerometer and other modules and pass it to BLE.

If you want a simple visualization of processes between all layers and components, here’s an easy to read flow for you

I don’t specifically remember the per unit costs here, but the project had a business constraint to keep it below $130 per unit. I was able to get it to a range of $80-95 per unit.

The system was extremely well built from both, electrical and mechanical standards, packing a lot of functionalities into a small form factor with performance as the top priority.

Using an off the shelf solution

Sometimes I got the opportunity to work with teams that were extremely focused on their business, and didn’t want to spend a huge time doing custom development. For these organizations it was extremely important that they get something as simple as plug and play. They didn’t want to see what they can optimize or what they can’t, simply because their core was their business and technology was a small enabler.

If you also fall under similar organizations, read on, else feel free to skip this section. You can buy an off the shelf hardware and software package that can easily be integrated into your business services using API access. If you do that, you’ll get a very fast go-to-market, although with heavy recurring costs. But at the same time very low technology management overhead.

If you are 100% sure that your business needs are least likely to change and you have an off the shelf product that supports it – then and only then go for it.

If you already know that your product is going to pivot a lot during product validation, I would suggest you to build a GPS tracking IoT prototype first. When you are done with testing the product have validated your product idea, then feel free to use any off the shelf package.

What if GPS signal isn’t continuously available?

Even in US, you will find large geographies (rocky mountains) where you won’t get a continuous GPS reception. Some of the fleet tracking requirements that I’ve come across often need continuous tracking for all parts of the vehicle’s journey. With intermittent GPS reception how would your GPS vehicle tracking solution would:

  • Be able to help your fleet navigate?
  • Record logs/transmit logs of exact location?
  • Generate accurate billing for a customer that is using a Taxi or a bus service?

3-4 years back, these were used to be a very huge concern, and it wasn’t easy or either cost effective to place algorithms in place to do that for you. But these days you can simply integrate a pre-made hardware module like the Ublox NEO-M8L to get ADR (Automotive Dead Reckoning).

GPS vehicle tracking system ADR module

What is ADR(Automotive Dead Reckoning)?

Automotive Dead Reckoning is the process to extract potentially accurate (95% accurate) location with the help of parameters like:

  • Speed information from the vehicle’s OBD
  • Last known GPS locations
  • Last known direction
  • Gyroscope data
  • And many more

Automotive Dead Reckoning can be easily accurate with a maximum location error of 2.5 meters, and can even be a really good solution for places like Urban environments and Tunnels, where GPS accuracy often goes down.

Good thing about ADR modules is that they are extremely easy to use, they come with prepackaged firmware that’s easy to interact with over a custom PCB and helps you avoid unnecessary hardware product development costs.

Hacking an off the shelf solution + Custom cloud

What if neither are a viable option for you?

I have seen enterprises that wanted to:

  • Reduce Go to market
  • Didn’t want to spend a lot of time in uncharted territories of embedded
  • Couldn’t find off the shelf solution that was helpful enough
  • Coudln’t get off the shelf solution to fit in their processes
  • Felt locked with low agility with off the shelf solutions

This is a far more large concern for mid-tier organizations that can’t afford even minor failures.

I was working with my team on a really large remote fleet operator in the US when we had to come up with a solution that rotated around the problems I just listed before.

This is where your intelligence in hardware product development should kick in. What I did was to speak with a couple of US and China based hardware manufacturers of OBD II based tracking devices. I got 2 review samples from 7 different vendors.

I wanted to see if I can make small adjustments in the firmware to accommodate custom cloud and other services in vendor’s hardware. Another goal was to check if the hardware was business compliant and the security wasn’t an afterthought.

Within few days of receiving these devices I was almost sure of what will actually work for the project. It was a trk06 OBD II module.

trk 06 OBD II

Configuring this module was extremely easy, all we had to do was to add our cloud end points in the firmware and make sure that it pushes information to that payload.

All it took was 3 minutes for us to do that, and we were all set from the hardware’s end. We did a ton of optimization on the cloud-front to make sure that the cloud was resilient enough to handle so many real time information and requests.

Here’s a miniature overview of what the cloud solution actually looked like

mongoDB

 

So, that’s what a complete solution looks like.

We’ve come a really long way in building a GPS vehicle tracking system and hopefully it should help you identify how exactly you should approach it.

I’ve left a lot of details here like battery optimization, some PCB design considerations, apps, etc as it gets extremely difficult to convert everything into one single blog post. If you have any specific questions feel free to drop a comment or reach out to me at hardik@simform.com.  

Working from last 8 years into consumer and enterprise mobility, Hardik leads large scale mobility programs covering platforms, solutions, governance, standardization and best practices.

Leave a comment

Your email address will not be published. Required fields are marked *

Simform blog

Join our IoT Mailing List

We write highly actionable, practical tips from our experience of building large scale IoT products. Join our mailing list to know everything you need to build a successful IoT product for any level of complexity. 

You have Successfully Subscribed!