Overview
This post is about IoT Based Real Time GPS Tracker using NodeMCU ESP8266 & Blynk with Google Maps. Earlier we made GSM+GPS Based Location Tracker for tracking Vehicle Location. Instead of GSM Module, we will use ESP8266 WiFi Module to track location.
A GPS tracker is a navigation device generally on a vehicle, asset, person, or animal that uses the Global Positioning System (GPS) to determine its movement and geographic position. GPS tracking devices send special satellite signals that are processed by a receiver. Locations are stored in the tracking unit or transmitted to an Internet-connected device using the cellular network or WiFi worldwide. GPS trackers connect to a series of satellites to determine location. The tracker uses a process called trilateration which uses the position of three or more satellites from the Global Navigation Satellite System (GNSS) network and their distance from them to determine latitude, longitude, elevation, and time.
In this project, we will use Quectel L86 GPS Module and interface it with NodeMCU ESP8266 Board. Instead of Quectel L86 GPS Module, you can also use Neo-6M GPS Module or any other similar GPS Module. Using the TinyGPS library, we will determine the latitude, longitude, speed, bearing as well as the location on Map. We will send all these parameters to the Blynk Application and monitor the real-time data along with the map on Blynk Dashboard.
You may refer to some previous GPS Tracker-based projects:
- ESP32 GPS Tracker using L86 GPS Module & OLED Display
- GPS Tracker using A9G GPRS/GPS Module & Arduino
- GPS+GSM Based Vehicle Tracking System using Arduino
- LoRa Based Low Power GPS Tracker with Arduino & ESP8266
Bill of Materials
We need following components for making ESP8266 Based Real Time GPS Tracker System. You can purchase all these components online from Amazon.
| S.No. | Components | Quantity | Purchase Links |
|---|---|---|---|
| 1 | NodeMCU ESP8266 WiFi Module | 1 | Amazon | AliExpress |
| 2 | Quectel L86/L80 GPS | 1 | Amazon | AliExpress |
| 3 | Jumper Wires | 10 | Amazon | AliExpress |
| 4 | Bread board | 1 | Amazon | AliExpress |
Quectel L86/L80 GPS Module
The L86 is an ideal solution for wearable fitness devices due to its ultra-compact design and low power demands. Its Low Power feature enables GPS connectivity at around half the power consumption of normal mode while in static receiving mode. Combined with its precision and high sensitivity, this makes the L86 suitable also for a broad range of IoT applications such as portable devices, automotive, personal tracking, security, and industrial PDAs.
The L86 has a patch antenna on top measuring 16.0mm × 16.0mm × 6.45mm, with 66 acquisition channels and 22 tracking channels. It acquires and tracks satellites in the shortest time even at the indoor signal level. The module operates at 2.8V~4.3V with a typical power consumption of 20mA and in Standby mode power consumption is around 1.0mA. To learn more about the L86 GPS module, you can check the L86 Datasheet.
The Quectel L86/L80 GPS Module has 12 pins as shown in the image below.
The L86 is a tiny SMD-type Module that doesn’t have any male/female header pins for testing. So you can use the male header pin with 2.54 spacing and solder them on the L86 PCB from the bottom.
Once, you solder all the 12 Pins on the L86 Module, the Module becomes breadboard friendly. You can now insert the module on the breadboard easily.
Circuit for GPS Tracker using ESP8266
Now let us move to the project part & make Real Time GPS Tracker using ESP8266 & Blynk. The connection diagram is fairly simple.
Connect the VCC/GND of the L86 GPS Module to 3.3V/GND of NodeMCU ESP8266. Do not supply more than 3.3V. Similarly, connect the VCC backup (V_BCKP) with VCC or to an external battery. It won’t work if this pin is not powered.
Connect the RX/TX of L86 to the D1/D2 of the NodeMCU. This is for Serial Communication using Software Serial.
You can use a jumper wire to connect directly or use a breadboard to assemble the circuit. Hence the hardware for GPS Tracker using ESP8266 is ready.
Project PCB Gerber File & PCB Ordering Online
If you don’t want to assemble the circuit on a breadboard and you want PCB for the project, then here is the PCB for you. The PCB Board for ESP8266 is designed using EasyEDA online Circuit Schematics & PCB designing tool. First the schematic is designed and then the schematic is converted into PCB.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from ALLPCB at 1$ only.
You can use this Gerber file to order high quality PCB for this project. To do that visit the ALLPCB official website by clicking here: https://www.allpcb.com/.
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
Setting Up Blynk Application
For monitoring GPS Location & its all values we will use the Blynk Application. Blynk Application also has access to Google Maps.
Blynk is a new platform that allows you to quickly build interfaces for controlling and monitoring your hardware projects from your iOS and Android device. After downloading the Blynk app, you can create a project dashboard and arrange buttons, sliders, graphs, and other widgets onto the screen.
Go to your Android Playstore and Download the Blynk App.
Sign up using an Email ID & Password or if you are new, create an Account.
Then create a New Project by selecting ESP8266 & connection as WiFi. Hence a project will be created and an Authentication Token will be sent to your mail.
Copy this Authentication Token as it will be required in the Arduino Code. Without this token, the ESP8266 can’t establish a connection with Blynk.
Now you need to create a widget for 6 different parameters.
Latitude – Value Display – Virtual Pin V1
Longitude – Value Display – Virtual Pin V2
Satellite – Value Display – Virtual Pin V3
Speed – Value Display – Virtual Pin V4
Bearing – Value Display – Virtual Pin V5
Map – Map – Virtual Pin V0
Once all widgets are created and values are assigned, the dashboard will look something like this.
Now the setup for ESP8266 Based GPS Tracker with Blynk is completed. So you are ready to go.
Source Code/Program for ESP8266 Based GPS Tracker
The code for GPS Tracking System is is written in Arduino IDE. The code is written by combining TinyGPS Library example and Blynk example code.
We need following two libraries for the code compilation. You can download these libraries and add it to the Arduino Library Folder.
1. TinyGPS++ Library: https://github.com/mikalhart/TinyGPSPlus
2. Blynk ESP8266 Library: https://github.com/blynkkk/blynk-library
You need to modify a few lines in this code. Enter the WiFi SSID, Password & Blynk Authentication Code.
|
1 2 3 |
char auth[] = "************************"; //Blynk Authentication Token char ssid[] = "************************"; // WiFi SSID char pass[] = "************************"; // WiFi Password |
Here is the complete code for Real Time GPS Tracker using ESP8266 & Blynk with Maps. Copy the code and upload it to the NodeMCU ESP8266 Board.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
#include <TinyGPS++.h> #include <SoftwareSerial.h> #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> static const int RXPin = 4, TXPin = 5; // GPIO 4=D2(conneect Tx of GPS) and GPIO 5=D1(Connect Rx of GPS static const uint32_t GPSBaud = 9600; //if Baud rate 9600 didn't work in your case then use 4800 TinyGPSPlus gps; // The TinyGPS++ object WidgetMap myMap(V0); // V0 for virtual pin of Map Widget SoftwareSerial mygps(RXPin, TXPin); // The serial connection to the GPS device BlynkTimer timer; float latitude; //Storing the Latitude float longitude; //Storing the Longitude float velocity; //Variable to store the velocity float sats; //Variable to store no. of satellites response String bearing; //Variable to store orientation or direction of GPS char auth[] = "********************"; //Blynk Authentication Token char ssid[] = "********************"; // WiFi SSID char pass[] = "********************"; // WiFi Password //unsigned int move_index; // moving index, to be used later unsigned int move_index = 1; // fixed location for now void setup() { Serial.begin(115200); Serial.println(); mygps.begin(GPSBaud); Blynk.begin(auth, ssid, pass); timer.setInterval(5000L, checkGPS); // every 5s check if GPS is connected, only really needs to be done once } void checkGPS() { if (gps.charsProcessed() < 10) { Serial.println(F("No GPS detected: check wiring.")); Blynk.virtualWrite(V3, "GPS ERROR"); // Value Display widget on V3 if GPS not detected } } void loop() { while (mygps.available() > 0) { // sketch displays information every time a new sentence is correctly encoded. if (gps.encode(mygps.read())) displayInfo(); } Blynk.run(); timer.run(); } void displayInfo() { if (gps.location.isValid() ) { sats = gps.satellites.value(); //get number of satellites latitude = (gps.location.lat()); //Storing the Lat. and Lon. longitude = (gps.location.lng()); velocity = gps.speed.kmph(); //get velocity bearing = TinyGPSPlus::cardinal(gps.course.value()); // get the direction Serial.print("SATS: "); Serial.println(sats); // float to x decimal places Serial.print("LATITUDE: "); Serial.println(latitude, 6); // float to x decimal places Serial.print("LONGITUDE: "); Serial.println(longitude, 6); Serial.print("SPEED: "); Serial.print(velocity); Serial.println("kmph"); Serial.print("DIRECTION: "); Serial.println(bearing); Blynk.virtualWrite(V1, String(latitude, 6)); Blynk.virtualWrite(V2, String(longitude, 6)); Blynk.virtualWrite(V3, sats); Blynk.virtualWrite(V4, velocity); Blynk.virtualWrite(V5, bearing); myMap.location(move_index, latitude, longitude, "GPS_Location"); } Serial.println(); } |
Testing Real Time GPS Tracker
After uploading the code, open Serial Monitor. The ESP8266 will try connecting to the WiFi Network. Once it connect to the WiFi Network, the GPS Module will start scanning the nearest Satellite. It might take time to retrieve location based on your indoor outdoor condition.
Once it retrieves satellite data, it will display the latitude, longitude, speed, bearing and no of satellite it is connected to.
Now you can open your Blynk App and click on the play button at the top right corner.
The Blynk App will immediately start showing all the above-mentioned data along with Google Maps location.
You can now take this GPS device and put it on your Vehicle or any asset to track the location in real-time. The tracker should always be connected to the WiFi Network.


















1 Comment
there is no cellural netowrk here, only wifi. 1/5 tutorial