I was browsing the local Habitat For Humanity Restore (they recycle and resell building materials) for another project and stumbled across these awesome lanterns. They are old kerosene lamps - which meant plenty of room in the base for electronics. I immediately thought of the WS2812B LED arrays I had coming and picked them up before anyone else could grab them. ($10 a piece! A quick look online shows them selling for $80-$150 per from collectors!).
After some fiddling, I decided to use the 24 LED circle array, and found that it sit nearly perfectly inside the glass globe. I threw together a quick prototype using a MakeyMakey (Atmega32u4) I had lying around and stuffed the LED ring in to the glass with some white paper for diffusion. I used the Adafruit Neopixel Strand test demo library just to see how it would look - and I was very happy with the results.
I decided I wanted to have a simple switch for power, and push button to cycle between modes. I also wanted it to be battery powered. I didn't want to use an entire Arduino for this project, so I grabbed an ATtiny85 - which looked like it would suite my needs perfectly - 5v/8Mhz is plenty to drive the LEDs, and at those speeds it doesn't require an external clock or any other hardware.
For the program, I settled on using the FastLED library over the Adafruit Neopixel library because it let me set up several color palettes using very little memory, and with only 8Kb of memory for a program I was going to need every byte.
The code was a challenge for me - this was the first time I've worked with addressable RGB LEDs, and this was the first time I'd had to write code that was constrained to 8Kb. My initial attempt on the MakeyMakey clocked in at around 12Kb - and after much trimming and optimizing (though admittedly I imagine it could get smaller) I manged to get it down to 8,126 bytes - just under the 8.192 bytes I had available using 6 different 16 bit color palettes, along with software debounce and variable delays in the color changes.
You can see my final code on Github - RGB Lantern
After getting the program down to size and loaded on the ATtiny85 - I prototyped the circuit on a breadboard and ensured that everything worked.
Fritzing Sketch of the breadboard layout |
I was hesitant to drill in to the lantern at all - but looking closely I noticed there was a notch cut in the frame just below the glass that was the perfect size for the switch to sit. I soldered some lamp cord to the switch, applied some heat shrink tubing, and fit it in.
And complete!