Introduction: Weather Alert Light System

About: My day job is in web development, but I love all things making and coding.

The weather alert lighting system changes lighting to indicate different weather warnings or watches. This system leverages freely accessible weather data to make a lighting change to indicate weather status. A raspberry pi (via node-red) checks the weather data regularly and turns on a red light when there is severe weather(warning), a yellow light to indicate threatening weather(watch), a snowflake for impending snow, and a regular lamp to signify clear skies.


1- Raspberry pi - 3 or greater - must have GPIO pins

2 - Standard electrical outlets

1 - 4 gang electrical box

1 - Face plate for the electrical box

4 - Solid State Relays (SSR-25DA Solid State Relay Single Phase Semi-Conductor Relay Input 3-32V DC Output 24-380V AC)

Heavy gauge wire for 110V application.

5 - Jump wires to connect to the raspberry pi pins.

4 lamps of different style or color.

Step 1: Install and Setup the Raspberry Pi.

Set up your raspberry pi by installing the noobs package and the raspbian operating system

Follow the directions to get the OS installed to prep for the next step.

Step 2: Install Nodejs and Node Red on the Pi.

Node red has a great instruction set for putting node-red on your raspberry pi.

You'll want to run the commands to have the program auto load on boot. There is some sample code to program node-red in future steps.

NOTE: Node-red is the director used to glue all the pieces together. Node-red is the programming platform that queries the online data sets. Node-red turns on the GPIO pins on the pi to power electrical plugs that turn our lights on and off. Node-red flows manage all the functionality needed.

Step 3: Wire Up the Electrical Plugs and Relays

The raspberry pi triggers relays to allow electricity to flow to one of 4 electrical plugs. Start by noting the low voltage and high voltage parts of the relay. (Note: You can use other relay types, but I like the solid state relays.)

High voltage goes through each relay and into one side of each of the 4 plugs.

On the low voltage side of each relay run a wire to the raspberry pi pin. Run a ground wire from the ground side of the low voltage part of the relay to a ground on the raspberry pi.

BE SURE TO PRACTICE SAFETY MEASURES. Keep the wiring box unplugged until all wiring is safely inside and ONLY THEN plug in the alert light.

Step 4: Program the Pi With Rode-red.

This is likely the trickiest / yet most satisfying part.

The logic steps are as follows.

  1. Set up a trigger to run the flow every 5 minutes.
  2. Query the web data and pass the resulting message to the next step.
  3. Parse through the message (javascript) and determine if there is a warning, watch, or snow presently.
  4. Set the GPIO pin to high(on) for the appropriate weather message set the GPIO pin to low(off) for lights that should be turned off.

Attached is some sample code (flows.txt) that you can import into node-red. Some adjustments to the flows will be required, including selecting the appropriate state data feed and entering the desired county name. (Sorry I don't have code supporting non-US locations.)

Find weather alerts at for your state, and enter the url for the rss feed of your state.

The flow that checks for snowfall is part of open weather map. To query the data, you'll need to apply for an API key. (

Both openweathermap and the NWS alerts are free to use.

For programming in node-red the base language is javascript. Documentation is here. The flow based programming means you don't have to be a javascript master to leverage node-red.

Open the node-red flow editor using the browser on your pi at The flow editor has an import feature to load the sample code.

The attached code file points to the following GPIO pins. It uses 35-38, and the ground right next to them. You can see this in the wiring pictures. Pin 36 is the warning level I have a red light plugged in there. Pin 35 is watch level, and I have an orange light plugged in there. Pin 38 is the snow indicator, and Pin 37 is the all clear outlet. If you use different pins, you'll need to modify the node red flow to change those.

Step 5: Plug Lights Into the System and Test

Almost there. Have fun finding lamps that will help set the tone for warnings and alerts. I found some fun old Christmas lights, and a weird red light at the thrift store. I put an orange light bulb into an old lamp.

I had to do a little adjustments of my GPIO pins because I had them lighting the wrong plugs, but changing pins on the pi is easy to fix my mistakes.

The node red flows power every plug when first started, so you can tell if the wiring is correct without a thunderstorm.

Step 6: Other Uses for the Light Alert System

The light alert system is fun for weather data, but there are many sources you might consider using where you might like an alert. Earthquake data, traffic data, NASA data, system status data, are some possible examples. Node-red does a good job of querying data available on the web and kicking off reactions to what it finds. At my job I have the system pointing to our system monitoring API, so I know when an important system is having problems.

Leveraging your creativity and web data there are many ways to expand on this idea.

Have fun!

Indoor Lighting Contest

Participated in the
Indoor Lighting Contest