IoT GPS Location Tracker:
IoT-based GPS Location tracker using NEO-6M GPS Module. This Location Tracker Board consists of a NodeMCU, OLED Display Module, NEO-6M GPS Module, and 3.7 to 6V booster circuit.

Components Required:
1. NodeMCU ESP8266
2. NEO-6M GPS Module
3. OLED Display Module
4. FP6291 Boost Converter IC
5. 3× Resistor (10k, 100k, 48k)
6. 6× Capacitor (2×0.1µf, 1×10µf, 2×20µf)
7. 1× Inductor (4.7µH)
8. 1× Diode (1N5388BRLG)
9. 18650 Lithium Cell
10. 18650 Cell Holder
11. 6-Pin Push Button Switch

IoT Location Tracker Circuit Diagram:

The complete circuit diagram for NodeMCU GPS Tracker Board is shown below. This consists of a NodeMCU with NEO-6M GPS Module, OLED Display Module, and Booster circuit.

The booster circuit is designed around a dedicated FP6291 Boost Converter IC to boost the battery voltage from 3.7v to 6V.

This location tracking board can be used to track Cars/Bikes/almost anything.

FP6291 IC is a 1 MHz DC-DC Step-Up Booster IC, mainly used in the application, for example, getting stable 5V from 3V battery.

You only need few extra components to design a booster circuit with this IC. Here, in this circuit, the Boost Converter circuit gets the input supply through battery terminals (+ and -).

This input voltage is then processed by FP6291 IC to give a stable 6V DC supply to the VIN pin of NodeMCU.

Programming NodeMCU for Getting GPS Data:
The complete program can be found at the end of the page, the explanation of the same is as follows.

Make sure you have installed the libraries for the GPS module and OLED display before iot code

Begin the program by adding the required libraries. Here, the Adafruit_SSD1306.h library is used for OLED display, and the TinyGPS++ and SoftwareSerial library is used for GPS communication.

#include <TinyGPS++.h>
#include 
#include 
#include 
#include 
#include 
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
TinyGPSPlus gps;  // The TinyGPS++ object
SoftwareSerial ss(2, 0); // The serial connection to the GPS device
const char* ssid = "Galaxy-M20";
const char* password = "ac312124";
float latitude , longitude;
int year , month , date, hour , minute , second;
String date_str , time_str , lat_str , lng_str;
int pm;
//int numreadings = 10;
String latarray[20];
String lngarray[20];
//String current_latarray[10], current_lngarray[10], previous_latarray[10], previous_lngarray[10] ;
unsigned int i = 0;
const unsigned long Interval = 13000;
unsigned long previousTime = 0;
WiFiServer server(80);
void setup()
{
  Serial.begin(115200);
  ss.begin(9600);
  delay(2000); // Pause for 2 seconds
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  server.begin();
  Serial.println("Server started");
  // Print the IP address
  Serial.println(WiFi.localIP());
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }
}
void loop()
{
  unsigned long currentTime = millis();
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
    { 
     if (currentTime - previousTime >= Interval) { 
      if (gps.location.isValid())
      {
        //Serial.print("Getting Data");
        latitude = gps.location.lat();
        lat_str = String(latitude , 6);
        longitude = gps.location.lng();
        lng_str = String(longitude , 6);
        latarray[i] = lat_str;
        lngarray[i]= lng_str;
        i++;
        Serial.print(i);
        if (i>=20)
       // {
          i=0; //reset to beginning of array, so you don't try to save readings outside of the bounds of the array
        // } 
        Serial.println("Latitude:");
        Serial.println(latarray[i]);
        Serial.println("Longitude:");
        Serial.println(lngarray[i]);
        Serial.println();
        display.setCursor(0, 20);
        display.println("Lat:");
        display.setCursor(27, 20);
        display.println(lat_str);
        display.setCursor(0, 40);
        display.println("Lng:");
        display.setCursor(27, 40);
        display.println(lng_str);
        display.display(); 
        }
        previousTime = currentTime;
       }       
      //}
      if (gps.date.isValid())
      {
        //Serial.print("Getting Time");
        date_str = "";
        date = gps.date.day();
        month = gps.date.month();
        year = gps.date.year();
        if (date < 10)
          date_str = '0';
        date_str += String(date);
        date_str += " / ";
        if (month < 10)
          date_str += '0';
        date_str += String(month);
        date_str += " / ";
        if (year < 10) date_str += '0'; date_str += String(year); } if (gps.time.isValid()) { time_str = ""; hour = gps.time.hour(); minute = gps.time.minute(); second = gps.time.second(); minute = (minute + 30); if (minute > 59)
        {
          minute = minute - 60;
          hour = hour + 1;
        }
        hour = (hour + 5) ;
        if (hour > 23)
          hour = hour - 24;
        if (hour >= 12)
          pm = 1;
        else
          pm = 0;
        hour = hour % 12;
        if (hour < 10)
          time_str = '0';
        time_str += String(hour);
        time_str += " : ";
        if (minute < 10)
          time_str += '0';
        time_str += String(minute);
        time_str += " : ";
        if (second < 10)
          time_str += '0';
        time_str += String(second);
        if (pm == 1)
          time_str += " PM ";
        else
          time_str += " AM ";
      }
    }
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client)
  {
    return;
  }
  // Prepare the response
  String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n 


 

Locatoin Tracking with NodeMCU

“;
s += ”

Location Details

";
  s += "
Latitude “;
s += lat_str;
s += “
Longitude “;
s += lng_str;
s += “
Date “;
s += date_str;
s += “
Time “;
s += time_str;
s += “

“;
if (gps.location.isValid())
{
// s += ”

 

About the Author

Subramanian

Hello! My Dear Friends. I am Subramanian. I am writing posts on androiderode about Electronics testing and equipments.

View All Articles