
The project mentioned in the title was completed several years ago as part of my engineering thesis. What does this title actually mean? In simple terms, it is a system consisting of a device that tracks the location of a vehicle (car, motorcycle, etc.) and a web application used to operate it and read the collected data.
For a long time, I searched for a topic I could implement as my engineering thesis. Eventually, I settled on the idea of an object localization device. Initially, it was supposed to be a miniature device that could be hidden, for example, under a bicycle saddle or inside a courier shipment. However, as I delved deeper into the subject, I decided to design a device that could be used as a GPS tracker for a car or motorcycle. There are plenty of such devices and solutions on the market, but why not build one yourself — cheaply, on your own terms, and based on open platforms?
A Bit of Theory
Knowledge of how satellite positioning works is not strictly necessary to build the system discussed here, but it is worth explaining some of the theoretical basics on which the devices in the system are based. How does satellite positioning work? Although the entire system is very complex, its principles are quite simple. Satellite positioning works by measuring distances between satellites and the receiver.
To determine a point’s position in three-dimensional space, the distances between the receiver and at least four satellites must be known. If we know the distance between the receiver and one satellite, we can determine that it lies somewhere on the surface of a sphere with a radius equal to the measured distance. Knowing the distances to two satellites allows us to locate the receiver at the intersection of two spheres. Distances to three satellites define two possible intersection points, while distances to four satellites determine a single point — our actual location. This is illustrated in the figure below:

So how do we know the distance? It is calculated based on the difference between the time the signal was transmitted by the satellite (which uses atomic clocks with extremely high accuracy) and the time it was received by the receiver. Since the signal propagation speed is known and equal to the speed of light, it is possible to calculate the distance the signal has traveled.
Currently, four satellite navigation systems are in use: the American GPS, the Russian GLONASS, the European Galileo, and the Chinese BeiDou. Each satellite navigation system can be divided into three segments:
space segment — a collection of artificial Earth satellites transmitting navigation information,
control segment — monitoring and control stations responsible for operating the space segment, as well as supporting institutions that provide UTC reference time, orbital parameters, manage satellite replacement, etc.,
user segment — GPS receivers.
More information about satellite navigation systems can be found at technologiagps.org.pl.
System Assumptions
The main task of the device and the entire system was to create a platform that provides access to vehicle location data. The system was designed to perform the following tasks:
determining the position and speed of the object at a given time (automatically and on demand),
permanent storage of location data, devices, and users,
displaying location data on a map,
generating reports.
The minimum set of data to be collected included:
longitude,
latitude,
altitude above sea level,
speed,
exact time the position was obtained.
Another important requirement for the device was sufficient energy efficiency so that the battery would not discharge after just a few days of the vehicle being stationary.
Equally important was the user application. At the time I designed and built the system, I focused only on a browser-based application for desktop computers (developing a mobile application back then would have been simply too ambitious). I did eventually start working on a mobile app as well — after defending the thesis, just for myself :)
The most important aspect of the application was the ability to display routes on a map for any selected day, check speed at a given moment, and similar features. Of course, this also required a login system, permissions for specific vehicles, and a few less important features, such as editing user data.
The final requirement was to make everything as cheap as possible, using simple methods and open-source software, but without cutting corners — meaning the system had to be secure, visually clean, and function properly.
System Operation Concept
The system operation is based on three main elements:
the unit,
the server,
the user.
The unit consists of a microcontroller and modules communicating with it:
a GPS module,
a GSM / GPRS module.
The overall concept is presented below:

The GPS module is responsible for collecting all location data and continuously sending it to the microcontroller. The GSM module is used to connect to the server and transmit the data. On the server side, a script receives the data sent from the device and stores it in a database. The web server enables visualization of this data.
As for the device itself, it can operate in two modes:
monitoring mode — all modules are active and data is sent at a defined interval,
sleep mode — the GPS is turned off and the GSM module is put to sleep. The device waits either for the ignition to be turned on or for manual activation via SMS.

There is also an intermediate mode, in which, after sending an SMS with specific content to the unit’s number, the module activates briefly, collects the location, sends the data to the server, and then goes back to sleep.
Regarding the web application, all functionality can be presented in the following use case diagram:

The entire system concept can also be illustrated with another diagram — the system deployment diagram:

That’s all for the theoretical aspects of the system. Good assumptions are half the success :). In the next post, I will describe the technical side of the heart of the project — the localization unit.
The entire system, along with code and schematics, can be found on my GitHub: github.com/mateusznitka/nittrack.
You can find next part here.
Comments