How to Connect an ESP32 to the IoT Cloud




Introduction: How to Connect an ESP32 to the IoT Cloud

About: IoT Maker, co-founder of

This instructable comes in a series of articles about connecting hardware like Arduino and ESP8266 to the cloud. I'm going to explain you how to make your ESP32 chip connected to the cloud with AskSensors IoT service.

Why ESP32?

After the big success of the ESP8266, the ESP32 is a new chip from Espressif that combines WiFi and Bluetooth wireless capabilities with two CPU cores and a decent hardware peripheral set.

What you will learn?

During this tutorial you will learn:

    • How to program your ESP32 with the Arduino IDE.
    • How to send data from your ESP32 to AskSensors using the HTTP GET requests.
    • How to visualize real time data stream in the cloud.

    Step 1: Requirements

    What You need:

    • An ESP32 module. I'm using an ESP32 Pico Kit as shown in the figure above.
    • A computer running Arduino IDE software.
    • A USB cable to connect the ESP32 module to the computer.
    • A free AskSensors account.

    Step 2: Why AskSensors?

    AskSensors is an IoT platform designed to be the easiest application in the market, allowing users to connect, visualize and analyze their sensors data over the cloud.

    Let's suppose we want to monitor the temperature of a room and store these values somewhere in the cloud so that they can be elaborated later. This is a typical scenario where it is necessary to know how to send data from the ESP32 to AskSensors. But there are many other scenarios where this tutorial could be useful for you.

    So keep reading ;-)

    Step 3: Sensor Setup

    1. Sign up: Get a free account in few seconds at :
    2. Get your Api Key In: AskSensors exposes a set of API to simplify the data exchange process between your device and the IoT cloud. This getting started guide shows you how to create a new sensor, and set it up to be able to send data to. Copy down your Api Key In, we will use it in the next steps.

    Step 4: Install ESP32 in Arduino IDE

    To install the ESP32 board in your Arduino IDE, follow the instructions below:

    1. You need to install the latest version of Arduino IDE software (1.8.7 or higher).
    2. First of all, open the preferences window from the Arduino IDE : File> Preferences
    3. Go to the "Additional Board Manager URLs" field, Enter the following URL:

    If you already have the ESP8266 boards URL, separate the URLs with a comma as show below:, <br>

    Now, open boards manager (Tools > Board > Boards Manager), search for ESP32 and click the install button for the "ESP32 by Espressif Systems". It takes some few seconds.

    Step 5: Coding

    Download this demo from AskSensors Github page and decompress it. The code includes the libraries for both connecting to a WiFi network and to perform the HTTP requests.

    You will need to modify the following:

    const char* ssid     = "..............."; //Wifi SSID
    const char* password = "..............."; //Wifi Password
    const char* apiKeyIn = "................"; // API Key

    Step 6: Programming

    1. Connect the ESP32 module to your computer through a USB cable.
    2. Upload the code with the Arduino IDE.

    3. Open a serial terminal. You should get an output similar to the figure above. Note that we are getting two codes :
    • 200 : corresponds to an OK HTTP code.
    • 1 : Number of module successfully updated (one module in our case).

    Step 7: Visualize Your Data

    Head to your sensor dashboard. Add a graph to your Module (Module 1).

    You should receive random data stream between 10 and 100 every 20 seconds.

    The figure above shows the example of a Bar graph display.

    Step 8: Thanks!

    Thanks for reading.

    Discover our tutorials:

    Be the First to Share


      • 3D Printed Student Design Challenge

        3D Printed Student Design Challenge
      • Unusual Uses Contest

        Unusual Uses Contest
      • Hide It Challenge

        Hide It Challenge



      1 year ago

      The free version of asksensors is only for 3 months, and doesnt include the mqtt. So it doesnt make sense to engage with this vendor for those of u who aren't pro. Other vendors offer more for the low cost users.


      Reply 1 year ago

      Thank you for reaching out.
      Have you tried this instructable ? Are you able to connect your ESP32 to the AskSensors cloud and send data over HTTP ?
      It works just fine.

      Please feel free to ask any question in the AskSensors Forum:
      We will be glad to answer your questions.