Fetching Real-Time National Weather Service (NWS) Alert With ESP8266
by suriono in Circuits > Microcontrollers
95 Views, 2 Favorites, 0 Comments
Fetching Real-Time National Weather Service (NWS) Alert With ESP8266
The devastating Texas floods of 2025 served as the primary catalyst for this project. On July 4, 2025, destructive and deadly flooding took place in the Hill Country region of the U.S. state of Texas. During the flooding, water levels along the Guadalupe River rose rapidly, up to 18 inches in hours, caused the river to rise 26 feet in 45 minutes. As a result, at least 135 people were killed including 27 girls from Camp Mystic. In total, the NWS issued 22 alerts of escalating severity for the area. No alerts were issued, however, by local government officials, despite their reliant on NWS (National Weather Service) alerts.
Driven by the need for more reliable warnings, I began researching ways to source alerts directly from the NWS. I discovered that their API provides developers with free, real-time access to critical forecasts and observations—a valuable public service funded by U.S. taxpayers that is perfect for this kind of stand-alone low cost automation.
This tutorial demonstrates the core process of fetching NWS alerts. Though this prototype uses an LED display, the project is designed to be scalable; you can easily modify it to activate sirens, strobe lights, or digital notifications.
The video shows the actual National Weather Service alert issued on March 14, 2026, when Minnesota was hit with 15 inches of snow. As shown, it triggered a ‘Severity: Extreme’ warning.
#CampMystic #TexasFlood2025
Supplies
- ESP8266 IoT Wi-Fi Microcontroller: A versatile, Wi-Fi-enabled board (approx. $1 USD via AliExpress).
- 8x32 LED Matrix: Used as the primary visual display demonstration (approx. $7 USD via AliExpress).
SSL Certificate
For this stand-alone IoT ESP8266 Weather alert system, SSL certificate is vital because NWS API requires an HTTPS (secured) connection. To communicate with the API, the ESP8266 needs to "trust" the NWS server. The code needs to provide a Fingerprint, Public Key, and Root Certificate so your microcontroller can verify that it is talking to the real National Weather Service and not a malicious middleman. In the other word, it is designed to protect your privacy by encrypting the connection and scrambling the data. However the Fingerprint is also designed as SSL "handshake" to prevent malicious bot trying to attack the site and maintain reasonable number of requests (to ensure the stability of the server).
Follow these steps to retrieve the required SSL credentials:
- Open the api.weather.gov website from a browser, I use Chrome for this tutorial.
- Click the circle next to the URL as shown in the first picture:
- Select "Connection is secure".
- Select "Certificate is valid" as shown in the 2nd picture.
- Select "Details" tab as shown in the 3rd picture.
- Select "Serial Number" as shown in the 4th picture.
- Save the value, this the Fingerprint for the SSL credential for later.
- The Fingerprint value in the image has been redacted for my security purposes.
- Scroll down and select Public Key as shown in the 5th picture.
- Save the value, this is the Public Key for the SSL credential for later.
- The Public Key value in the image has been redacted for my security purposes.
- Select "Certificate Signature Value" and click the Export button and save the file.
- The file contains the SSL Root Certificate value for the SSL credential for later.
- Open the file and the content similar to the following lines are the certificate value:
Wiring
- Connect ESP8266 5V to the LED red wire (LED VCC).
- Connect ESP8266 D6 to the LED green wire. This the digital signal.
- Connect ESP8266 G (ground) to LED white wire (ground).
Arduino Codes
- Download my GitHub codes: https://github.com/suriono/MyArduino/tree/master/Neomatrix_Weather_Polar
- Open a browser with URL: https://api.weather.gov/points/{latitude},{longitude}, replace the latitude and longitude with your location.
- Look for the zone codes, like the following:
- Edit the "api_weather.ino" file:
- Replace the following lines in the "get_Weather()" routine with the zone codes:
- String url = "/gridpoints/MPX/109,66/forecast";
- Next look for the county alert zone code, like the following:
- Edit the "api_weather.ino" file:
- Replace the following lines in the "get_Alert_Weather()" routine with the zone code:
- String url = "/alerts/active?zone=MNC053";
- For my security purposes the "password.h" file is not available in my GitHub:
- Create a new "password.h" file in the same folder.
- Add the following lines:
- #define WIFI_SSID <enter your router SSID>
- #define WIFI_PASSWD <enter the router password>
- For my security the "cert.h" file is not available in my GitHub:
- Create a new "cert.h" file in the same folder and add the following lines.
- Substitute the <enter your Fingerprint>, <enter your Public Key>, <enter the certificate value> from the Step 1 above.
- Upload the code using the Arduino IDE to ESP8266. Enjoy.