Arduino IOT: Temperature and Humidity ( With ESP8266 WiFi)





Introduction: Arduino IOT: Temperature and Humidity ( With ESP8266 WiFi)

Hello everyone! I am Michalis Vasilakis from and in this Instructables I will show you how to make your own Internet Of Things (IOT) thermometer by using the Arduino uno board.

You can use it at home, at the office, or anywhere there is an internet connection, for indoor or outdoor data logging. Ιn this project we will use the DHT-22 sensor to take temperature (oC) and humidity (%) values every one hour. For the internet connection we will use the ESP8266 WiFi (serial) module because it's small,cheap and easy to use, and for data logging we will use the open data platform for the Internet of Things "ThingSpeak" (

You can also make monthly or yearly average charts and see how your climate change affects your area!

So, let's get started!

P.S.: Updates and Q&A here:

Step 1: What We Will Need

For this project we will need:

  • Arduino uno board (or any other Arduino board) (link)
  • Small breadboard (or an breadboard shield) (link)
  • DHT-22 sensor (link)
  • ESP8266 WiFi serial module (link)

...and off course some breadboard wires.

Update - Note:

Some users reported me that you may need an external 3.3V power supply for powering up the ESP8266. You can try to use the LD1117V33 (LD33V3) voltage regulator.

Step 2: The Circuit

The connections are pretty easy, watch the above image with the breadboard circuit schematic.



  • DHT-22 Vcc to Arduino 5V
  • DHT-22 Data to Arduino pin 2


  • Vcc, RST and CH_PD to Arduino 3.3V
  • RXD to Arduino pin 1 (TX)
  • TXD to Arduino pin 0 (RX)

Update - Note:

If you have any power problems with your ESP8266 module use one 3.3V voltage regulator (e.g. LD1117V33), connect the Vin pin of regulator with the Vin pin of Arduino uno board.

Step 3: ThingSpeak Account

Visit and click on the "Get Started" button to make a free account.

Now click on the "New Channel" (second image above). Give it a name and select two fields. If you want you can fill more info about your channel, e.g. Latitude and Longitude of your sensor. If you want to share sensor info with your friends (and more..) click on the "Make Public?" check box option. Finally click on the "Save Channel" button.

Click on your new channel and select the API keys tab (third image above). Copy your "Write API Key" , you will need it in the next step.

Step 4: The Code

Here's the code, embedded using Codebender!

Before you proceed:

  • Remove the RX and TX cables from the Arduino board
  • Add your information in the code below by pressing the "Edit" button:

  • #define SSID "name" // "SSID-WiFiname"
  • #define PASS "password" // "password"
  • String msg = "GET /update?key=YOUR_WRITE_KEY"; //change it with your key...

Try downloading the Codebender plugin and clicking on the "Run on Arduino" button to program your Arduino board with this sketch. And that's it, you've programmed your Arduino board directly from your browser!

Now you can re-connect the RX and TX cables. Now check your ThingSpeak channel to see the first sensor's info!

The "delay(3600000);" will send data to your ThingSpeak channel every one hour. It's not the best way for counting, but it's working fine ;).

How to find time in milliseconds:

1 minute has 60000ms, so for example: 15 minutes have 60000x15=900000ms

Step 5: Data Logger

You can see my channel here:

Check it again in one hour!

You can also download the "ThingView" application to your android device!

Step 6: What Next?

You can make your own Arduino-based circuit and put it in a small box, just make sure that the sensor will be out of it.

I made mine and placed it on the wall outside of my house, you can check my temperature and humidity values here!

Future updates:

  • add a real clock circuit to control the time of data sending with accuracy
  • add a rechargeable battery and one small solar panel
  • add more charts for monthly and yearly average values

Step 7: Well Done!

You have successfully completed this guide and now you have your own Arduino IOT device up and running!

For more Arduino tutorials and cool projects you can visit our web page:

I hope you liked this, let me know in the comments!

6 People Made This Project!


  • Microcontroller Contest

    Microcontroller Contest
  • Science of Cooking

    Science of Cooking
  • Pocket-Sized Contest

    Pocket-Sized Contest

We have a be nice policy.
Please be positive and constructive.


2 Questions

I had strictly followed all the steps given in article but still I don't get any output on ThingSpeak. I had use the same program from article. So is this because of Incomplete Program ?


This code gives me comiling error.


Hi their I tried following your guide to see if I could get my Grove DHT11 Temp & Humidity sensor to capture and upload data to my ThingSpeak account, but unfortunately no data is showing up on the site.

The only modifications I have made to the code is the pin i'm using and the code specific to my DHT11. Any help would be greatly appreciated.


Same problem I am facing, do not get any data on ThingSpeak. So please help to sort out the issue !!

Arduino: 1.8.5 (Windows 8), Board: "Arduino/Genuino Uno"

WARNING: Category 'Schedulers' in library TaskScheduler is not valid. Setting to 'Uncategorized'
In file included from C:\Users\karthik\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:22:0:

C:\Users\karthik\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory



compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

this type of error was happening,what can do for it





will this work with a dht11

It will work with a DTH-11 if you change the #define to DTH11. I found the DTH-11 to be a unreliable sensor and suggest you use a HDC1080. You will need to use the libaray from Closedcube and some of ther example code.

How long does it take for data to show up on my account? I built it, loaded the code and have not seen data yet. The ESP8266 give a blue blink (is that a good sign?) so I think its working.

By the way, data shows up within seconds at Thingspeak.

I was able to expand out the code to read other sensors such as light and LM34 temperature sensors. Just add additional fields. I had a problem with character transmission if the value was less than 10. Any additional fields being sent after a low value sensor will not be graphed. It will just make a gap till the value come above 10. This was a problem when I was using a light sensor such as a CDS cell. I found if you not use the dtostrf command and just send the value as a floating variable, it work with numbers approaching zero. I also used a DTH-11 as a sensor and they are unreliable and noisy. Will be using a HDC1080 instead. I also discovered that time scales do not match across data fields. Yet they do when the graphs are zoomed and compared.