IOT | Post Data to Thingspeak Using ESP8266

Introduction: IOT | Post Data to Thingspeak Using ESP8266

About: i am electronic Hobbyist. I like to make the things and also make it available to people who need it. Please visit and subscribe my youtube channel for more Embedded related videos.

Nowadays, IoT is trending and lots of machine has data to upload over cloud and analyse the data. Small sensors update the data on cloud and actuator on another end acts on it.
I am going to explain the one of the example of IoT.

I this article and i am going to show and guide to post the data to Thingspeak using ESP8266.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Required Component

ESP8266 in India-

ESP8266 in UK -

ESP8266 in USA -

MLX90614 in India-

MLX90614 in UK -

MLX90614 in USA -


BreadBoard in India-

BreadBoard in USA- BreadBoard in UK-

Step 2: Code

#include #include

String apiKey = "7CDCTE2767Z8AUIL"; // Enter your Write API key from ThingSpeak

const char *ssid = "hidden"; // replace with your wifi ssid and wpa2 key const char *pass = "qwerty12"; const char* server = "";

WiFiClient client; Adafruit_MLX90614 mlx = Adafruit_MLX90614();

int objTemp; int ambTemp;

void setup() { Serial.begin(115200); delay(10); Serial.println("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); mlx.begin(); Wire.begin(D1,D2); } void loop() {

if (client.connect(server,80)) // "" or { objTemp = mlx.readObjectTempC(); ambTemp = mlx.readObjectTempC(); String postStr = apiKey; postStr +="&field1="; postStr += String(objTemp); postStr += "\r\n\r\n";

client.print("POST /update HTTP/1.1\n"); client.print("Host:\n"); client.print("Connection: close\n"); client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n"); client.print("Content-Type: application/x-www-form-urlencoded\n"); client.print("Content-Length: "); client.print(postStr.length()); client.print("\n\n"); client.print(postStr);

Serial.print("Ambient = "); Serial.print(ambTemp); Serial.print("*C\tObject = "); Serial.print(objTemp); Serial.println("*C");

} client.stop(); delay(2000); }

Step 3: Demo

Be the First to Share


    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020
    • First Time Author Contest

      First Time Author Contest



    Question 1 year ago on Step 2

    Im working with wemos d1 r1. Pls help me with the code that sends mlx90614 data to thingspeak with wemos d1 r1