$USD
  • EUR€
  • £GBP
  • $USD
PROJECTS ESP8266

Arduino ESP8266 Project: WiFi Weather display using a Wemos D1 board

DFRobot May 09 2018 516

In this video we are going to build a WiFi Weather display with the impressive Wemos D1 board.

he 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 openweathermap.org 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. A 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.

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 to 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 openweathermap.org 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 ESP8266 WiFi library and the LiquidCrystal library for the display. We also need the Arduino Json library which can be downloaded from this website. 
--------------------
LIBRARIES
--------------------
https://github.com/bblanchon/ArduinoJson
Here's why we need the ArduinoJson library. When we request weather data from the openweathermap.org 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 operweathermap.org 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. 
WHERE TO BUY
--------------------

Dear friends. Welcome to another video. This is Nick from educ8s.tv and today we are going to build this Wi Fi weather display which displays weather data from the openweathermap website. Without any further delay, let’s get started. A few weeks ago, I published a video about the impressive Wemos mini board which is an ESP8266 board which resembles the Arduino Uno. Today we are going to build our first project with it. A 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 Wi Fi network and then it downloads the weather data for my location from the open weather map website and prints some of the data in the display. It downloads new data from my location every 10 minutes. It is a nice project to start with the ESP8266 chip. Let’s see how to build it. The parts needed in order to build this project are these:

A Wemos D1 board

A 16x2 LCD display shield

That’s all. We only need two parts to build this project. The cost of this project is very low. Its only $10. You can find links of both parts in the description of the video. It’s really impressive that we can now build projects with Wi Fi capabilities very easily and with such a low cost. All we have to do is connect the parts together like this and load the code I provide. After a few seconds the project will connect together to the Wi Fi network and it will get the weather data from the openweathermap.Org website. So you can build this project in less than a minute.

Great. Now let’s see the code of the project where the magic happens. The code of this 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 ESP8266 Wi Fi library and the Liquid crystal library for the display. We also need the Arduino JSON library which can be downloaded from this website.

You can find the link for this library in the description of the video. The library is really a gem. To develop of this library; Benoit Blanchon has put a huge amount of time and effort into developing this open source library. I happily donated a small amount to him because his library makes our lives so much easier. I think we have to help the developers who help the community move forward. Here’s why we need the Arduino JSON library. When we request weather data from the openweathermap.org website, it returns back the data in JSON format.

JSON is a new open data format. The Arduino JSON 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 Wi Fi network. Next we have to enter the free AP key from openweathermap.org 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 city ID variable. Now we are ready to move on. At first we connect to the Wi Fi network. Then we request weather data from the server. We get a reply from the weather data in JSON format. Before sending the data to the JSON library, I manually delete some characters that were causing me problems. Then the JSON library takes over and we can easily save the data that we need in variables.

We have to take a look at the structure of the JSON data that the openweathermap website replies to see how to get the data we are interested in. After we have saved the data in variables, all we have to do is display them in the screen and wait for 10 minutes before requesting new data from the server. That’s all. As always, you can find the code of the project in a link of the description of the video. As demonstrated, by this project it is now extremely easy and very inexpensive to build projects that can connect to the internet.

With the use of the available hardware, we can build internet connected devices in minutes. With the help of the available libraries, we can program our internet connected devices in a matter of hours, it’s amazing what a maker can achieve nowadays. I will work more on this project of course to add more functionality and a big color tft display. 


This video is made by educ8s.tv, click here to see the original youtube video.

REVIEW