Weather LED Lamp

A hand-built yin-yang beech lamp that grew a clock, a 24-hour rain and temperature forecast, and an AWS Lambda — feature creep in wood and LEDs.

C++ · AWS Lambda · ESP12E · PlatformIO · CNC · WiFi · OpenWeather API · LED Strips

Blame Kjeld

Wired backside of the led lamp

I visited a Kjeld of mine and got to know his programmable led projects. I was amazed and I already love wood working. By now I also love micro controllers & led programming.

The base

Round, laminated piece of beech with 80cm diameter

I found this piece of beech in the hardware store. I instantly thought that it would be great for a yin and yang lamp. With pencil & thread I marked the holes on the sides and the big S in the center and from that line I used a Divider to mark a ~8cm diameter. This will allow for more interesting led placement.

Cutting & polishing

The cut and polished beech board

With a Jigsaw I cut out the rough shapes. I learned that Jigsaws do not like to go in small circles and that beech is a very hard wood that creates very fine dust. A lot of polishing, really a lot had to be done by hand and machine. I corrected imperfections with Chisel & colored wooden paste.

Painting & Oiling

Painting & Oiling - 2 Dark Layers applied

I oiled & painted each side and noticed that the dark paint was not covering well. Due to the different laminated pieces and pre treatment the paint differed in opaqueness and stickyness. I painted the dark side 3 times, scrubbed off most of the paint due to it being unevenly applied and painted it 4 more times. Each time I let it dry for 12-72h based on stickyness. Next time I'll test this first. I turned out fine though.

Mounting led-strips

Mounted led strips on back of lamp

I was unsure of the best way to mount leds as they had to be orthogonally mounted. I wanted a natural and less destructive/permanent solution in case of errors. I decided to drill holes for wooden pins and to use tension to attach the leds. The leds also had a sticky back side which I thought would make attaching them easier but it did not. The led strips were connected using plastics clamps as they looked to be an amazing solution. This worked fine for now but more on this later.

Connecting Power Supply & Micro Controller

Power supply & Esp12e micro-controller on back of lamp

To test the led strips I connected the Micro Controller and ran some single colors. Those micro controller boards are awesome! They support wifi and I can deploy code via WiFi or usb-c to usb cables. They also allow debug output when connected via usb. Which is essentially essential. I noticed a brightness fall off on the leds. This was to be expected as my total led strip length was ~5m and I had a high led density. During soldering & connecting wires I burnt one micro controller and one usb-hub. Kjeld was impressed too!

Wire & Led setup

Diagram of Lamp wires

The power Supply powers the micro controller and both ends of the total led strip to avoid a brightness falloff. The led strips were connected in the shorted way possible and this becomes important when programming them later as individual led are accessed by their sequential position.

Soldering iron, flux paste & copper wool

Solder setup

Kjeld gifted me his old solder setup which I used to solder led-strips to wires & the micro controller. I burnt my soldering iron tip twice but after using it for a few hours I got the hang of it.

Clamps Corrode, Solder Doesn't

Wires soldered to led-strip

Those plastics clamp from earlier tend to corrode and scratch until led strips lose their connection and start to flicker. So I soldered everything. This also took very long but felt very satisfying.

The Forecast Doesn't Fit in RAM

Diagram of micro controller accessing weather api

Since sawing those holes into the beech I thought that it would be great to display some useful information in them. I decided to display a rain forecast in the left circle and a temperature forecast in the right circle. I tried accessing the openweather api directly and noticed that it returns waaaay too much data. The absolute minimum amount of data I could fetch was still greater than the total RAM of the micro-controller.

Serverless to the rescue!

Code of a AWS Lambda minimizing weather api data

On triggering the AWS Lambda it accesses the weather api and filters out unused data. As long as there is no more than 1 request every 15 minutes the free version of the weather api is sufficient. As Json is a bit too inefficient for the micro controller I chose to use an octet stream. It contains all the temperatures for next 24 hours and then boolean values for the next 24 hours to determine whether to expect rain. I tried display a forecast of several days on the lamp but it got too hard to seperate visually so I stuck to 24 hours.

Mapping Led Indices

Configuration of Led-strips positions

To program the led strips I need to know their positions.As they are all connected sequentially I just need to know their individual lengths.

Configuring Color Animations

Configuration of color modes

All led-strips result in 4 formations. The right ring displays the temperature which was fetched from the Aws Lambda & Weather Api. The outer ring / big ring displays the clock time which is provided via Wifi by the modem. The 'S' formation in the center displays some random color animation. The left ring displays the rain forecast which was fetched via lambda & weather api too My touch points with C++ were scarce and so I've spent quite some time fixing color animations. This is mostly just mapping values onto leds, waiting for delays, interpolating some colors and most importantly looping colors along the led strips.

Minimizing weather api data

Code of mapping weather types to 'is rain'

The weather api did not just tell me whether to expect rain or wear a jacket and so I mapped those conditions myself. So now I will wear a jacket when it rains, snows, drizzles or when there is a thunderstorm or tornado Maybe I should add an emergency led-mode for those someday.

Code deployment onto micro controller

Deployment config of pio

I used platformio to deploy code via wifi & usb. This is available as plugin for common Ide's. Based on the type of micro controller I added some boilerplate and just had to click e.g. 'upload'

Lamp off

Completed lamp front - off

It looks quite nice even when turned off It requires one cable for power and has a hidden usb cable for debugging on its edge. It is hung onto the wall using hooks so it can be easily taken off.

Lamp on

Completed lamp front - on

It turns out it is very hard to photograph this lamp. So until I take a better photo you just got to believe me what is being displayed. The blue color on the top is the minutes pointer and the orange pointer on the bottom is the hour pointer. So it is roughly 06:00 or 18:00. The left ring has 4 sections á 6 hours to display orange for dry weather and blue for rainy weather. The right ring displays a color range from purple -> blue -> green -> yellow -> orange -> red that represent temperatures from ~-10 to 40 degrees celsius. Turns out it is warm during the day and cold at night. This was a great on and off project over the last years and I am happy I polished & fine tuned it twice. It now hangs on the wall behind the dinner table and has a button to turn it on.