Skill Level: Intermediate

Arduino, Sensors,

The project is about sending office/room temperature data to Thingspeak. The temperature data would be used to observe and analyze the performance of Air conditioning and take appropriate measures if temperature variation is far from acceptable.


1. ESP8266-12 development board- Wemos D1 R2 mini

2. LM35 Temperature sensor

3. Jumperwires

4. USB cable

5. Breadboard

Apart from above components, one should have Arduino IDE installed.



  1. Connect the circuit as shown

    The circuit connection is easy. Data pin of LM35 is to be connected to analog pin of ESP8266. In case of Wemos board, it is A0 pin also known as pin 17 in ESP8266. The other two pins of LM35 are to be connected to 3.3V and GND pins of Wemos board respectively.


  2. Program in Arduino IDE and Upload to ESP8266

    The program was written in Arduino IDE. The program uses ThingSpeak.h library to send to the data to Thingspeak.

    Before writing the program, a channel was created in Thingspeak to store temperature data. The channel number and write API key are used in the program to send data to Thingspeak. Please check the attached file for the code. Inlcuded libraries are ThingSpeak.h and ESP8266WiFi.h . Program was uploaded to Wemos D1 R2 ESP8266 board using USB. The factor of 0.322 was used to convert analog reading of LM35 to convert to temp in degrees centigrade since sensor was connected to 3.3V of ESP8266.


    #include <ThingSpeak.h>



    const char*ssid= “Your internet id”;

    const char* password=”Your internet password”;

    const char* server= “api.thingspeak.com”;

    float temp= 0;

    int analog=0;


    WiFiClient client;

    unsigned long myChannelNumber = your channel number from Thingspeak;

    const char * myWriteAPIKey = “Your api key”;


    void setup() {

      // put your setup code here, to run once:



    WiFi.begin(ssid, password);



    Serial.print(“Connecting to”);


    WiFi.begin(ssid, password);

    while( WiFi.status()!=WL_CONNECTED){


    ¬† Serial.print(“.”);



    Serial.println(“WiFi connected”);




    void loop() {

      // put your main code here, to run repeatedly:


    float temp= 0.322*analog;


    ¬† Serial.print(“Temeperature:”);


    ¬† Serial.print(“%send to Thingspeak”);


    ThingSpeak.writeField(myChannelNumber, 1, temp, myWriteAPIKey);



  3. Monitor Room Temperature in ThingSpeak from anywhere

    Once the program was loaded, ESP8266 was on the job. Temperature data was sent to ThingSpeak. The data can also be observed on serial monitor.

    Sudden spike in temperature in the attached screen is explained by positioning the sensor near laptop cooler fan blow which is hot.




1 comment on"Internet Monitoring of Room Temperature FromThingSpeak Using ESP8266"

  1. Good article.

Join The Discussion