Blog

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:

  • Remote view of data being analyzed
  • Remote control
  • Display for real-time data view
  • Ease of connectivity and USB charging
  • Data transmission to home server for collection of insights, data visualization and more
  • Scalability of connected sensors
  • Simultaneous use of many weather sensors

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:

  • NodeMCU board
  • LCD TFT Display 320х240 based on ILI9340C
  • DHT22 sensor
  • BMP180 sensor
  • Prototyping boards (5х7 см)
  • Micro USB chip

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:

  • Wi-Fi network to connect to
  • Sensors to be used
  • Real-time module setup
  • Data view from connected servers
  • Sensors to be reloaded, etc

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?

  • NTP time sync
  • In-module data aggregation in case of disconnection
  • Authentication on data viewer server
  • Sensors connection to certain users
  • Data visualization
  • Outdoor sensor
  • Relay control
  • Ability to generate data from door / window open sensors
  • Making changes to generated data for analysis of in-box sensors.

Feel free to view the project code on GitHub.

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!

    Andrew Zola

    Andrew's current undertaking is big data analytics and AI as well as digital design and branding. He is a contributor to various publications with the focus on emerging technology and digital marketing.

    Recent Posts

    Intersog Gains Game-Changer Status on Clutch

    Intersog, a leading technology partner, gains recognition on Clutch's prestigious list for game-changing software developers…

    1 week ago

    Can Advanced Digital Tools Revolutionize Communication in Remote Teams?

    In the shift towards widespread remote work, the adoption of advanced digital tools marks a…

    4 weeks ago

    Can AI and Machine Learning Unite Global Remote Teams?

    In the quest for innovation, the fusion of AI and Machine Learning with global remote…

    4 weeks ago

    The Synergy of Cloud Computing and AI: Elevating Business Innovation

    In an era marked by rapid technological progress, the fusion of cloud computing and artificial…

    4 weeks ago

    Secure Your Tech Career Path with Intersog's Direct Recruitment

    Explore Intersog's unique approach to tech recruitment, offering a transparent, direct path to genuine career…

    1 month ago

    Streamlining Software Maintenance: A Strategic Blueprint

    Explore the critical role and innovative strategies of efficient software maintenance for ensuring software stability,…

    2 months ago

    This website uses cookies.