Skip to content
Alexandru Cohal edited this page Mar 14, 2021 · 5 revisions

WeatherForecastDisplayer Project Wiki

Weather forecast for 7 days and current (local) weather data displayer using the Arduino Opla IoT Kit.

This project was added to the Arduino Project Hub: link

Detailed Description:

  • The Opla unit running this project can run completely wireless, needing only a WiFi connection and a battery as power source.
  • Weather forecast for 7 days (including the current day) is obtained from http://www.7timer.info (documentation available here: http://www.7timer.info/doc.php). By using GET request and the provided API, the weather forecast data is obtained in JSON format and then parsed.
  • The weather forecast is currently set to the location of the city of Prague (Czech Republic) (50.076° N, 14.438° E). A different location can be used by modifying the used GET request.
  • The weather forecast contains for each day: minimum and maximum temperature, the weather type (e.g. clear, cloudy, partial rain, light snow) and the wind type (e.g. calm, light, moderate).
  • The considered weather types are: clear, partly cloudy, mostly cloudy, cloudy, humid, light rain, occasional showers, isolated showers, rain, light snow, snow, freezing rain. For the exact description (cloud percentage, precipitation rate) of these types, see the documentation from the weather provider which is available here: http://www.7timer.info/doc.php .
  • The considered wind types are: calm, light, moderate, fresh, strong, gale, storm, hurricane. For the wind speeds associated to each of these types, see the documentation from the weather provider which is available here: http://www.7timer.info/doc.php .
  • Together with the weather forecast, the date (i.e. day and month) and the week day are also displayed.
  • The weather forecast and its date are displayed on a blue background. Display - Weather Forecast
  • The current (local) weather data contains: temperature, humidity and pressure.
  • The current (local) weather data is obtained from the temperature, humidity and pressure sensors available on the Opla unit (MKR IoT Carrier).
  • The current (local) weather data is displayed on a green background. Display - Weather Forecast
  • For obtaining the weather forecast data, the Opla unit has to be connected permanently to a WiFi network.
  • The credentials for the WiFi network (i.e. SSID and password) are stored in the arduino_secrets.h file.
  • The WiFi module is set to work in low power mode.
  • The Opla unit can work powered from a battery or through the USB cable.
  • The Touch Buttons 0 (left), 2 (center) and 4 (right) are used for switching the displayed weather foreast to the previous or next day or to the current weather (see more information in the next section).
  • After 10 seconds of inactivity (i.e. no buttons pressed), the weather forecast for the current day will be shown again on the screen (if not already displayed).
  • Every 60 minutes the weather data will be updated by making a new GET request, receiving the response and reading the sensors' data.
  • The updating process is marked with the displayed text "Updating the Weather Data" on a red background. Display - Weather Forecast

How To Use:

  • Clone the repository
  • Add in the arduino_secrets.h file the credentials (i.e. SSID and password) of your WiFi network
  • Upload the code to your Opla unit (i.e. Arduino MKR WiFi 1010)
  • Wait for a couple of seconds for the connection to the WiFi network to be established
  • If the connection was successful, the message "Updating the Weather Data" will be displayed on the Opla unit's screen. Otherwise, the screen will remain black
  • After the updating is done, the weather forecast for the current day is shown on the display
  • By pressing on the Touch Button 0 (i.e. the leftmost one) the weather forecast for the previous day (if possible) will be displayed
  • By pressing on the Touch Button 4 (i.e. the rightmost one) the weather forecast for the next day (if possible) will be displayed
  • By pressing on the Touch Button 2 (i.e. the central one) the current (local) weather data will be displayed
  • After 10 seconds of inactivity, the weather forecast for the current day will be shown again (if not already displayed).

Project Files:

  • wfdOplaNode.ino: The main file of the project. Contains the setup function (which initializes the Serial port, the WiFi module and the MKRIoTCarrier) and the loop functions (in which the periodic update of the weather data is triggered and the status of the buttons is read and some actions are triggered accordingly).
  • arduino_secrets.h: The file which contains the WiFi network credentials (i.e. SSID and password)
  • weatherData.h: The file which contains the declarations of the functions used for getting, processing and displaying the weather data forecast and the current weather data.
  • weatherData.cpp: The file which contains the definitions of the functions used for getting, processing and displaying the weather data forecast and the current weather data.

Future Improvements:

  • The WiFi module is set to work in low power mode but for saving even more power, after a specific time (e.g. 10 minutes) the display can be switched off and only when a touch button is pressed, it will be switched on again. I didn't implement this feature because I would like to see all the time the weather forecast for the current day, without needing to press any button.
  • Some other energy saving optimizations and settings could be found and implemented.