Using Thingspeak to build a simple weather station with ESP8266 wifi module and Arduino
7 Steps to building your simple esp8266-Arduino-Thingspeak weather station
1. What hardware do you need?
You will need at least the following items besides a breadboard and a couple of jumper wires:
- 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.
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.
- 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.
- 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?
- Arduino IDE
The Arduino IDE is the programming interface for your Arduino microcontroller.
- DHT11 library
You need this library to convert the digital output of the DHT11 sensor to meaningful data.
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.
- The assumption made here is that you already have a WLAN that you can connect to with the ESP8266 Wifi Module.
- Another assumption made is that your module is already connected to the wifi network. You might want to look at an instructable I wrote about how to connect your esp8266 wifi module to the wifi network using AT mode .
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
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.