ESP8266 Weather Display

Home/Arduino Projects/ESP8266 Weather Display

ESP8266 Weather Display

ESP8266 Weather Display

In this video we are going to build an ESP8266 Weather display with the impressive Wemos D1 board. The board uses the ESP8266 chip in order to connect to the internet and we are going to program it using the Arduino IDE. The project gets weather data from the website and displays some of the data on the display. As you are going to find out, you can build this project in less then 10 minutes. Let’s start!

A few weeks ago I published a video about the impressive WeMOS D1 board which is an ESP8266 based board which resembles the Arduino Uno. Today we are going to build our first project with it. An ESP8266 Weather Display, using this old LCD display shield I was using with Arduino Uno a long time ago. As you can see, the display works fine with the WeMOS D1 board! The project, connects to my WiFi network, and then it downloads the weather data for my location from the openweathermap website, and prints some of data in the display! It downloads new data for my location every 10 minutes. It is nice project to start with the ESP8266 chip. Let’s see how to build it.

The parts needed in order to build the ESP8266 Weather Display are these:


Wemos D1 Board:

Keypad Display:

Xiaomi Powerbank:

Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!

That’s all. We only need two parts to build this project. The cost of the project is very low. It’s $10! You can find links for both parts in the description of the video. It’s really impressive that we can now build projects with WiFi capabilities very easily and with such a low cost.

All we have to do is to connect the parts together like this and load the code I provide. After a few seconds, the project will connect to the WiFi network and it will get the weather data from the website. So, you can build this project in less than a minute. Great! Let’s now see the code of this project, where the magic happens!

The code of the project is really simple for a project like that. It needs less than 150 lines of code. We use 2 familiar libraries in this project, the ESP8266WiFi library and the LiquidCrystal library for the display. We also need the ArduinoJson library which can be downloaded from this website.



ArduinoJSON Library:

Here’s why we need the ArduinoJson library. When we request weather data from the website, it returns back the data in Json format. Json is a new open data format. The ArduinoJson library makes it really easy to extract the data that we need from the reply of the server and save them in our own variables. Let’s now take a look at the code.

At first we have to set the SSID and the password of our WiFi network. Next we have to enter the free APIKEY from website. In order to create your own API key you have to sign up in the website. Getting current weather data and forecast is free but the website offers more options if you are willing to pay some money. Next we have to find the id of our location. Find your location and copy the ID which can be found in the URL of your location. Then enter your city’s id in the CityID variable. Now we are ready to move on.









Never miss a video: Subscribe to



  1. Joel Berman June 13, 2016 at 9:08 pm - Reply

    First, thank you so much for publishing this. I am just starting to learn about Arduino and it is a great getting started project. I ordered the parts, but they have no arrived yet so I am trying to get the program compiled and make some changes. I have run into a problem and it is probably my ignorance. Maybe you could help.

    The problem is that I get an error in the code. The error is

    WiFiWeatherDisplay:25: error: ‘D9’ was not declared in this scope
    LiquidCrystal lcd(D8,D9,D4,D5,D6,D7);

    I have my board set to WeMos R1 D2 & Mini

    I am running the Arduino software 1.6.9

    I believe the call to LiquidCrystal lcd(D8,D9,D4,D5,D6,D7); is to define the pins connected to the LCD Panel. Am I using the wrong library? As I said, I do not have the hardware so cannot check the pin connections.

    Thanks for any answer and thanks for all your hard work.


    • Nick June 17, 2016 at 9:42 am - Reply

      The problem is the I use the Wemos D1 R1 board and you are using the D1 R2. In the second revision they have removed the D9 pin, I don’t know why, that’s why the code does not compile. Please add this line of code at line 3 of the code and please tell if it works this way.

      #define D9 2 // GPIO2 maps to Ardiuno D9


      • Joel Berman June 21, 2016 at 5:20 pm - Reply

        Thanks Nick. I understand now and it will work fine.

  2. Nick June 17, 2016 at 9:49 am - Reply

    I have update the code in order to reflect the changes made on the Wemos D1 R2 board. It should work now. Please check it out. Thanks!

  3. Morten M Wiken June 18, 2016 at 2:10 pm - Reply

    The code in the link is not equal to the code in the video. Could you please link to the correct code?

    • Nick June 20, 2016 at 7:23 am - Reply

      Sorry for the mistake. It is now fixed!

  4. peter June 18, 2016 at 6:10 pm - Reply

    hello nick,

    i have downloaded your code, but i is not the same as in the video. I tried to copy the code from your video, but the video stopped at line 111. so i don’t know what the rest of the code is,

    please can you update the code, so i can give it a try,



    • Nick June 20, 2016 at 7:23 am - Reply

      Sorry for the mistake. It is now fixed!

  5. Kenjutsu June 19, 2016 at 2:29 pm - Reply

    Hi. The downloaded code does not match that shown in the video. It contains no reference to or ArduinoJson 🙁

    • Nick June 20, 2016 at 7:23 am - Reply

      Sorry for the mistake. It is now fixed!

      • Kenjutsu June 20, 2016 at 1:13 pm - Reply

        Thank you, and keep up the awesome work 🙂 Any plans on getting a Wemos D1 Mini?

        • Nick June 21, 2016 at 5:12 am - Reply

          Already got one! Review is coming soon!

          • Kenjutsu June 21, 2016 at 12:56 pm


  6. Morten M Wiken June 27, 2016 at 5:31 pm - Reply

    I am thinking about using this code for showing several locations on the display. Would this be difficult?

  7. Yahaya July 2, 2016 at 11:57 am - Reply

    Thanks for this rear opportunity of educating us on the wemos; i’m new to it though i have bought Wemos D1,i have series of problem to resolve:

    1. after the installation of arduino IDE 1.6.9 and update of Wemos to reflect on the tools i discovered that the system did not detect my serial com of the D1 despite installation of CH341SER successful. that is my major problem right now i picked Wemos D1(retired) since there is no Wemos D1 on the tools.

    Many thanks for your great assistant.

  8. Mike August 18, 2016 at 3:26 pm - Reply

    Hi , thank you for sharing this project, I am fairly new to arduino and was looking for a way to send data from the dht22 wirelessly to an arduino uno using nRF24L01+ modules and your code was the closest I could get to the components and the librarys I am using I had to make changes to the code to make it work for me, what I would like to know is how to change from Celcius to Fahrenheit? I would be grateful if you could let me know.

    • Nick August 20, 2016 at 6:30 am - Reply

      Use this command instead float f = dht.readTemperature(true);

  9. Mark September 2, 2016 at 2:48 pm - Reply

    Arduino: 1.6.7 (Windows 10), Board: “WeMos D1 R2 & mini, 80 MHz, 921600, 4M (3M SPIFFS)”

    C:\Users\Mark\Downloads\WiFiWeatherDisplay\WiFiWeatherDisplay.ino: In function ‘void loop()’:

    WiFiWeatherDisplay:66: error: ‘displayGettingData’ was not declared in this scope



    WiFiWeatherDisplay:68: error: ‘getWeatherData’ was not declared in this scope



    WiFiWeatherDisplay:72: error: ‘displayWeather’ was not declared in this scope



    WiFiWeatherDisplay:74: error: ‘displayConditions’ was not declared in this scope



    Multiple libraries were found for “LiquidCrystal.h”
    Used: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal
    Not used: C:\Users\Mark\Documents\Arduino\libraries\NewliquidCrystal
    exit status 1
    ‘displayGettingData’ was not declared in this scope

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.

    Hi anybody have a clue why I’m getting this?

  10. Mark September 3, 2016 at 10:48 am - Reply

    Hi ok, got it all compiled now. Display says connected then all goes to dots two lines of.

    Help please.

  11. Mark September 12, 2016 at 2:26 pm - Reply

    Now working as it should. Left out part of the ssid Doh!!

  12. Barry September 21, 2016 at 2:58 pm - Reply

    First, may i add my thanks for all your hard work!

    My DFRobot LCD Keypad Shield is a 5V unit and works well with my arduino UNO, but not with the Wemos R1 D1. Your code puts all the weather info on the Serial Monitor beautifully, but not on the LCD. Is this a voltage problem? Thank you again.

    • Nick September 23, 2016 at 6:47 am - Reply

      I will check the code again I will post another message. Stay tuned!

  13. Barry September 24, 2016 at 2:08 am - Reply

    It’s OK, Nick, I got it working on an I2C-driven 20X4 LCD, using a logic level converter. Therefore, I assume the problem was voltage related. Your code is perfect. Cheers … Barry.

  14. khanfr October 13, 2016 at 6:31 pm - Reply

    i got arduino software 1.6.12 and i got the exact things you have but my lcd shows blank after i upload code…. please update 🙁

    • Nick October 14, 2016 at 7:50 am - Reply

      Yes, I will try it soon.

  15. Mark November 13, 2016 at 9:25 pm - Reply

    Thank you for your post. I was looking for the correct lcd pins, and you saved me a lot of time. Thanks 🙂

  16. Javartiste December 8, 2016 at 11:22 pm - Reply

    THANK YOU ! Spend 2 days trying to parse json data with Http request via Thingspeak and didn’t manage to do it. Your code is so clear, just had to replace no more than 3 or 4 things in order to adapt it! Thanks again, made my day, ahah 😀

  17. Cavlin January 16, 2017 at 2:04 am - Reply

    I get the message after uploading and connecting to wifi

    I get the message
    parseObject() failed

    • Nick February 9, 2017 at 1:13 pm - Reply

      Please update the ArduinoJson library to the latest one.

  18. jackson March 1, 2017 at 8:16 pm - Reply

    thank you for this project first of all,

    my problem is that I cannot get the data to display it self onto the LCD, I am using the DFRobot LCD keypad shield and the wemos D1 R1 board. I also get some random characters in the serial monitor with ‘parseObject() failed’ and then the weather data shows in the serial monitor but not on the LCD. Any help would be greatly appreciated.

    Thanks!! 🙂

    • Wilhelm Onken March 8, 2017 at 4:24 pm - Reply

      I have the same problem as you…

  19. Oliver March 11, 2017 at 1:03 am - Reply

    what ssid and password should i use?

  20. basma May 1, 2017 at 11:35 pm - Reply

    I’M new please help
    im having problem too
    can you show us where to add the library
    and which board I select from IDE

    Build options changed, rebuilding all
    error: ESP8266WiFi.h: No such file or directory



    compilation terminated.

    exit status 1
    Error compiling for board Arduino Uno WiFi.

    • Nick May 3, 2017 at 10:02 am - Reply

      You need to install the EPS8266 files for the Arduino IDE. You are compiling for the Arduino Uno Wifi and not for an ESP8266 board.

  21. Stephen Stocker September 11, 2017 at 6:46 am - Reply

    When trying to upload the code I get the following error

    An error occurred while uploading the sketch
    esptool v0.4.9 – (c) 2014 Ch. Klippel
    setting board to nodemcu
    setting baudrate from 115200 to 921600
    setting port from /dev/ttyUSB0 to /dev/ttyUSB0
    setting address from 0x00000000 to 0x00000000
    opening port /dev/ttyUSB0 at 921600
    error: cannot access /dev/ttyUSB0

    error: espcomm_open failed
    error: espcomm_upload_mem failed

    any suggestions?

  22. Palingenesis December 22, 2017 at 12:08 am - Reply

    This sorted a few pin issues for me. (cheep china version)

    Notice where D0 to D8 are.

  23. aar December 22, 2017 at 1:51 pm - Reply

    hi all,
    i have a problem with wemos d1 r2 connecting wire, read and write SD card-RTC data logger from Deek Robot .. it monitor always show “SD card failed”.
    would u give some execise with it, please?
    thank you very much

  24. Chris Khik January 24, 2018 at 3:44 pm - Reply

    Hi Nick,

    Thanks for the code! Although i do have to point out something so that others may not repeat the same mistakes as i did. For anyone using the older WEMOS D1 board you have need to comment out the pin definitions in the code like this:

    //#define D0 3 // GPIO3 maps to Ardiuno D0
    //#define D1 1 // GPIO1 maps to Ardiuno D1
    //#define D2 16 // GPIO16 maps to Ardiuno D2
    //#define D3 5 // GPIO5 maps to Ardiuno D3
    //#define D4 4 // GPIO4 maps to Ardiuno D4
    //#define D5 14 // GPIO14 maps to Ardiuno D5
    //#define D6 12 // GPIO12 maps to Ardiuno D6
    //#define D7 13 // GPIO13 maps to Ardiuno D7
    //#define D8 0 // GPIO0 maps to Ardiuno D8
    //#define D9 2 // GPIO2 maps to Ardiuno D9
    //#define D10 15 // GPIO15 maps to Ardiuno D10

    Else you will not be getting any text displayed on the LCD.
    Additionally if your lcd is show showing any “boxes” i.e. just blanks, use a screwdriver and turn the potetiometer on the lcd clockwise until you see the text. Initially i thought my lcd shield was faulty but i tried it on my UNO running a sample code under “Example use of LiquidCrystal library” from which proves it was working fine.

    Good Luck and cheers!

Leave A Comment