Skip to main content

Temperature monitoring using OpenWeatherMap & GLYPH

This guide will help you to set up a Temperature Monitoring system with a GLYPH-C3 that fetches Weather data and retrieve the Current Temperature data for a specified location using the OpenWeatherMap API and display it on the Arduino IDE Serial Monitor. We are doing this using the WiFiManager Library, which provides an easy way to connect the device to a WiFi network without hardcoding credentials or constantly re-uploading new firmware when WiFi settings change.
Note that the WiFiManager Library, as stated in its GitHub Page, only supports certain ESP32 Devices. Currently it only supports GLYPH-C3. Hence, you cannot use other GLYPH boards for this project.
OpenWeatherMap is a popular weather data service that provides a variety of weather information, including current weather, forecasts, historical data, and climate information. It offers APIs that developers can integrate into their applications to retrieve weather data for specific locations. There are some key points to be remembered, they are:
  • API (Application Programming Interface): An API allows different software applications to communicate with each other. In the context of OpenWeatherMap, it lets developers access weather data programmatically.
  • API Key: It is a unique identifier assigned to each user when they sign up for OpenWeatherMap’s services. It acts as a password to authenticate requests to the API, ensuring that the user has permission to access the data.
  • Endpoint: An endpoint is a specific URL within the API that corresponds to a particular function or resource.
Let us consider the example of detecting the Temperature of Bangalore city. The API key inserted in the code below will be different for each user. This API key is also present in OpenWeatherMap. The specific location for which we want to detect the temperature is also selected in OpenWeatherMap.

Step 1: Code Setup

  1. Open Arduino IDE
  2. Install the Necessary Libraries:
Open Arduino IDE and go to Sketch > Include Library > Manage Libraries. Search for and Install the following libraries:
  1. GetOpenWeatherMap API Key:
  • Signup at OpenWeatherMap.
  • After registering, go to the API section and get your API Key.
  • You will use this key to make Authenticated requests to fetch weather data.
  1. Enter the following code into the Arduino IDE

Step 2: Upload the Code

  1. Connect the Board
  • Connect your GLYPH board to your computer
  1. Select the Board and Port Do the following settings in your Arduino IDE, Do the following settings in your Arduino IDE,
    • Tools > Board > esp32 > Pcbcupid GLYPH C3
For the Pcbcupid GLYPH C3 to appear under Tools > Board > esp32, the esp32 board version installed in the Arduino IDE should be greater than or equal to 3.1.0.
  • Tools > Port and select the port connected to your GLYPH.
  • Tools > USB CDC on Boot > Enabled
If USB CDC on BOOT not enabled, you won’t be seeing any serial data on Arduino IDE.
  1. Upload the Code
  • Click the upload button (➡️ icon) or use the shortcut CTRL + U in Arduino IDE to upload the code to the board.

Step 3: Observe the Output on the Serial Monitor

The Serial Monitor should start displaying the Weather Description and Temperature of the Location which has been set in OpenWeatherMap. Battery_charge