One of the promotional things that Linden Lab gives away is a small colour changing, glowing cube. Last year, we attended a job fair were we gave several away. One of the people who received one decided to hack his cube and made a Gmail notifier.
I decided to copy the hack, bought myself an Arduino, and set about hacking the cube. I went for a slight improvement where I individually wired each LED. This means that using the PWM from the Arduino I was able to set the colour of the cube to whatever I chose.
The main problem with this hack was the physical size of the Arduino. It’s too large to fit inside the cube. I could have attempted to use one of the smaller Arduino variants, but it would have been a bit pricey, costing about £30 for the Mini and the USB adapter.
I’d recently discovered AVR USB, which implements, USB in software, for any AVR microcontroller. USB needs two wires and I needed another 3 to control my LEDs, so even the smallest microcontroller would be enough and it doesn’t even need a crystal. AVR USB needs at least 2K of flash memory. There is an example project, EasyLogger, that uses ATTiny45 so that’s what I’ll use too.
The EasyLogger project is a good starting point, but I’m going to make some changes. First, I want to control the LEDs, so I replace the input voltage and start switch with a resistor LED pair.
USB uses 2.8-3.6V for high on the data pair but provides 5V for power. Since I’m going to be powering the ATTiny from the USB I need a way to make the outputs deliver the lower voltage. The EasyLogger project uses Zener diodes to provide level conversion, but unfortunately, I don’t have any Zener diodes.
The AVR USB provides an alternative suggestions of using a 3.3V voltage regulator for reducing the power (which again I don’t have any of) or a cheaper alternative, using a pair of normal diodes. Each diode has a drop of 0.7V so the pair drops the power voltage to 3.6V.
Here is the first prototype circuit on my bread board.
I’ll describe the code for the firmware and driver in later blog posts.