This was a gift for my two year old nephew. Since he is a fan of lights and buttons, I wanted to make something blinky for him to enjoy. The concept was simple: make a clear box with buttons and lights that would change color and pattern based on the buttons that were pressed.
First, I had to find a clear acrylic box large enough for some LEDs, switches, buttons and a microcontroller. I found this great polycarbonate box from Hammond Manufacturing that seemed to be the right size. Next, I needed to find some buttons that could take a beating. Fortunately, Adafruit sells some translucent arcade buttons in bright colors. The lighting was a no-brainer as I am a huge fan of Adafruit’s addressable LED strips. I also found a glowy on/off switch for the power. Somewhere along the way, I thought it would be a cool idea to add a rotary knob so that he could select different blinking patterns.
The next step was to assemble the pieces and wire everything together. The polycarbonate box was harder to work with than I had hoped. The polycarbonate would discolor if I used the laser cutter, so I found myself drilling all of the holes with a rotary tool. I then added the buttons, knob and on/off switch.
Once all of the bits were together, I had to add a microcontroller to control the button states and light transitions. I decided to go with the Teensy 3 as it was what I had on hand (and I had yet to work with one). Also, Teensy 3 allows all digital pins to be interrupted (as opposed to four on the Teensy 2), which would simplify reading the button state. The other great reason for selecting the Teensy is that it already has an Encoder library, which makes reading the knob state simple.
The code was easy. Interrupts on the arcade buttons would change a variable representing the color. The interrupt for the black button would kick off a rainbow display routine. In the main loop, I polled for changes in the rotary encoder state and transitioned the lights accordingly. When I was finished, there were five main light colors (white, red, yellow, green and blue), one rainbow routine and six possible blink patterns (always on, fade on/off, blink on/off, chasing light, random twinkling lights and alternating lights).
I saved the hardest part for last: power. I wanted something that my nephew couldn’t disturb, so anything outside of the box was out of the question. Regular batteries would require opening the box to change, so I thought something rechargeable would work better. I decided to go with a Lithium Ion battery. Unfortunately, these are generally around 3.7 volts and the LED strips require 5 volts. This meant that I needed to find a way to recharge the battery from the outside and find a way to step up the voltage. Fortunately, SparkFun sells a power cell board that does both. Yay!
I added a power jack to the box and used an old 5 volt AC adapter to supply the charging power. I then connected the power cell board and the battery using this handy tutorial. Fortunately, the charging of the battery seemed to work! Unfortunately, the power cell board only provides 600 milliamps at 5 volts, which is not enough power to run a full meter of the LED strip. Sadly, I had to cut the strip in half. It was still impressive even with just one loop of lights! To make the battery last even longer, I also implemented some of the suggestions for conserving power with the Teensy.
The best part about this toy is that it is fully programmable. As he gets older, I can program new features or games into it. Perhaps one day, I can even teach him to program it himself! đ
Here is a short video of the assembled box
Hello. I am curious if you have time for a small text based chat. I’d like to ask you some questions about your creation so that I can write a better article on it
I love this! I’m going to make one for my daughter.
Though I have a question, how did you mount the battery and other bits to the inside of the box?
Thanks!
Hi Doug! The answer is that I didn’t! I thought about gluing the parts in, but decided against it as it would make adding new items to the box a little harder. I also wanted the inside to look a bit raw so that my nephew could see which bits were separate and connected by wire. Hope this helps!
I finished it! She loves it:
http://i.imgur.com/tplXDj9l.jpg
I used a plain Attiny84 chip so I had to make some changes to the code:
https://github.com/dmcinnes/BlinkyBox
Thanks again for the idea!
Awesome! Love it!
Thank you very much for this awesome idea! I made a Blinkybox for my son for his birthday. That was last Monday and he loved it. A couple of comments: I had to solder together a simple de-bounce circuit on the rotary knob for it to work reliable. As micro processor I used a Teensy as well, but the disadvantage there is that the Teensy 3.0 works at 3.3V whereas the LED strip works at 5V. That is not a problem for the power supply (the Teensy takes 5V), but I had to convert the DATA and CLK from the Teensy to the LED strip from 3.3V to 5V. Finally on the power supply: I live in Germany and it is hard to get the parts you used here. So instead I bought an Iphone charger battery on Amazon and used that as battery. There are a couple available that have screws on the casing. That allows you to rewire the On/Off switch to the front of the Plexiglass casing. This turned out to be a low cost solution and I can charge with a simple 5V USB. Once more, thanks for sharing this project on your blog!
Yay! It makes me so happy to see people make their own special versions of this project to inspire and delight the younger generation. I would love to see a picture if you have one!
Do you have a link to the charger you used? I have another project I am working on and it would be great to see an alternate power solution. As for the data/clock for the LED strips, I didn’t use a level converter for the LED strips and I didn’t seem to have any problems. Your mileage may vary đ
I just took a picture of the BlinkyBox
http://www.arduinosynth.com/BlinkyBox/Blinkyboxsmall.jpg
There were actually a few more changes I forgot to mention in my first post: I put on two rotary knobs, one for the blink-mode and one for the speed. The casing that you used unfortunately did not work for me. The reason for that is that in Europe it is really hard to get by the knobs you used. After a massive amount of searching I was able to find 5 out of the 6 colors, but could nowhere find the black button. The ones that I did find are a lot longer and therefore dont fit into the Hammond box. I could not really find taller boxes so ended up making my own instead. One last change is that I added a mode that reacts to sound. To do so I added an audio envelope detector. Unfortunately the microphone I used for the circuitry was so noisy that inside the casing you have to shout really loud for the lights to show up, but it turned out a very nice “drum-detector”. So in the Audio mode you can drum on the BlinkyBox and the lights will blink along. If I have the time to make a youtube video I will send you a link.
The battery pack I used is this one:
http://www.amazon.de/dp/B009KI6NU4/ref=pe_386171_37038021_pe_217221_31005211_M3T1_dp_1
It is a bit of an overkill though: I used a 1m LED strip and the BlinkyBox can work for hours (havent measured exactly how many hours though). For the rewiring of the On/Off switch the pack needs to be opened. This can relatively easy be done: There are four tiny screws and in addition the lid is glued to the battery pack. With a WOODEN ruler the lid can carefully be removed (please dont use sharp or metal tools inside a battery pack đ There is one more thing to consider with this battery pack. It requires a minimum power draw of ~100mA. So where you had to minimize power consumption there are some configurations (in case only one LED at a time is lid) where I had to increase the power consumption. I realized that with a couple of simple transistors and ~100 Ohm load each.
Good luck with your next project. Let me know if this battery pack works for you!
Hello, that’s an awesome project. I will try to build this too, for my daughter.
Where did you get the black button?
I bought mine from focusattack.com. They have a wide selection of colors and sizes as well as light kits that can go inside the buttons.
Hi Miria,
Love the creativity and design, thank you for sharing! I’m a DIY guy, but have never done programming. I have some help if I need it, but was wondering if I could email you a few questions as I begin to order parts and get ready to tackle this project on my own? Last post I see here was over a year ago… guess we’ll see if this is still active?
Thanks Miria for creating this great project. I have played with the code and got it working with WS2812B LED strips on an Arduino Nano.
Dropped the brightness down which enabled me to use the whole 1m strip which I looped around the box. For power, I butchered an old powerbank. Using this made it easy to supply the 5v and be able to charge it easily with a microusb 5V supply.
You can read more about it on my site:
http://www.simonlaw.com.au/electronics/blinky-box/