A Magic Lotr Inspired Cape - Lights Up With Weather

About the project

Inspired by "Sting" from Lord of the Rings, the cape lights up with different colors based on incoming weather.

Project info

Items used in this project

Hardware components

Adafruit NeoPixel Ring: WS2812 5050 RGB LED Adafruit NeoPixel Ring: WS2812 5050 RGB LED x 1
Blues Notecard (Cellular) Blues Notecard (Cellular) x 1
Blues Notecarrier F Blues Notecarrier F x 1
Espressif ESP32 Espressif ESP32 x 1

Software apps and online services

Arduino IDE Arduino IDE

Story

An Unexpected Journey

In The Lord of the Rings, there is a short sword called "Sting" that famously lights up blue when orcs are around. Since I have disappointingly few orcs in my area and Sting has been made by many makers, I decided to look elsewhere for something cool to make. Since capes are a part of the Lord of the Rings wardrobe, I decided to put together a cape with the same breed of magic as Sting. Instead of orcs, it will glow based on what weather is coming in!

The Desolation of My Brain

Here's the plan. We're using open weather map's api to fetch the weather data. We're getting it via Blues Wireless, because it'd be kinda lame to have a magic cape that can only work on wifi. This allows us to go anywhere we want and have it just work. To that end, I still have the global notecard from the previous project I did with Blues (the AI Tour Guide), so it truly can work anywhere. The notecarrier I'm using is the Notecarrier-F.

To do this is fairly straightforward. To make api calls within Blues, you just setup a route. When you click New Route, select Proxy for Notecard Web Requests.

Setup a route for weather data within Blues and fill in the blanks as seen below. If you're using the code I provide for arduino, use the following for the URL: https://api.openweathermap.org/data/3.0/onecall?lat=[.body.lat]&lon=[.body.lon]&exclude=current, hourly, daily, alerts&appid= (your open weather map api key here)

As far as what we do with the data - we check for what weather is forecasted for 15 minutes out. That way we are giving somewhat of a heads up and not just telling people what weather is currently happening. We have different colors setup to represent different types of weather, which I tried to make as intuitive as possible. Yellow for sunny days, blue for rain, etc.

Here is the pinout for how to setup the hardware, below. This is for an ESP32.

D21 → Notecard SDA

D22 → Notecard SCL

GPIO 5 → (through a 220 Ω resistor) → LED strip Data In

5 V Supply → LED strip 5 V

GND → LED strip GND

You'd think that after working with the various technologies involved I'd be well versed at getting this all to work correctly. But, all Hollywood movies make sure to include surprising hurdles, and thankfully my code decided to do the same. One part of the issue seemed to be that my esp32 wasn't providing enough power to the Notecarrier (I think, anyway). Either coincidentally or due to the change, I separately powered the Notecarrier and it worked better. They operate on low power, but since we're powering a full led strip directly from the esp32, I think it may have been giving the Notecarrier the short end of the stick and causing some issues. For the hardware setup of this project in general, this is easy to do since I have a power bank that I can easily split and have power the esp32 and Notecarrier directly.

I had a couple issues with processing the data as well. I tried to get fancy with the passing of coordinates but decided to make things easy on myself and tweaked the url to accept coordinates passed through the body of the message we send. We first just make a simple call and get the coordinates, also through Blues, before making the weather api call. The other issue stemmed from the massive amount of data coming in, which caused a couple different types of issues. The main fix for this was just further adjusting what data we exclude when we make the api call. Easy fix for a confusing set of errors!

For those following along, everything should be resolved at this point where it'll just work right away. At this point everything is working.

The Battle of the Clear Skies

The weather lately has been crazy. We've gotten everything from snow, rain, fog, etc... Until I finished putting together this project. It has since been clear and sunny, so the cape's coloration is just sitting on yellow (the color for clear skies). To prove it worked, I found that it was raining in Quebec and hardcoded those coordinates as a test. It showed misty and then after a minute updated to full on rain, showing that it does indeed work like it's supposed to.

The Fellowship of Capes and LEDs

Now that all the electronics are working, it's time to merge cape and nerdiness (which, maybe some could argue the cape fits in there already) and get the magic cape online.

After taking a moment to situate, the weather checks started fetching good data and the cape turned yellow, to indicate clear skies.

The Return of the Glowy Cape

While led's are clearly visible whenever, it's always most fun to don light-up attire when it gets dark. So, come nightfall, I put on the cape and found that it was, indeed, more clear skies coming in. Thank you, magic cape!

With that I have the most magical cape I've ever owned. Hope you enjoyed! I like making stuff like this so feel free to drop some ideas on me, or share any enhancements you make to this project! Have a good one.

Code

generified_weather_esp32

This is the full program that will fetch the weather info with blues and illuminate the cape!

Credits

Photo of donutsorelse

donutsorelse

I like to make stuff and make something different every week!

   

Leave your feedback...