Weather Forecasting on ESP32
In any power utility corporation ash dyke management is a huge issue. For fugitive dust control huge sprinklers that spray water all along the dry portion of the dyke are used but maintenance of these sprinklers is a problem as we really don’t have any idea when it’s going to rain or when it will be windy. So the operators in such corporations were demanding for a weather forecasting terminal to overcome this issue easily.
While a $600 laptop is enough to get data from openweather.org to have an idea when it’s going to be rainy or windy, the more better option was an ESP32 which would do the same job pretty well and that too at a fraction of cost.
One might think a better option is a simple google search, but Internet also repletes with weather servers. Finding the site, signing in and then get weather data is also hectic. Some provide data in plain http output while others prove in json or xml format. Almost all sites provide free data for few days but for more data or for archive data one needs to sign-in and buy eventually.
Of all the data servers openweathermap.org is one of the most user friendly and easy to put into ESP32. They provide data in json. The Arduino has a json library which is pretty good enough to decode data from json.
Step 1: Go to openweathermap.org
Step 2: Do a sign-in and find your city code from the site.
Step 3: The site will provide an API key.
Step 4: Use this API key in the Arduino code to get json streaming data.
The simple HTTP string is supplied by the ESP32 which is received through GET protocol. The data is then processed through json, segregated and reprinted on a TFT ILI9341 screen link.
We have used a cheap DS3231 real-time clock to keep track of time. The DS3231 is better than most other RTC as it has an inbuilt precision temperature correction to take care of the quartz frequency correction over a very long time drift. For display, we have used TFT ILI9341 2.5”X2.0” display. The site provides free data for 5 days at a time. So much data cannot be placed on one screen, therefore, we have placed the data in two screenshots with a time division of approximately one minute each.
Schematic is very simple and straightforward. For construction, use a small double sided Vero board.
The json library & sketch is attached
City codes are like the ones given below. You can also enter the exact GPS position of your city. The full city guide is also country_code for your ready references.
While the ESP32 based display is perfectly alright to use in place of the laptop, the laptop is not removed from the site. The maximum and minimum temperature is not very precise at times but the mean temperature, wind and cloud condition is perfectly right and helps to take maintenance of these sprinkler systems.
Download Source Folder
Read More Detail :Weather Forecasting on ESP32
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w
This Post / Project can also be found using search terms:
- weather forecasting project