This project shows how to autoconnect to the internet and get time from an ntp-server pool and weather data from OpenWeatherMap. To get access to the weather data you have to register whereupon you receive a key.
Weather data, time and WiFi connection data are displayed in turn on the display of an ESP32-Shield with 0.96 inch OLED Display / 18650 Lithium Battery / WiFi / Bluetooth.
Thanks to the Arduino library ESPAsyncWiFiManager there is no need to hardcode the WLAN credentials ssid/password in the program. To establish the first connection to your WiFi with ESPAsyncWiFiManager you need only a mobile phone. You connect to the accesspoint AutoConnect, choose the SSID of your WiFi and enter the password.
The goal of this project is to display the connection data of the ESP32-Shield, the time and date received from an ntp-server and the actual weather imnformation for a configured location in a given time zone. These 3 information blocks are displayed in turn for 10 seconds each.
Power consumption : 5V / 50mA on USB or 4V / 70mA on battery (to be considered with caution).
The 3 screens and the according explanations are shown below.
The main program uses the class Owm which gets the weather data and parses the obtained strings into a data structure.
Interested? Please download the entire program code. The zip-file contains the complete PlatformIO project.
My programming environment is not the native Arduino™ IDE but PlatformIO™ on top of Microsoft's Visual Studio Code™. This combination offers many advantages and allows a much better structuring of the code into several modules especially when we adopt The Object Oriented way.