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 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. 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:
WHERE TO BUY
Wemos D1 Board: http://bit.ly/WEMOS_D1
Keypad Display: http://bit.ly/ArduinoKeypadDisplay
Xiaomi Powerbank: http://bit.ly/PowerBank_XiaoMi
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 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.
ArduinoJSON Library: 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.
CODE OF THE PROJECT
SUBSCRIBE ON YOUTUBE
Never miss a video: Subscribe to educ8s.tv