esp8266 Weather Station

ESP8266 – IoT Based Weather Station

A few days ago, I had developed a dht11 driver for this project i.e Weather Station, that can be used with the esp8266 open SDK. The dht11 is a sensor that is used to measure the ambient temperature and relative humidity. This weekend, I squeezed out some time and developed the application code for receiving requests and transmitting the sensor data over the internet. The sensor data is displayed and updated on a webpage every 10 to 15 seconds.

The role of the esp8266 as follows:

  1. It will have the server side code i.e. HTTP server, running on it, so it basically behaves as a server waiting to serve a web page on request from the client side i.e. the web browser.
  2. It will also be responsible for communicating with the dht11 sensor and processing the sensor data.
  3. The processed sensor data is integrated with the server-side response so that the webpage is always updated with the latest or new sensor data at every 10 to 15 seconds.

The software can be downloaded from my Github repository or cloned by using the below command.

The below video demonstrates the working of the IoT based weather station.

If you have seen the above video carefully, you would have noticed that there are several instances in which the dht11 packets are missed. This is because of the network calls running in the background that makes use of the same timer as that of the dht11. Unfortunately, the esp8266mod has just one inbuilt timer that needs to be shared. The worst case timing for updating the web page with a new data is about 13 seconds. Hence, within a time interval of 13 seconds, you must expect the data on the web page to be a new one.

To avoid missing any packets, I tried using the hardware timer in NMI mode as described here. Though this method greatly improves the dht11 data capture efficiency but hampers the network capabilities. Espressif hasn’t really provided much info on how the network calls use the timer and also, details about how using the hardware timer in NMI mode affects the network capabilities. Hence, this requires further investigation. I also believe that esp8266MOD would be a good option for developing non-time critical applications but not for any timing critical applications. I also need to try this on FreeRTOS to see if it makes any improvements in the sensor processing. If there are folks who can suggest to make improvements or have made it, please feel free to share your research and work below.

Leave a Reply

Your email address will not be published. Required fields are marked *