Arduino ESP8266 Project: WiFi Weather display using a Wemos D1 board and operweathermap.org website
Dear friends welcome to another video! This
is Nick from educ8s.tv and today we are going to build this WiFi 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 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. 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 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 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 ESP8266WiFi library and
the LiquidCrystal library for the display. We also need the ArduinoJson library which
can be downloaded from this website. You can find the link for this library in the description
of the video. This library is really a gem. The developer 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 of money to him, because his library makes our life so much easier.
I think that we have to help the developers who help the community move forward.
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. At first we connect to the WiFi Network. Then
we request weather data from the server. We get a reply with 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 to 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 in 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. Stay tuned! I would love to know your thoughts
on this projects. Do you find it useful, and how do you plan to improve it? Please post
your comments or ideas in the comments section below. If this is your first time here, I would love
to have you subscribed. In this channel I post videos about DIY projects every Saturday.
I love making things and I believe that anyone can make things, anyone can become a maker.
That’s why I created this channel, in order to share my knowledge with the community and
learn from the community. I hope you will join us. Until next Saturday, Watch, Learn,
Build! [ Translating these subtitles? Add your name