How to Connect the ESP8266 NodeMCU to the IoT Cloud




Introduction: How to Connect the ESP8266 NodeMCU to the IoT Cloud

About: IoT Maker, co-founder of

This instructable shows you a simple Internet of Things demo using the ESP8266 NodeMCU and an online IoT service called AskSensors. We demonstrate you how to quickly get data from the ESP8266 HTTPS client and plot it in graph into the AskSensors IoT Platform.

Step 1: Materials You Need

To follow along with this tutorial you will simply need:

    1. Computer running arduino software
    2. ESP8266 Node MCU
    3. USB micro cable to connect the node MCU to the computer.

      Step 2: Sign Up for AskSensors

      First, Create a new account at AskSensors. You will receive an email containing all the instructions you need follow to login (It is super easy).

      Follow this getting started guide which explains you how to create and set up a new Sensor so we will be able to write data to this sensor. Here are the main steps:

      1. Click on 'New Sensor' to create a communication channel with unique ID and Api Keys. Give a name and description to your sensor.
      2. Add a module for the data you will be plotting.
      3. Copy down the Api Key In value. We will use in the ESP8266 code later.

      Step 3: Write the Code

      Example sketch and ESP8266 WIFI libraries are available in github.
      The provided code is ready to use as is. It connects the ESP8266 to wireless network as HTTPS client, and then push data to AskSensors every 25 seconds . You need to fill the following:

      • Your WIFI SSID and password.
      • The Api Key In generated before by AskSensors.
      • If needed, the time period between two successive data updates (set to 25 second in this example).
      // Wifi config
      const char* wifi_ssid = "..........";             // SSID
      const char* wifi_password = "..........";         // WIFI
      const char* apiKeyIn = "..........";      // API KEY IN, example: FALOAPPKH17ZR4Q23A8U9W0XPJL0F6OG
      delay(25000);     // delay 25sec

      Step 4: Run the Code

      1. Open Arduino IDE and upload the code into ESP8266 nodeMCU. Follow this tutorial if you still need to get started with programming the ESP8266 ESP-12E NodeMCU using Arduino IDE.
      2. Return back to your sensor page on askSensors, click on 'visualize' and 'Show Graph' to view your sensor data in graph.
      3. Open serial terminal. You can cross-check the graph readings with the values being printed on your Arduino Terminal.

      Step 5: DONE!

      That's it!

      Thanks for reading this instructable!

      You can try more tutorials here.

      Finally, your feedback will be appreciated. please leave a comment below!

      1 Person Made This Project!


      • Fix It Speed Challenge

        Fix It Speed Challenge
      • One Board Contest

        One Board Contest
      • New Year, New Skill Student Design Challenge

        New Year, New Skill Student Design Challenge



      Question 5 months ago on Introduction

      I have follow the instructions but when uploading the code..I got the message .
      The API key is obsolete,,,i generate the a new key in asksensor but got same message ..
      what is wrong


      Question 1 year ago on Step 3

      Where does it put/post data?
      The only thing I can see in the github code is get commands.
      And I cannot see where it sends data? Probably me who is blind

      shariq azim
      shariq azim

      2 years ago

      So does this means that it will take atleast 25 seconds(delay) to respond to the instruction/commands from the cloud ?


      Reply 1 year ago

      No, The delay of 25sec is set as example.
      With paid account you can send data every second.
      With free account, you can send data every 10 seconds.


      2 years ago

      Thank you for this tutorial. I did everything but I have one error in Arduino IDE. The error is:
      'class axTLS::WiFiClientSecure' has no member named 'setInsecure'
      Can you help me?
      Thank you in advance.


      Reply 2 years ago

      Hello Tod333,
      Thank you for trying this tutorial.
      It seems that you have some issues with including the right WiFiClientSecure.h file.
      1. First, Do an upgrade of your Arduino IDE, and make sure that the ESP8266 target is well installed as shown in this documentation:
      2. make sure that you are compiling the file with the right Target configuration (ESP8266..).
      3. If the issue of setInsecure persists, try out with this example code (where the setInsecure is not used):
      The result should be the same.

      Hope it helps. It you have any other inquiries, please ask directly in the community Forum so you will get quick answers ;)


      3 years ago

      it works fine me, thanks


      Reply 3 years ago

      good, Thanks :-)

      DIY Hacks and How Tos

      Great first Instructable. Thanks for sharing it with the community.


      Reply 3 years ago

      happy to join the instructables community :-)