A Mini Weather Station With an ESP8266
A Mini Weather Station With an ESP8266
Build your own Wi-Fi-capable weather station and clock, and even design custom housing, with a handy kit and some ingenuity.
Join the DZone community and get the full member experience.Join For Free
I’m convinced that this ‘Internet of Things’ thing is not real. Pure marketing and buzzwords without any added value, right? The IoT hype is so bizarre: It must have been originated by aliens, and it has taken over the brains of all the Pointy-haired Bosses of the world! There is no useful application or use case out there!
But wait! There *is* actually good use case, at least for the geeks of this world. We all love clocks, as we want to know the time, and we all love the weather forecast so we can plan accordingly. At least I usually do.
A tweet by Daniel Eichhorn (@squix78) triggered my interest: He created a cool ESP8266 Wi-Fi weather station and actually sells it as a kit. So without waiting, I ordered two kits without really checking all the details: The "ESP8266 WeatherStation Kit" and the "ESP8266 WiFi Color Display Kit."
Each kit is in a very solid (and useful!) plastic box. And unlike many other kits from China, everything is well-organized and in anti-static bags. The ESP8266 WeatherStation Kit includes
- DHT11 temperature/humidity sensor
- SSD1306 0.96″ OLED
- 40 Jumper cables
- EP8266 nodeMCU v1.0 with 4 MByte Flash
- Micro USB cable
No soldering is required for the ESP8266 WeatherStation Kit. Daniel wrote an excellent tutorial plus a guide how to integrate the DHT11 sensor. With this, the wiring and software setup was a piece of cake.
The example code uses the free Weather Underground weather service. Using the ESP8266 chip, it connects over Wi-Fi to the service and receives the data in JSON format. A JSON parser on the ESP8266 extracts and displays the data. The weather service provides data for many countries and cities in different languages. I selected a place a few kilometers away from my home.
The interval of fetching data is configurable, and I’m using 10 minutes for now. The JSON data has lots of data, and the JSON parser on the ESP8266 extracts information for the display. In the example code, it cycles through several pages.
Weather forecast with min/max temperature:
Indoor (and outdoor) temperature and humidity. For indoor sensor values, it uses the DHT11. The temperature and humidity get pushed to Thingspeak so I can use it from another weather station (more about this later).
Date and Time (yes, it is a clock too!):
For the weather station, I designed, in Inkscape, an enclosure with 3 mm plywood (35x40x60 mm):
The DHT11 sensor gets placed on the bottom of the box:
I placed the ESP8266 module on top, behind the display. A small plywood piece separates the display from the module so they do not make contact:
On the bottom, I added some ventilation holes to get better temperature and humidity values:
On the backside, we have the USB port with a ‘cloud’ for better air flow.
Currently, the weather station gets powered through the micro USB connector. Because of the jumper wiring, there is no space for a battery. I have ordered a small LiPo plus a charger module for my next iteration. But so far, I’m very happy how it fits together and works.
Thanks to Daniel, I have now a small and useful weather station. It fetches local weather and forecast data from the internet using the ESP8266 Wi-Fi chip. It pushes data to Thingspeak so I can use it from anywhere in the world, or display the data on another weather station. Remember that I ordered two kits? Yes, that second kit has a touch LCD, so that one will be next.
The design files are on Thingiverse.
- Starter kits: https://blog.squix.org/product-category/starter-kits
- Weather station kit: https://blog.squix.org/product-category/starter-kits
- Weather station color add-on kit: https://blog.squix.org/product/esp8266-wifi-color-display-kit-2-4
- Getting started guide: https://blog.squix.org/wp-content/uploads/2017/06/esp8266weatherstationgettingstartedguide-20170608.pdf
- Blog post: https://blog.squix.org/2016/10/esp8266-weather-station-color-code-published.html
- GitHub: https://github.com/squix78/esp8266-weather-station-color
- Files on Thingiverse: https://www.thingiverse.com/thing:2527340
Published at DZone with permission of Erich Styger , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.