Nodemcu GPS Tracker using Arduino Nodemcu esp8266 and Blynk
Table of Contents
Nodemcu GPS Tracker Project Description:
Nodemcu GPS Tracker– This tutorial is based on the Real-Time GPS tracking system using Arduino, Neo 6M GPS module, Nodemcu ESP8266 wifi module, and Blynk Application. With the help of this project, the GPS module can be tracked in real-time, which means you can track almost anything you want. This is the 2nd version of the GPS tracking system.
While in the 1st version I designed a GPS tracking system for the car accident location tracking, in which I used the GSM module. This was not a real-time tracking system, this system was designed to send a message only if the car had an accident. In this project, the limit switch was used for sensing the accident. If you want to watch this tutorial.
Note: this old version of the Blynk app is no more functional. For the blynk mobile App setup and Blynk.cloud dashboard setup ready my article on the New Blynk V2.0. In this article I have explained how to migrate your projects from Blynk 1.0 to the new Blynk V2.0. You can also watch the video.
Amazon Links:
Other Tools and Components:
Super Starter kit for Beginners
PCB small portable drill machines
*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!
Before I explain the circuit diagram and programming, first of all, I want to share with you some very useful information regarding the Arduino IDE version and Nodemcu board installation. First of all, make sure that you download the latest version of the Arduino IDE which IS 1.8.8 because the map widget needs the latest version. The next step is to click on the file
Then click on the preferences and make your check the compilation and upload boxes.
then simply paste this http://Arduino.esp8266.com/versions/2.4.2/package_esp8266com_index.json
link and click ok.
Now click on the tools menu goto boards, simply click on the boards manager and wait for a while to update. then search for the esp8266 and install…and install the latest version which is 2.4.2…. For the complete step by step board installation watch video Tutorial.
Now let’s discuss the circuit diagram.
Nodemcu GPS Tracker Circuit Diagram:
Nodemcu GPS Tracker
This schematic is designed in cadsoft eagle 9.1.0 version. If you want to learn how to make schematics and PCB’s then watched my tutorial.
The Nodemcu module tx and Rx pins are connected with pin7 and pin8 of the Arduino. While the Vin pin of the Nodemcu module is connected with the output of the voltage regulator. This is a regulated 5v power supply based on the lm7805 voltage regulator. Two 470uf capacitors are connected at the input and output side of the regulator. A 330-ohm resistor is connected in series with a 2.5v led. This is a current limiting resistor. While J1 is the dc female socket, over here you can connect a 12v adaptor or battery. But you can also power up the Nodemcu module using your laptop USB port. But in my case, I am going to use a 12v adaptor.
The VCC pin of the neo 6m GPS module is connected with 3.3v and its ground is connected with the Arduino’s ground. The Tx and Rx pins of the GPS module are connected with pin number 2 and pin number 3 of the Arduino.
Blynk application designing for Real-time GPS Tracking:
Nodemcu GPS Tracker
For the Step by Step Blynk application designing watch Video Tutorial “Click Here”
Nodemcu GPS Tracker Programming:
In this project, two programs are used, one program is written for the Arduino Board while the other program is written for the Nodemcu ESP8266 Wifi Module.
For the step by step program explanation watch Video Tutorial given at the end of this article.
Arduino GPS Programming:
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
#include <SoftwareSerial.h> #include <TinyGPS++.h> #include <stdlib.h> static const int RXPin = 2, TXPin = 3; static const uint32_t GPSBaud = 9600; // some strings String myindex = "1"; // this number is incremented as we increase the number of GPS modules. // let's say if you are using 2 GPS modules, then we will use the same programming but will change the index number to 1, for third nodemcu module we change it to 2 and so on. String mylong = ""; // for storing the longittude value String mylati = ""; // for storing the latitude value String myvalue = "abc"; char buff[10]; // The TinyGPS++ object TinyGPSPlus gps; // The serial connection to the GPS device SoftwareSerial ss(RXPin, TXPin); // for gps SoftwareSerial nodemcu(7, 8); // for gsm module int led = 13; // tilt sensor output indication String textForSMS; int limits = 4; // limit switch double longitude; double latitude; void setup() { nodemcu.begin(9600); ss.begin(GPSBaud); Serial.begin(9600); Serial.println(" logging time completed!"); randomSeed(analogRead(0)); pinMode(limits, INPUT); digitalWrite(limits, HIGH); Serial.println(F("DeviceExample.ino")); Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module")); Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion()); Serial.println(); } void loop() { // This sketch displays information every time a new sentence is correctly encoded. while (ss.available() > 0) if (gps.encode(ss.read())) displayInfo(); if (millis() > 5000 && gps.charsProcessed() < 10) { Serial.println(F("No GPS detected: check wiring.")); while(true); } // for the button //***************************************************************** //**************************************************************** if(digitalRead(limits) == HIGH) { displayInfo(); latitude = gps.location.lat(), 6 ; longitude = gps.location.lng(), 6 ; // for latitude mylati = dtostrf(latitude, 3, 6, buff); mylong = dtostrf(longitude, 3, 6, buff); textForSMS = textForSMS + myindex + "," + mylati + "," + mylong + "," + myvalue +","; // textForSMS = textForSMS + myindex + "," + "34.014623" + "," + "72.164979" + "," + myvalue +","; Serial.println(textForSMS); nodemcu.println(textForSMS); textForSMS = ""; delay(1000); } else digitalWrite(limits, HIGH); digitalWrite(led, LOW); } void displayInfo() { Serial.print(F("Location: ")); if (gps.location.isValid()) { Serial.print(gps.location.lat(), 6); Serial.print(F(",")); Serial.print(gps.location.lng(), 6); Serial.print(" "); Serial.print(F("Speed:")); Serial.print(gps.speed.kmph()); } else { Serial.print(F("INVALID")); } Serial.print(F(" Date/Time: ")); if (gps.date.isValid()) { Serial.print(gps.date.month()); Serial.print(F("/")); Serial.print(gps.date.day()); Serial.print(F("/")); Serial.print(gps.date.year()); } else { Serial.print(F("INVALID")); } Serial.print(F(" ")); if (gps.time.isValid()) { if (gps.time.hour() < 10) Serial.print(F("0")); Serial.print(gps.time.hour()); Serial.print(F(":")); if (gps.time.minute() < 10) Serial.print(F("0")); Serial.print(gps.time.minute()); Serial.print(F(":")); if (gps.time.second() < 10) Serial.print(F("0")); Serial.print(gps.time.second()); Serial.print(F(".")); if (gps.time.centisecond() < 10) Serial.print(F("0")); Serial.print(gps.time.centisecond()); } else { Serial.print(F("INVALID")); } Serial.println(); } |
Nodemcu esp8266 wifi module Programming:
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
// make sure to use the latest version 1.8.8 of Arduino ide #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include <SoftwareSerial.h> #include <SimpleTimer.h> WidgetMap myMap(V0); char auth[] = "5b282ebfba3140fcb794199f760f5b8a"; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "ZONG MBB-E8231-6E63"; char pass[] = "08659650"; SimpleTimer timer; String myString; // complete message from Arduino, which consists of snesors data char rdata; // received characters String gpsdata = ""; int myindex; float mylat; float mylon; String myvalue; double fahad; int firstVal, secondVal, thirdVal; // sensors // This function sends Arduino's up time every second to Virtual Pin (1). // In the app, Widget's reading frequency should be set to PUSH. This means // that you define how often to send data to Blynk App. void myTimerEvent() { // You can send any value at any time. // Please don't send more that 10 values per second. Blynk.virtualWrite(V1, millis() / 1000); } void setup() { // Debug console Serial.begin(9600); Blynk.begin(auth, ssid, pass); timer.setInterval(1000L, sensorvalue1); } void loop() { if (Serial.available() == 0 ) { Blynk.run(); timer.run(); // Initiates BlynkTimer } if (Serial.available() > 0 ) { rdata = Serial.read(); myString = myString + rdata; // Serial.print(rdata); if ( rdata == '\n') { gpsdata = myString; String k = getValue(myString, ',', 0); // index String m = getValue(myString, ',', 1); // lati String n = getValue(myString, ',', 2); // longi String o = getValue(myString, ',', 3); // Value myindex = k.toInt(); mylat = m.toFloat(); mylon = n.toFloat(); myvalue = o; Serial.println(myindex); Serial.println(mylat,5); Serial.println(mylon,5); Serial.println(myvalue); myString = ""; // end new code } } } void sensorvalue1() { // You can send any value at any time. // Please don't send more that 10 values per second. // Blynk.virtualWrite(V2, gpsdata); myMap.location( myindex, mylat, mylon, myvalue); } String getValue(String data, char separator, int index) { int found = 0; int strIndex[] = { 0, -1 }; int maxIndex = data.length() - 1; for (int i = 0; i <= maxIndex && found <= index; i++) { if (data.charAt(i) == separator || i == maxIndex) { found++; strIndex[0] = strIndex[1] + 1; strIndex[1] = (i == maxIndex) ? i + 1 : i; } } return found > index ? data.substring(strIndex[0], strIndex[1]) : ""; } |
Watch Video Tutorial:
Arduino Project: GPS Tracker using Nodemcu esp8266 and Blynk application “Real-time tracking map”
Other GPS Related Projects:
https://www.electroniclinic.com/arduino-neo-6m-gps-module-interfacing-programming-library/
https://www.electroniclinic.com/car-accident-location-tracking-using-gsm-gps-and-arduino/
hello sir, kindly I’m following your procedure of this project but I got problem with SimpleTimer, would you help me sir?
check my article on Arduino libraries. Download the simpletimer library from there.
can i interface gsm also with arduino