AskSensors IoT Platform Documentation

Connect Hardware to AskSensors over MQTT

AskSensors HTTPS Hardware Summary:


2-Connect ESP8266 over HTTP/HTTPS

3-Connect ESP32 over HTTP/HTTPS

4-Connect Arduino Ethernet over HTTP/HTTPS

5-Connect Arduino WiFi over HTTP/HTTPS

6-Connect Raspberry Pi over HTTP/HTTPS

7-Connect Regular PC Node.js over HTTP/HTTPS

2-Connect ESP32 over HTTPS

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.
This section shows how to connect your ESP32 to the AskSensors cloud

AskSensors : ESP32

a) Prerequisites :

b) Required Hardwares :
To follow along with this tutorial you will simply need:
  • Computer running Arduino software.
  • ESP32 development board.
  • USB micro cable to connect ESP32 development board to the computer.

c) Install ESP32 in Arduino IDE:
Follow the instructions below to install the ESP32 board in your Arduino IDE:
  • Install the latest version of Arduino IDE software (1.8.7 or higher).
  • Open the preferences window from the Arduino IDE : File> Preferences.
  • 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:,
    Now, open boards manager (Tools > Board > Boards Manager), search for ESP32 and click the install button for the "ESP32 by Espressif Systems".

d) Software :
Download this demo from the AskSensors Github page.
The code includes the libraries for both connecting to a WiFi network and to perform the HTTP requests. You need to fill the following:
  • Your WIFI SSID and password.
  • The Api Key In given by AskSensors.
  • The time interval between two successive updates.
  •   const char* wifi_ssid = ".........."; // SSID
      const char* wifi_password = ".........."; // WIFI
      const char* apiKeyIn = ".........."; // API KEY IN
      const unsigned int writeInterval = 25000; // write interval (in ms)

e) Run the code :
Here are the main steps to run your code:
  • Connect your ESP32 to the computer and upload the code from Arduino IDE.
  • Return back to your sensor page on askSensors, click on 'visualize' and 'Show Graph' to view your sensor data in graph.
  • Open a serial terminal on Arduino IDE. You can cross-check the AskSensors graph readings with the values being printed on your Arduino IDE Terminal.

f) Source Code :
A basic source code is shown below. Please refer to the AskSensors Github page to get the latest version and updates.

Connect ESP32 to AskSensors
* Description: This sketch connects to a website ( using an ESP32 Wifi module.
* Author:, 2018
* github:
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
WiFiMulti WiFiMulti;
HTTPClient ask;
// TODO: ESP32 user config
const char* ssid = "............."; //Wifi SSID
const char* password = "............."; //Wifi Password
String apiKeyIn = "............."; // API Key
const unsigned int writeInterval = 25000; // write interval (in ms)
// ASKSENSORS host config
const char* host = "";
const int httpPort = 80; // port
void setup(){
  // open serial
  Serial.println("********** Program Start : Connect ESP32 to AskSensors.");
  Serial.println("Wait for WiFi... ");
  // connecting to the WiFi network
  WiFiMulti.addAP(ssid, password);
  while ( != WL_CONNECTED) {
  // connected
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
void loop(){
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
  }else {
  // Create a URL for updating module 1 and module2 request
  String url = "";
  url += apiKeyIn;
  url += "?module1=";
  url += random(10, 100);
  url += "&module2=";
  url += random(10, 100);
  Serial.print("********** requesting URL: ");

  ask.begin(url); //Specify the URL
  //Check for the returning code
  int httpCode = ask.GET();
  if (httpCode > 0) {
     String payload = ask.getString();
  } else {
   Serial.println("Error on HTTP request");
  ask.end(); //End
  Serial.println("********** End ");
  client.stop(); // stop client
  delay(writeInterval); // delay

Previous : ESP8266 HTTPS