How to Build a DIY Home Weather Station With ESP8266

This is my English translation of the article originally published in Geek Times.

A couple of years ago I purchased esp8266, a cheap Wi-Fi chip with full TCP/IP stack and micro controller capability manufactured by Espressif. My idea was to build something useful for my home using this controller. Such features as Wi-Fi connectivity, small size, enough inputs / outputs and ease of programming make esp8266 a perfect controller for enabling home automation. I eventually decided to build a home weather station.

Basic system requirements:


My first step was to find existing systems I could use for a prototype. As I explored available systems I understood none of them would meet my requirements either because of the closed code or because they charge extra fees for letting you get advantage of all features you need. Therefore, I chose to invent my own bicycle. To take my project from the ground up, I had to deploy software and hardware first. I bought the following components on eBay:

For software development I chose a simple PHP + MySQL stack based on Raspberry PI and deployed to home server. Its advantage over Cloud services is system stability in case of black-out or disconnection. Although I had to program back-end for data storage and processing, I was excited to do so! Arduino IDE fitted with an esp8266 module was chosen as a programming environment, check out details here.
My plan A was to program everything in Lua (nodemcu), but I had to refuse from it because I'd run out of memory each time I uploaded sketches. For data exchange between Raspberry and my weather station I chose JSON.

I used standard methods of sensor connection to module and found relevant libraries here:

This library was helpful, too.

Here're additional sensors you can connect and configure for data collection and analysis:

Right now I'm waiting to receive MHT-Z19 CO2 sensor to monitor CO2 level in the air (indoor and outdoor). Once I've got it, I'm going to extend weather parameters I'm tracking at home.

After several iterations of code bug fixing and prototyping I was ready to assemble my home weather station.

Device circuit


At first, I made a display opening in a plastic box:


Then I embedded the display inside along with a hardware board, module and sensors. Reset button was deployed, too.


I made holes in the front plates of the box for sensors ventilation and power connectors.

I deployed a remote control in the module firmware using a web server. It allowed me to set up and configure the device with regards to:

I used responsive design to control my weather station remotely from a smartphone. Built-in pages don't have any external dependencies, all styles and scrips are being stored in modules memory.



I also created a basic website to view a list of connected modules, generated data and graphs and deployed it to Raspberry.


What is yet to be deployed?

Feel free to view the project code on GitHub.

Are you looking to hire software developers for your IoT / home automation project fast and cost-effectively?
Let's talk!

And have you experimented with DIY home automation? Please share your experience as a comment below or send us a tweet to @Intersog!


Vik is our Brand Journalist and Head of Online Marketing / PR with 11+ years of international experience in IT B2B. He's also a guest blog contributor to business2community, SitePoint, Journal of mHealth, Wearable Valley and other e-zines.

Leave a comment