Close

Introduction...

A project log for Holiday Blinkenlights in 1K for about a buck

Creating interesting graphics on a strand of RGB LEDs using an ATtiny13, with just 64 bytes of RAM and just 1K of flash.

Mark VandeWetteringMark VandeWettering 12/03/2016 at 18:330 Comments

Back in 2011, I bought a simple battery powered strand of LEDS at a local pharmacy. They were powered by a trio of double A batteries, and consisted of two independent strings, one which had red and green, the other which had blue and yellow. But they just well, turned on and off. I thought I could do better. I had just finished my ATtiny13 "blinking pumpkin" project.


And decided that I could use the same basic ideas to implement a set of blinking lights that I could put inside a Santa hat, and wear around to bring Christmas cheer. I documented this in a series of Youtube videos at the time, as well as a blog post where I also shared the (very simple, nearly trivial) code.

http://brainwagon.org/2011/12/05/dissecting-a-set-of-99-battery-powered-christmas-lights/

http://brainwagon.org/2011/12/16/christmas-lights-powered-by-an-attiny13/

http://brainwagon.org/2011/12/18/project-completed-my-99-christmas-led-hat-with-attiny13-controller/

Look, this is kind of a ridiculous thing to do. You can probably find something to do this off the shelf, and with less muss and fuss than it will be to reproduce my project. But this is what I do for fun, so don't judge me!

I pulled my hat out of storage while setting up my Christmas tree this year, and found out that for some reason, one of the strand of LEDs has stopped working. No doubt I just have a bad connection somewhere, and I could fix it easily. But I thought that maybe it would be a good time to revisit this project using the same processor family, but perhaps with some fancier LEDs. Notably, I've been looking for an excuse to order a long strand of RGB addressable LEDs, where each LED's color can be controlled independently. So, a little surfing on amazon.com, and I ordered four meters of RGB LEDs. I also thought it was an excellent opportunity to use the platformio system to highlight how you could do "bare metal" programming that doesn't rely on a lot of Arduino libraries and infrastructure, and thus would allow you to use very small, very resource constrained processors like the 8 pin, ATtiny13. And, I wanted to highlight the excellent technical work of excellent work on NeoPixel timing over at josh.com, which makes it possible to drive these LEDs in just a few hundred bytes of code.

My goal is not so much to deliver firmware that you will download and use without much thought, but rather to use the project to demonstrate some of the thinking that I use to do simple projects like this. That it coincides with the Hackaday 1K code competition is just gravy. Writing small programs for resourced constrained processors is just fun. Blaise Pascal once famously wrote to a friend that he would have written a shorter letter if he had more time. Writing small programs requires the kind of puzzle solving skills that often don't get exercised with longer endeavors. I hope that this project serves to inspire you to consider that using tiny processors to do simple tasks can be fun and rewarding.

As a teaser, here is some (terrible) cell phone video that is as yet unexplained, but will serve to show what is possible. I've only used 25% of the available flash on the chip, with code written in C and some inline assembler, and there is lots more to come. Hope you enjoy!


Discussions