ESP8266 Weather Station: New Version Released

Do you like this post? Writing posts, developing libraries and programming online font creators is actually hard work. I order most of my electronics from a Chinese website called Banggood. It is save and the items usually arrive in good quality. With every order you do there by following this link you are supporting the blog. Thank you!

While I have a few days off I found some time to finally get a consistent set of libraries for the WeatherStation together and fix a few things. Here is a summary of the changes…

Weather Station as a library

Most important change from my point of view is that you can now install the Weather Station with the Arduino IDE library manager (or at least you will be able once this request has been completed: https://github.com/arduino/Arduino/issues/4331). The reason for this change is that I always saw the WeatherStation as something that should be changed and adapted in the hands of you. The classes that fetch the data from Wunderground, Thingspeak and such are the static part here. The main class is more something like a demo, a starting point which you should extend to your needs. I also hope that other people will write more Data Fetcher classes. If you do, let me know and I can either include it in the library or list your library as a ThirdParty extension.

ThingspeakClient

With the ThingspeakClient you can display the last data you have posted with another node to Thingspeak. I use a ClimateNode to collect temperature and humidity on my balcony. Every 10 minutes the WeatherStation will the fetch the last data set from Thingspeak and display it.
Use the ClimateNode to display outdoor temperature and humidity
on your WeatherStation

Improvements in SSD1306 library

Fabrice Weinberg helped me a lot by refactoring the hole SSD1306 OLED display library. You have now more options for the carousel view. You can for instance choose the direction of the slider, the position of the indicators and you get information in the drawFrame methods about the current state of the animation. Thank you Fabrice!

Progress Bar & Minor Fixes

I added a progress bar which will be displayed when the various sources will be updated from the web. The old Wifi Connection Spinner is also back in a new costume…
Progress Bar while updating internet resources
I could eliminate many issues that caused instability. I’m running now a test to see wether I could fetch all of them. Please let me know if your WeatherStation crashes from time to time, so I can fix it.

Installation

Please make sure that you are using Arduino IDE 1.6.5. The newer versions 1.6.6 and 1.6.7 cause currently trouble together with the ESP8266 platform. For detailed installation instructions please visit https://github.com/squix78/esp8266-weather-station

Posted by squix78

27 comments

    • I'm truly sorry, the demo sketch was not updated for the 1.0.0 release. I released now 1.0.1 version with an updated demo file. It might take a few hours unitl this version shows up in the library manager. Once it does, please update to the latest version and check if the errors are fixed now…

    • I'm truly sorry, the demo sketch was not updated for the 1.0.0 release. I released now 1.0.1 version with an updated demo file. It might take a few hours unitl this version shows up in the library manager. Once it does, please update to the latest version and check if the errors are fixed now…

  1. Hello. Thanks for your work on this very good idea. However I seem to have a problem in that module works as expected but is not updating. For example last night at midnight it didn't change the date until I rebooted it, also noticed feeds are not updating. I tried changing ticker from false to true on line 64 to no avail. Any ideas. Many thanks again for your work Dave.

    • Hi Dave. Thank you for the feedback. It turns out the ticker does not fire often enough in the demo. To fix this change

      ticker.attach(10 * 60 * 10, setReadyForWeatherUpdate);
      to
      ticker.attach(10 * 60, setReadyForWeatherUpdate);

      This will change the update interval from 100 minutes to 10 minutes… I will fix this in the demo and release a new version now…

  2. Hi Dani

    This latest updates overtake my humble changes (I added a DHT22 to your earlier version). I also managed to update your SSD1306 library to allow me to use a SH1106 (1.3")based display. I only had to change this function in the file "SSD1306.cpp" to…..

    ==================================================

    void SSD1306::display(void) {

    for (uint8_t k=0; k<8; k++)
    {
    sendCommand(0xB0+k);//set page addressSSD_Data_Mode;
    sendCommand(0x02) ;//set lower column address
    sendCommand(0x10) ;//set higher column address

    for (uint16_t i=0; i< 128; i++) {
    // send a bunch of data in one xmission
    //Wire.begin(mySda, mySdc);
    Wire.beginTransmission(myI2cAddress);
    Wire.write(0x40);
    for (uint8_t x=0; x<16; x++) {
    Wire.write(buffer[128*k+i]);
    i++;
    }
    i–;
    yield();
    Wire.endTransmission();
    }
    }
    }

    ========================================

    I also renamed a few files to preserve the original library.

    Simon

  3. Hi Dani

    I have a separate question regarding the time library function. Here in Sydney we have UTC+10 in the winter and +11 in the summer – it doesn't look like the function can cope with this seasonal change, or can it?

  4. Hello Daniel,

    first thanks for this amazing project! I have found a bug: i´ve installed all librarys etc. as you discriped in your post. All works fine, but the time in frame1 is not ticking sec. by sec. it shows xx seconds an for the frame time (5s) nothing happends. The time (seconds) ist standing still. But when the frame changes to frame2 the time is updating and shows the actuall seconds to the time.

    i have arduino 1.6.5, with nodeMCU v1.0 and the ssd1306 display.

    Any idea? How can i debug this issue?

    I already open a ticket on github for this issues.

    Thanks and greetigs

    Thomas

    • Hi Thomas. Sorry for the long response time. I didn’t see your comment until now. Hm, I have no clue. Which version of the library are you using? The time is recalculated with every call of drawFrame based on the internal timer… Do the other frames show up correctly?

  5. Hi Daniel,

    i have found a solution that work for me but i dont know what is going false here. In the function “bool drawFrame1” i have to add “return true;” at the end. Then it works correctly. But why? Is this a really a bug? I work with your latest Code showing up in Arduino IDE

    Thomas

  6. The need for a ‘return true’ statement is surely because the function is declared as ‘bool’ and therefore expects a return logical value to be provided, so adding ‘return true’ corrects a programming error.
    Some of the functions are declared void some not, when no return value is required, I recommend they are checked for consistency.

  7. Hi Daniel,
    Your latest software update 1.1.2 has been updated on my Arduino IDE, but then it requests another update, so I downgrade to 1.1.1 and then it requests an update and every time I start the IDE it keeps requesting an update to 1.1.2 even if it ha bene updated. Is that your end or the Arduino Team?
    Dave

Leave a Reply