Using Thingspeak to build a simple weather station with ESP8266 wifi module and Arduino

It is in every IoT (Internet of Things) enthusiast’s desire to build at least one IoT project in their lifetime. However, the cost of building a simple IoT project as well as the knowledge needed might be scary especially to newbies. In this esp8266-Arduino-Thingspeak project, we are going to learn how to build a simple and cheap weather station using the DHT11 temperature and humidity sensor, esp8266 wifi module, Arduino Uno microcontroller, and the Thingspeak open IoT platform, in seven simple steps.

1. What hardware do you need?

You will need at least the following items besides a breadboard and a couple of jumper wires:

    1. DHT11 sensor

The DHT11 sensor is a combined temperature and humidity sensor. It uses a capacitive humidity sensor, and a thermistor for a temperature sensor.

    1. CP2102

CP2102 is an ultra-cheap USB-to-UART bridge controller. However, it is used purposely as a logic level converter in this project. It is used to supply 3.3V to the wifi module. Other alternative logic level converters can be used in its place for this esp8266-arduino-thingspeak project.


    1. ESP8266 wifi module

This is probably the cheapest SOC with integrated TCP/IP stack built to give your microcontroller access to the WiFi network. It is a pretty robust module as it can also be used alone as an MCU with WiFi capabilities.



    1. Arduino Uno

This is arguably one of the most used open-source development boards. Its use in this project is pretty redundant as the EPS8266 can perform its functions. However, it has been used so that the DIYers who already have or are working on Arduino projects may learn how to connect to the IoT networks easily.


2. What software do you need?

    1. Arduino IDE

The Arduino IDE is the programming interface for your Arduino microcontroller.

    1. DHT11 library

You need this library to convert the digital output of the DHT11 sensor to meaningful data.

    1. Thingspeak

Thingspeak is not actually a software you need to install. It is an open IoT platform that provides good analytics for data. We shall send our data to thingspeak platform to present it in very nice graphs.

3. Electrical schematic design


4. Add DHT11 library to Arduino IDE

It is often good practice to not re-invent the wheel. Similarly, you dont have to waste your time trying to create your own code libraries while some already exist. In order to convert the digital output from the DHT11 sensorto meaningful data, we shall use a DHT11 library available from Adafruit site. The following is the procedure of adding a library to your Arduino IDE:

5. Create a Thingspeak Channel

6. Arduino code for logging data onto thingspeak channel

Arduino code

7. Thingspeak IoT Charts

Once you start transmitting your data, Thingspeak will plot each data point nicely in individual charts. You can have as many as 8 charts being updated simultaneously depending on how many sensors you have connected to your Arduino or any other microcontroller. The figure below shows our weather station visualized nicely in charts.