ESP8266: Weather Station V2 Code published

This is a total make over of the earlier weather station. Instead of building my code
on the NodeMCU lua firmware I decided to switch to the Arduino IDE based development setup.
The reason for this was the constant problems with heap memory running out and other instabilities.
When I finally found code that demonstrated the use of my beloved SSD1306 based OLED 128×64 displays the final piece was in place.

I tried to separate the building blocks of the code into different classes, so they can be reused
easiley for other purposes. There is a class for the SSD1306 display and one for talking to the weather API of


This class interfaces with the display over the I2C bus. Please be aware that I set the bus speed relatively high, in order to have faster refreshes of the display. It can happen that for some reason this value is too high for your setup. Then you’d have to experiment with different values


I’m using the API to retrieve localized weather information. The API returns huge JSON objects which I thought would be hard to handle on the ESP8266. For this reason I wrote a little php script which selects interesting information and transforms it into key=value pairs, separated by a new-line charachter.
This can be handled very memory efficiently on the ESP8266. This step costed some self-convincing, since I’m usually a big fan of well structured data. But you have to think differently on embedded platforms

If you find any bugs or code with room for improvement please let me know. C/C++ is not my mother tongue… The best way to tell me about improvments are pull requests (which is a github feature…).

Related:  RTL-SDR: Quick Guide to Software Defined Radio on Mac OS X Yosemite

You find the code here:

Update: The WeatherStation Kit!

Order all components needed for the WeatherStation in one Kit. The WeatherStation Kit is available now at the shop:
Buy the WeatherStation Kit!
Now a beer! Did you like this post? It often takes me several hours of my free time to write one. If I was your neighbour would you offer me a beer for the hard work I did for you? The beauty is: beers can be teletransported with a painless donation using Paypal. A beer in a Swiss bar costs about USD $4.80. Or use this affiliate link if you order something on Banggood and I'll get a small kickback. Thank you!