Introduction: Weather Alert Light System
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.
Supplies
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) https://www.amazon.com/SSR-25DA-Single-Semi-Conduc...
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
https://www.raspberrypi.org/downloads/noobs/
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.
https://nodered.org/docs/getting-started/raspberry...
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.
- Set up a trigger to run the flow every 5 minutes.
- Query the web data and pass the resulting message to the next step.
- Parse through the message (javascript) and determine if there is a warning, watch, or snow presently.
- 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 https://alerts.weather.gov/ 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. https://openweathermap.org/ To query the data, you'll need to apply for an API key. (https://openweathermap.org/api)
Both openweathermap and the NWS alerts are free to use.
For programming in node-red the base language is javascript. Documentation is here. https://nodered.org/ 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 http://127.0.0.1:1880 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.
Attachments
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!

Participated in the
Indoor Lighting Contest
8 Comments
3 years ago
Love it, Nate! So many applications... especially in my office without a window! :D
3 years ago
A worthy project but with a couple of issues; one of safety with the hardware (or at least proper wiring practice) and the other one concerning the documentation in the article. The potential safety issue has to do with wire color. In North American AC/mains wiring the NEC requires that the "hot" wire will be black or colored while white is reserved for the neutral conductors. The photos show the opposite practice here. The other issue is the schematic. Accepting a traditional (electromagnetic) relay symbol for an SSR, but the indicated wiring is backwards. As drawn the input/control side (the "coils") are connected to the output/load circuit and the relays' output sides (the "contacts") are connected to the input circuits (the computer control output lines.) Totally non-functional.
Reply 3 years ago
Ah, I'm not completely surprised that I got called out on my limited wiring experience. Although my coloring is backwards, it is consistent, and therefore not likely to be a fire risk. I should have checked with the coloring and such. I'll update the schematic to reverse the relay icons so they are adequate. Thanks for noticing.
Reply 3 years ago
I was inspired to
comment by Instructables reference to teachers and classrooms. It's
true that your contraption presents little or no hazard, but kids
should learn good, safe practice. I would recommend any hobbyist
working with "real electricity" (120VAC) wiring read one of
those hardware store basic wiring books.
Incidentally the
"outlets" (AKA "duplex receptacles") are
polarized. The side with the shorter straight slots is for the hot
leads (I didn't look to see whether you got that part right) and as
a reminder the side plate with the connector screws is plated with a
"warm" colored metal (brass or copper), while the side with
the longer straight slots is for the neutral connection, and the
connection plate and screws are plated with "white"
(silvery nickel) metal.
Finally, rather than
sticking with the relay symbols when you are actually using SSRs, I
would suggest a more appropriate symbol. (or perhaps two versions in
case some might prefer to use traditional relays) There are many
different detailed SSR schematic symbols depending on the internal
circuitry (which a hobbyist usually needn't be very concerned with),
but the simplest is just a square with two pairs of numbered
terminals (and for DC-controlled units maybe additionally labeled with "+",
"-", "AC/~", "AC/~" or equivalent as
appropriate.)
Reply 3 years ago
points. I checked the photos, and it turned out your project has
correct polarity for the E outlet, but it's backwards for the B and W
outlets. This (as with many polarity problems) can be easily fixed
by moving a few wires around. Correct polarity is especially
important for traditional lamps with screw base "Edison"
bulb sockets, because the "shell" part (with the screw
threads, including the base of the bulb itself) can be pretty close
to human fingers and if not correctly configured, may remain
energized even when the lamp is off, which is especially hazardous
when unscrewing a bulb. The saving grace is that people don't
usually have their other hand touching a grounded surface when
touching dangerous parts of the lamp (although what bare feet are in
contact with may be more problematic!)
BTW You correctly
identified the incoming wire colors in the "international-style"
power cord: brown = hot, blue = neutral, and green (of course) is the
"equipment grounding conductor."
Here is a basic site
about wiring receptacles:
https://www.do-it-your
self-help.com/receptacle-outlet-wiring-diagrams.html
And here is an
beautiful, 2-part instructable on lamp and plug wiring:
https://www.instructables.com/lesson/Wiring-Sockets/
Reply 3 years ago
Thanks very much for the constructive help. I'll spend some time today updating my image notes, and I'm hoping to rewire and update the pictures soon. The links will be helpful as I do this better. I'm impressed that you took the time. I agree that with the high voltage we need to use this as an opportunity to be safe and reinforce good wiring practices for any who might take on this project.
3 years ago
Very cool! I can't wait to try it. Thanks for sharing!
3 years ago
Very nicely done! : )