18. GPS Tracker Using Blynk App

Overview of NEO6M GPS Module

This module is one of popular GPS modules on the market and is also cheap to buy. The location data provided by it is accurate enough to satisfy most applications. And for it to be included in smart phones and tablets design points out its efficiency. This module is famous among hobbyist and engineers altogether who want to work on applications involving navigation.
The NEO-6MV2 is a GPS (Global Positioning System) module and is used for navigation. The module simply checks its location on earth and provides output data which is longitude and latitude of its position. It is from a family of stand-alone GPS receivers featuring the high-performance u-blox 6 positioning engine. These flexible and cost-effective receivers offer numerous connectivity options in a miniature (16 x 2.4 mm) package. The compact architecture, power and memory options make NEO-6 modules ideal for battery operated mobile devices with very strict cost and space constraints. Its Innovative design gives NEO-6MV2 excellent navigation performance even in the most challenging environments.

Features and Electrical Characteristics


  • Standalone GPS receiver.
  • Anti-jamming technology.
  • UART Interface at the output pins (Can use SPI, I2C and USB by soldering pins to the chip core)
  • Under 1 second time-to-first-fix for hot and aided starts.
  • Receiver type: 50 Channels - GPS L1 frequency - SBAS (WAAS, EGNOS, MSAS, GAGAN)
  • Time-To-First-fix: For Cold Start 32s, For Warm Start 23s, For Hot Start <1s
  • Maximum navigation update rate: 5Hz
  • Default baud rate: 9600bps
  • EEPROM with battery backup
  • Sensitivity: -160dBm
  • Supply voltage: 3.6V
  • Maximum DC current at any output: 10mA
  • Operation limits: Gravity-4g, Altitude-50000m, Velocity-500m/s
  • Operating temperature range: -40ºC TO 85°C.

Connection of GPS:

Connect Rx pin of GPS is D1 pin of NodeMCU, Tx pin of GPS is D2 Pin of NodeMCU and also connect Ground and VCC pin to Ground Pin and 3V3 pins of NodeMCU as shown in figure.

Program

#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 ss(RXPin, TXPin);  // The serial connection to the GPS device 
BlynkTimer timer; 
float spd;       //Variable  to store the speed 
float sats;      //Variable to store no. of satellites response 
String bearing;  //Variable to store orientation or direction of GPS 

 
char auth[] = "gdr95326oCJMMRFnzByp86OEv4mpZIKq";              //Your Project authentication key 
char ssid[] = "WI-FI CAMPUS";                                       // Name of your network (HotSpot or Router name) 
char pass[] = "kuchbhi@123";                                      // Corresponding 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(); 
  ss.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(V4, "GPS ERROR");  // Value Display widget  on V4 if GPS not detected 
  } 
 
void loop() 
    while (ss.available() > 0)  
    { 
      // sketch displays information every time a new sentence is correctly encoded. 

 
      if (gps.encode(ss.read())) 
        displayInfo(); 
  } 
  Blynk.run(); 
  timer.run(); 
 
void displayInfo() 
{  
  if (gps.location.isValid() )  
  { 
    float latitude = (gps.location.lat());     //Storing the Lat. and Lon.  
    float longitude = (gps.location.lng());  
    Serial.print("LAT:  "); 
    Serial.println(latitude, 6);  // float to x decimal places 
    Serial.print("LONG: "); 
    Serial.println(longitude, 6); 
    Blynk.virtualWrite(V1, String(latitude, 6));    
    Blynk.virtualWrite(V2, String(longitude, 6));   
    myMap.location(move_index, latitude, longitude, "GPS_Location"); 
    spd = gps.speed.kmph();               //get speed 
       Blynk.virtualWrite(V3, spd); 
       sats = gps.satellites.value();    //get number of satellites 
       Blynk.virtualWrite(V4, sats); 
       bearing = TinyGPSPlus::cardinal(gps.course.value()); // get the direction 
       Blynk.virtualWrite(V5, bearing);                
  } 
  Serial.println(); 
 

Method To connect Blynk App

Step1: Go-to play store in your mobile phone and download Blynk App and open app and make account in Blynk App as shown in Figure.


Step2: Now click on new project and enter project name, Choose Device and Connection type as shown in figure and then click on Create.


Step3: When you click on create Now you get authorization key and press Ok then; your Authorization key directly Send to your registered email id.


Step4: Now Click on +icon to open widget box and choose labeled value as shown in figure.


Step5: After choosing Labeled value and click on labeled Icon and enter its name and Select pins according to figure.


Step6: Similarly, attach another labeled value and change its name and pins according to below image after adding labeled value you attach a map to get location of GPS tracker.


Step7: Now We attach a map. So, click on +icon and Choose map and click on Amp icon and change connection pin according to below figure.


Step8: after adding map we attach Three value Display. So, click on +icon and select value display. After selecting value display you change its name and connection pins according to below figures. similarly attach Two extra value display and change its name and connection pins as given in below images.


Step9: Now open Your email id where Authorization key will be sent by the Blynk App and copy the Authorization key and paste in the code. Also enter the ssid and Password of the WIFI in code and Upload the code in NodeMCU.


Step10: After uploading the code open Blynk app And Click on play icon then your Blynk app is connected to the NodeMCU and you get location of Your GPS according to below figures.


Note: when your code is not correct then you change GPS baud rate 9600 to 4800 and upload the code. In GPS location you get some error in Your location and Your GPS location but its error is very less. So, it is considerable.

Comments

  1. Great Info thanks for sharing such a informative series
    https://www.answers.com/u/johngomes

    ReplyDelete

Post a Comment

Popular posts from this blog

18. GPS Tracker Using Blynk App

6. Some IoT Platforms

16. Wi-Fi Button