How to send GPS location to Adafruit IO using NodeMCU/ESP8266

Introduction

In this tutorial, you will learn how to integrate NodeMCU with the DHT11 sensor and fetch the sensor data, and send the data to the Adafruit IO IoT platform. In this way, you can also monitor the sensor data.

This is our first tutorial on the Adafruit IO an IoT platform. So, you will learn from the basics of the platform which includes how to create a free account, then creating the feed, and then create the dashboards which are your sensor data monitoring platform. And again on the hardware side, you will learn how to install libraries like Adafruit MQTT Library, and DHT11 sensor Library by Adafruit. If you want to add an OLED display you can follow any OLED display tutorial on our blog website and copy and paste the code into this project.

About Adafruit IO


Adafruit IO is an IOT platform that supports MQTT data protocol which is the faster way of data communication with the cloud-based system from HTTPS data protocol. MQTT is supported by a wide range of platforms and devices, including embedded systems, smartphones, and cloud platforms. It is widely used in IoT applications, such as home automation, industrial monitoring, and smart cities. The popularity of MQTT can be attributed to its lightweight nature, flexibility, and scalability, which make it ideal for use in a wide range of IoT scenarios. MQTT supports three levels of QoS (Quality of Services) which determines the data delivery rate.

Adafruit gives an easy build area as a dashboard which is used to display the sensor data and many more. Adafruit has a wide range of displays which are known as Blocks that can be used to display a wide range of data, it has also blocks that can be used to control IoT devices.

In this tutorial, a NodeMCU is connected to a NEO 6M GPS module to get the location data, and using wifi connectivity the data is sent to the Adafruit IO platform. You can check the location data on the dashboard that you have created for the data display.

Hardware Requirements

Disclaimer: It may contains Amazon affiliate links. which means I can get a small commission on the sale. This might be your indirect help to me. Thank You 🙏
  • NodeMCU  (HERE)
  • NEO 6M GPS Module (HERE)
  • Connecting Wires (HERE)
  • Breadboard (HERE)

Software Requirements

  • Arduino IDE (You can download it from HERE)
  • Install all libraries carefully (Follow the youtube tutorial HERE)
  • Adafruit IO account

How to create an Adafruit IO account

To create an account go to the official website of Adafruit IO. You can also follow our youtube tutorial to learn or you can follow this article as shown below.

Go to the Adafruit IO website and click on Get Started for Free at the top right corner.

Myengineeringstuffs get started with Adafruit IO

Now in order to create and free account you need to enter the required details. After entering the details click on CREATE ACCOUNT to create your account.

After clicking on Create Account an account your free account will be created. Now just sign in to your account and click on IO at the top of the page to create a dashboard and feed to display the location data.

Now click on Feeds to create a Feed. Feed is nothing but a variable name that you will subscribe to this feed and can read/write data to it. So, to create a feed click on Feeds at the top and then click on Create the feed. A popup window will open you need to provide the name and a description to the feed and then click on Create.

Myengineeringstuffs create feed on Adafruit IO

Now to create Dashboard, click on the Dashboards tab at the top of the page. Again just like the feed you need to click Create Dashboard and a popup window will open where you need to provide the details of the dashboard like name and description.

Mengineeringstuffs create dashboard Adafruit IO

Now after creating a feed as GPSLocation and dashboard as GPS Location Display you need to connect the feed to the dashboard. So, that you can see the data on the dashboard.

So, to connect the feed with the dashboard you need to create a Block in the dashboard. Now open the dashboard by clicking the dashboard just now you have created as GPS Location Display on the dashboards page. Now click on the setting icon in the left side corner of the page.

Now you can see that you have different blocks. You use it as per your requirement, but here I am using GPS so, I will choose Map Block to display the location.

After clicking on the Map block you will get a popup window to set up the Feed or you need to connect with the feed you have created. Our feed name is GPSLocation so we will connect with it.

Then click on the Next step to set up the layout of the block. Here just give a name to your layout and set up the Light and Dark modes of Map visual.

After clicking on Create block you will be redirected to the dashboard with the map visual.

Now if you want to resize the map you can click on the setting icon and then click Edit Layout. Now you can resize the layout by just clicking and holding the one side map and dragging the map to resize and clicking Save Layout to save it.

Circuit Diagram

NodeMCU GPS Tracker

Circuit Explanation

According to the above circuit diagram, the major components of the circuit are:

  • NodeMCU
  • NEO GPS

The NodeMCU board is connected to the GPS module as per the table below. Rx and Tx connections are the most important part of the circuit. Should be connected in a proper manner to transmit and receive data.

NEO 6M GPSNodeMCU
Rx and TxD7 (Tx) and D6 (Rx) respectively
Vcc3.3v
GNDGND

Power Supply

The power supply is given by the USB cable itself from the laptop. But, you can create a 5v external power supply and connect it to Vin and GND of NodeMCU board.

NodeMCU and GPS setup

myengineeringstuffs NodeMCU GPS Location Tracker

Video Tutorial

Download Source Code

Download the complete source code: click here

Leave a Comment