ESP8266 Weather Station Color code published

Do you like this post? A regular project like the PlaneSpotter Color takes many hours of my free time to develop and maintain. Would you offer me a beer for my hard work if I was your neighbour? Modern technology called teleportation makes it easy to send me a beer. Just click here. Thank you!

If you don’t mind code which is a little bit rough around the edges you can start experimenting with the code for the color weather station. I just published it on Github.

You  can find it here: https://github.com/squix78/esp8266-weather-station-color

I used a display almost identical to this one: 2.2 Inch Serial TFT SPI Display ILI9341 Buy one using this link and you’ll be supporting  my blog and future projects.

ESP8266 Weather Station Color
ESP8266 Weather Station Color
Posted by squix78

17 comments

        1. In github when you are looking at the content of a file there is button labelled “Raw”. The link behind that button will show you the real file. Telling from your screenshot I would say you accidentally saved the github page, not the file… Happy that it works now:-). Depending on your setup you might have to make modifications to the openscad file…
          And many thanks for your donation, very much appreciated!

  1. The JPEGDecoder library here:

    https://github.com/Bodmer/JPEGDecoder

    now supports the ESP8266. The library will plot jpegs from arrays stored in Flash or from the SPIFFS filing system. It should also handle SD card files but this has not been tested on the ESP8266.

    Decode and array like this:

    JpegDec.decodeArray(plane, plane_len);

    Various bug fixes have been made to correct image corruptions and ESP8266 exception generation. I can see image corruption in the picture in this blog in the last MCU (spurious green pixel) and this is due to a bug in the version of the JPEGDecoder library you are using. Unfortunately Frederic’s Plantes branch (which is broken), was branched off quite a while ago and quite a few bug fixes have been added since.

    Note that Jpeg rendering times can be halved if raw SPI.writePattern() is used instead of pushColor(). In this case use the byte swap option in the User_Setup.h file to avoid psycodelic images. The map can then be drawn in ~195ms instead of ~420ms which reduces display flicker quite a bit:

    // Use this method with SWAP_BYTES defined in User_Config.h (inside JPEGDecoder library)
    uint32_t count = mcu_pixels * 2;
    uint8_t *pImg8;
    pImg8 = (uint8_t*)pImg;
    while ( count >=64 ) {SPI.writePattern(pImg8, 64, 1); pImg8 += 64; count -= 64; }
    if (count) SPI.writePattern(pImg8, count, 1);

    To avoid confllct with the SD library definition of “File” in SPIFFS call up the FS.h file with globals disabled and use fs::File namespace references:

    #define FS_NO_GLOBALS
    #include

    fs::File jpgFile = SPIFFS.open( filename, “r”);

    Alternatively disable support for the SD library in the User_Setup.h file in the library folder to avoid the compiler error.

    File names can now be in the String type.

    Note: SPIFFS file names should have a leading “/”, but this has not been added to the downloaded map file name. If the SD library is also loaded the leading / is used by the library to spot SPIFFS file names.

    1. Forgot to mention, if you use the raw SPIwrite approach you need to drop the chip select line after the setWindow() function call and raise it again at the end of the render function.

      I can branch the master PlaneSpotter repository at some point and build in all these suggested changes in if this is considered desirable.

      1. Thank you a lot! That makes everything a lot easier. I always prefer to use a “less forked” library. Can you please add library.json and library.properties files to your repository? This allows them to be available through the library manager in the arduino IDE and the platform io lib manager.

        See this documentations:
        http://docs.platformio.org/en/latest/librarymanager/config.html
        https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification

        And here two examples:
        https://github.com/squix78/esp8266-oled-ssd1306/blob/master/library.json
        https://github.com/squix78/esp8266-oled-ssd1306/blob/master/library.properties

        1. OK, I have added the .json and .properties files. the .properties file seems to be recognised by the IDE but I do not know how to test/verify the .json file.

          I have made other changes, in particular to the rendering function in the example sketches so that arbitrary image sizes can be accommodated. (It used to only handle images of x & y size that were integer multiple of the MCU size.) So now the splash screen image gets correctly rendered.

      2. Hi,

        I have tried to use your new library with the plane spotter, and it does not load the map image. I think I have to make some modifications to the code of the plane spotter sketch. But My programming skills are not that good. Can you make a branch version with the changes needed?

        I can see the loading of the plane’s is smoother, they are being plotted without the map.

        Keep up the good work. 🙂

  2. Hello. I collected a weather station by your code. Why do not I see icons? Only the forecast is displayed, but without pictures.

Leave a Reply