Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

A Mini Weather Station With an ESP8266

DZone's Guide to

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.

· IoT Zone
Free Resource

Build an open IoT platform with Red Hat—keep it flexible with open source software.

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.

SQUIX ESP8266 Mini Weather Station

SQUIX ESP8266 Mini Weather Station

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."

Squix ESP8266 Weather Station Kits

Squix ESP8266 weather station kits

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

ESP8266 OLED Kit

ESP8266 OLED Kit

  1. DHT11 temperature/humidity sensor
  2. SSD1306 0.96″ OLED
  3. 40 Jumper cables
  4. EP8266 nodeMCU v1.0 with 4 MByte Flash
  5. 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:

Forecast Data

Current weather:

Current Weather

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).

Indoor Temperature

Date and Time (yes, it is a clock too!):

Date and Time

For the weather station, I designed, in Inkscape, an enclosure with 3 mm plywood (35x40x60 mm):

Weather Station Box Design in Inkscape

Weather station box design in Inkscape

I used a 50W laser cutter with the K40 Whisperer software. I needed two iterations (the first enclosure was a bit too small).

The DHT11 sensor gets placed on the bottom of the box:

DHT11 Placement

DHT11 placement

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:

ESP8266 Module

ESP8266 module

On the bottom, I added some ventilation holes to get better temperature and humidity values:

Bottom Side

Bottom Side

On the backside, we have the USB port with a ‘cloud’ for better air flow.

Weather Station Back Side

Weather station backside

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.

Happy Squixing!

Links

Download Red Hat’s blueprint for building an open IoT platform—open source from cloud to gateways to devices.

Topics:
weather ,iot ,esp8266 ,wi-fi ,tutorial

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}