GPS tracking using Raspberry pi can be done with serveral techniques. Here we are going to try out an hub method by using Raspberry pi 4 as a server for hosting.

Why?

GPS device is about finding co-ordinates in a map, but we have several GPS devices with client configuration.For example, GPS device will send data connected via GPRS to the server.

Here, Data will be routed to the third-party cloud and makes it less secure with respect to software holders.


Let's Test

Raspberry pi 4 -4GB varient can be a server with Node-red hosted on it in the server side and Raspberry pi zero , ESP8266, Arduino with GSM module(any Opensource module with Internet) can be our client side material.

Obviously, our client side boards will be the one which will find co-ordinates or the one which travels. Hence, Signal needs to be high and internet data can be low.

On Server side, Node-Red - a visual programming tool can be used to configure the incoming data via MQTT protocol, later it can be parsed to visual Dashboard map to view exact location.

This can be a series of tutorial with respect to various boards, So, let's get start with simple things.

Things we need, 
  • Raspberry pi - now any variant
  • GPS module - NEO7m 
  • USB cable for NEO7m to connect with raspberry pi.
Softwares

We need GPSD and Node-Red installation.

  • sudo apt-get install gpsd gpsd-clients 
  • bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Running the above two commands will get you ready for programming visually with GPS module.

Now, connect the module to Raspberry pi via USB cable.

You can also start the Node-RED service on the Raspbian Desktop by selecting the Menu -> Programming -> Node-RED menu option.

This opens up url localhost:1880 with Node-Red.
Now, install GPSD package in Node-Red from ManagePallete 

Now, you can add gpsd and a debug node from node pallete.

click deploy to see the GPS values on debug tab as shown below.


now lets, install dashboard and worldmap from pallete for UI.


choose second on the list in dashboard.You can see the dashboard components in the node pallete (left side)

Let's complete the first stage of the tutorial with following node config.

Add the code inside the function node:

return {
  payload: {
    lon: msg.payload.lon,
    lat: msg.payload.lat,
    name: "Raspberrypi",
    popped: true
  }
};

The ui-worldmap will render the current location.
this will be on local server, in the next one we will configure the client too.