Skip to main content

How To Make A Real Time GPS Location Tracker Using NodeMcu ?

Hello Guys , Welcome Back To Another Post From Microelectronics , In This Post We Will Learn That How To Make A Real Time GPS Location Tracker Using NodeMcu Module. For Further Details You Can Aks Your Question In Message Bar.


Material Required -

Nodemcu ESP8266
Ublox NEO 6M GPS
Jumpers

Connections:- 
VCC  -  3.3V
GND  -  GND
RX  -  D1
TX  -  D2

Code -
#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[] = "--------------------";              //Your Project authentication key
char ssid[] = "-------";                                       // Name of your network (HotSpot or Router name)
char pass[] = "-------";                                      // 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();
}

Comments

Popular posts from this blog

How To Make Pac- Man Game Using Arduino

Hello Guys , In This Post We Will Tell You How To Make A Arduino Based Pac- Man Game. For More Awesome Arduino Projects Subscribe Our Blog. #Microelectronics Components Required- 1-Arduino Uno / Nano  2-Display Module  3- Joystick Module  4- Jumper Wire   Circuit Diagram Is Given Below- Source Code- //Nokia 5110 LCD PacMan Game #include <LCD5110_Graph.h> #include <avr/pgmspace.h> #define RST 12    // RESET #define CE  13    // CS #define DC  11    // Data/Command #define DIN  10   // MOSI #define CLK  9    // SCK LCD5110 myGLCD(CLK, DIN, DC, RST, CE); // LCD5110(SCK, MOSI, DC, RST, CS); extern uint8_t SmallFont[]; const uint8_t pacman1[] PROGMEM={ 0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3E, 0x1C,   // 0x0010 (16) pixels 0x0C, 0x00, 0x00, 0x00, 0x1F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, ...

How to use ADXL345 accelerometer with raspberry pi

 Hey,  Today's blog we are going to use ADXL345   Accelerometer with raspberry pi. WHAT YOU NEED : Raspberry pi 3 SD card (8gb+ recommend) Power supply ADXL345 accelerometer  Breadboard CIRCUIT :  PREPARING RASPBERRY PI : 1.  Before we can get our Raspberry Pi to retrieve data from our ADXL345 Accelerometer, there are a few changes we must make to the Pi’s configuration. Let’s first ensure that everything is up to date by running the following two commands. sudo apt-get update sudo apt-get upgrade 2.  Once the Raspberry Pi has finished updating, we will need to go ahead and launch the Raspberry configuration tool so that we can  enable I2C  on the Raspberry Pi. Run the following command to launch the  raspi configuration tool . sudo raspi-config 3.  On this screen, you need to head to the “ 5 Interfacing Options ” menu. You can navigate the  raspi-config  tools menus by using the  arrow keys . Use the  ENTER...

How To Make Led Memory Game Using Arduino ?

Hello Guys , In This Post We Are Going To Tell You That How You Can Make Your Led Memory Game Using Arduino. Code And Circuit Diagram Is Given In Post. Please Subscribe Our Blog. An Arduino Based Led Memory Game.  Source Code -  /* Start the game by pressing one of the four buttons. When a button lights up,   press the button, repeating the sequence. The sequence will get longer and longer. The game is won after   13 rounds.  Generates random sequence, plays music, and displays button lights.  Simon tones from Wikipedia  - A (red, upper left) - 440Hz - 2.272ms - 1.136ms pulse  - a (green, upper right, an octave higher than A) - 880Hz - 1.136ms,  0.568ms pulse  - D (blue, lower left, a perfect fourth higher than the upper left)   587.33Hz - 1.702ms - 0.851ms pulse  - G (yellow, lower right, a perfect fourth higher than the lower left) -   784Hz - 1.276ms - 0.638ms pulse  Simo...