Read GPS data from thingspeak and show it in the Google map using ESP12e Nodemcu and GPS Neo 6M Module

Programming ESP12E NodeMCU Module to upload GPS data on Thingspeak

Introduction

We will be programming ESP12E NodeMCU Module to upload GPS data on Thingspeak. In the previous tutorial we created a thingspeak channel and copy pasted credentials on a notepad file. We will now use these credentials which we got from our new created channel to upload the data onto them. In the first lesson  we setup the breadboard circuit ESP12E NodeMCU and connected it to Neo 6M GPS module. Now lets program and see the uploaded data on the thingspeak chart. Follow the below instructions step by step:

  1. You will need the "Tiny GPS Plus" library for this tutorial. Visit the following link and add it to the arduino library.

https://github.com/mikalhart/TinyGPSPlus

Download the zip and include it in the arduino library.

Programming-ESP12E-NodeMCU-Module-to-upload-GPS-data-on-Thingspeak

Programming-ESP12E-NodeMCU-Module-to-upload-GPS-data-on-Thingspeak

(If you don't know how to add new library to Arduino IDE then follow this tutorial : "Adding External Library in Arduino")

2. Now create a new sketch and copy and paste the following code:

 

3. Replace the following things with your own thingspeak credentials:
1. Your wifi username and password
2. Your "Thingspeak Write API Key"

Creating-Thingspeak-channel-for-storing-GPS-data-received-from-ESP12E-NodeMCU-Module (7)

Creating-Thingspeak-channel-for-storing-GPS-data-received-from-ESP12E-NodeMCU-Module (7)

4. Save the program and flash ESP12E NodeMCU Module with this program.

Now, wait till your Neo 6M GPS module's led has started blinking. It might take around 2-10 minutes but it will start blinking. Have patience. And then go check your thingspeak channel. If you have done everything right, then ESP12E NodeMCU will start updating the channel with a delay of 15 seconds. And you will get something like show in the below image:
(Hiding my data because I don't want anyone stalking around 😀 )

 

Creating-Thingspeak-channel-for-storing-GPS-data-received-from-ESP12E-NodeMCU-Module (6)

Creating-Thingspeak-channel-for-storing-GPS-data-received-from-ESP12E-NodeMCU-Module (6)

Hope you enjoyed the tutorial, In the next step, we will parse this thingspeak data and show it in a Google map with marker. Click on the below next chapter to go ahead.

Please login to get access to the quiz
Creating Thingspeak channel for storing GPS data received from ESP12E NodeMCU Module (Prev Lesson)
(Next Lesson) Showing Thingspeak GPS data in Google Maps using Javascript and HTML
Back to Read GPS data from thingspeak and show it in the Google map using ESP12e Nodemcu and GPS Neo 6M Module

Comments ( 48 )

  • Freddie Snijman

    Thank you so much, excellent! Working just fine.

    • I am glad that it worked for you. Please share this website with your friends. 🙂

    • Sindhu

      sir we are getting error in “# include

      • Please check the video again, and add the library properly in your Arduino IDE

  • Chalamba

    Can we use arduino and esp8266 instead of ESP12E NodeMCU

  • Sravya

    i have a dobt i love this project but i want to extended it more bcuz i want to do as my final year project can u suggest any possible way

    • I am glad that you liked project. Yes, you can make a GPS tracker and accident detection system. You can use accelerometer along with GPS. Whenever there is an accident you can send sms to emergency number using “Twilio” for sms.

      • Sravya

        no such directory or file it is showing… in arduino …
        #include “ThingSpeak.h”
        now what should we include to make it work m

        • Please install the library first. Read the tutorial carefully.

  • Sir can you please upload the code for sending GPS coordinates using esp8266 to ubidots (cloud)

  • Vince

    vivek,

    thanks for the project. the first iot gps tracking system that ive ever gotten to work! i even insrted an extra line into your code so that it would allow me to access the internet via an iphone hotspot:

    between

    “Serial.begin(115200);”

    and

    “ss.begin(GPSBaud);”

    insert this:

    “WiFi.mode(WIFI_STA);”

    anyway, i tried to register to your site, but i never received the verification email (checked my spam, junk, etc. and its not there either). thanks again for the awesome project.

    vince

    • Thanks Vince, I am glad that you liked it. You can register using your google + account.

  • Yogesh nikam

    Hello, this code worked for me for my college project but when i combine this code with my other sensor codes then it wont work i trying to combine it with Pulse sensor amped and DHT 11 temperature sensor both the sensor codes are working properely but GPS isnt working on COM port its showing 0 0 0 0 0 ANd invalid location date and time. Also with the google maps program the zooming function wont work and whenever it works it doesnt show thwe imagery when focused on a proper location

  • Kalyan

    Can we do it using esp8266 wifi module and Arduino Uno?

  • Darwish Emre

    Hello sir, why i cant compile that code.

    Error compiling for board for NodeMcu 1.0 (ESP 12E-Module)
    #include “ThingSpeak.h”

    compilation terminated.
    exit status 1
    Error compiling for board NodeMCU 1.0 (ESP-12E Module).

    Please help.

  • Gye beak jeon

    Thank you for your project. But I want the esp8266.h file. If you see this comment, please send esp8266.h file to rydus0604@naver.com.

  • Mathivanan

    i am not getting proper time . can you give a solution

    • What time are you getting? Can you paste it here?

  • Ashwin Duth

    I have a Mini project to do . So, can you please do it for me.
    Funding is not an issue .So please let me know whether you are intrested.
    Please contact to this number urgently,
    8106034410.

    funding will not be an issue, any price you ask….
    Require the project in 10 days ……

    • Hi Ashwin,
      Thanks for reaching out. I don’t do free lancing as of now but I can drop off mail to someone I know. Mail your requirements here : admin@iotmonk.com

  • Ashwin Duth

    What time are you getting?

      • Safeer Abbas

        sir please help me my gps is not blinking and dont send data on thinspeak

        • Its problem with your hardware. Check the power source and connection again.

  • Teddy

    Please help I get this on serial monitor
    INVALID Date/Time: 0/0/2000 00:00:00.00

    • Hi Teddy,
      Its problem with your GPS not programming. Sometimes GPS don’t work indoors or even outdoors at other locations. What I would recommend you is try to switch place probably at your friends place and see again the output.

  • Vamshi Karne

    data is not uploading in thingspeak.
    can u solve the problem

    • I can’t with only this information.

  • Safeer Abbas

    My gps is not blinking…..i wait for more then mint

    • don’t repost the same question. Be patient. I have already answered your question.

  • Safeer Abbas

    please help me my gps is not blinking and i dont recive any data on thingspeak

    • don’t repost the same question. Be patient. I have already answered your question.

  • DHIVYA DEVI J

    String latbuf;
    latbuf += (String(latitude, 6));

    Could you explain me what actually this line do?

    • += is an assignment operator.
      (latitude, 6) -> we are taking value of latitude till 6th places.
      (String(latitude, 6)) -> Converting the value to string.
      latbuf += -> Storing the parsed data in variable ‘latbuf’.

  • Shehu Bello

    Thanks for the project. I have been trying to flash my esp12e-nodemcu with the code, but all my effort ended in failure. I tried flashing it again without the TinyGPS++ library header file and it worked fine. Help me

    • Can you tell me what is the error and what have you did to solve it?

  • Calimiro

    What type of power source did you use ?
    You connected derectly to your laptop or you are using some type of battery ?

    • It is directly connected to my laptop. But it is USB 3 Port. If possible you can use a battery bank of 1A. GPS consumes a lot of current.

  • Sindhu

    Arduino: 1.8.6 (Windows 7), Board: “Arduino/Genuino Uno”

    GPS:3:24: error: ThingSpeak.h: No such file or directory

    Multiple libraries were found for “TinyGPS++.h”
    compilation terminated.

    Used: C:\Users\MCA\Documents\Arduino\libraries\TinyGPSPlus-master
    Not used: C:\Program Files (x86)\Arduino\libraries\TinyGPSPlus-master
    Not used: C:\Program Files (x86)\Arduino\libraries\TinyGPSPlus-master
    Not used: C:\Program Files (x86)\Arduino\libraries\TinyGPSPlus-master
    Not used: C:\Program Files (x86)\Arduino\libraries\TinyGPSPlus-master
    exit status 1
    ThingSpeak.h: No such file or directory

    Exception in thread “Thread-32” java.lang.NullPointerException
    at cc.arduino.contributions.libraries.LibrariesIndexer.rescanLibraries(LibrariesIndexer.java:140)
    at cc.arduino.contributions.libraries.LibrariesIndexer.setLibrariesFolders(LibrariesIndexer.java:109)
    at processing.app.BaseNoGui.onBoardOrPortChange(BaseNoGui.java:677)
    at processing.app.Base.onBoardOrPortChange(Base.java:1313)
    at processing.app.Editor$DefaultExportHandler.run(Editor.java:2060)
    at java.lang.Thread.run(Thread.java:748)

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    • Please check the video again, and add the library properly in your Arduino IDE.

Post a Reply