Filed under: Arduino, ATTiny45, Electronics, Prototyping | Tags: Arduino, attiny, ATTiny45, AVR, hack, hardware, rgb, usb, usbtiny
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.

Arduino and Cube
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.

ATTiny45
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.

Breadboard prototype
I’ll describe the code for the firmware and driver in later blog posts.
A friend of mine, Simon, has recently purchased an Arduino. He asked me, “how do I get started?”. Here is a list of the things that I’d recommend you purchase and why.
LEDs

Probably the simplest output indicator you can get: the LED. You can place the LEDs directly into the Arduino, as in the Blink tutorial. They provide a simple mechanism of getting information from the Arduino to you. With the Arduino’s 13 digital outputs can drive 13 LEDs. This number can be increased using components, such as, Shift Registers or techniques like charlieplexing.
Resistors
LEDs usually have a maximum voltage of ~2V. The Arduino’s outputs are 5v. For an Arduino to be able to power an LED the voltage must be reduced to by 3V. The simplest component to do this is a resistor. To figure out which values of resistor you will need, you can, use this helpful calculator. Make sure you get ~1/4W resistors as higher wattage means bigger components!
Breadboard

When you start to make circuits more complex than Blink, you will need something to prototype circuits on. A breadboard is a a solderless way of prototyping, which can be quickly put together and reused an unlimited number of times. Depending on the type, breadboards usually have horizontal strips, a gap in the middle for DIL components, such as ICs, and a pair of power lines marked on the sides. I only have two types of board, both are small, as I don’t make very complex circuits.
Wire & cutters/strippers

You can get quite far using the component leads to prototype, but its likely you are going to want to make connections from place to place, either from Arduino to breadboard or between components on the breadboard. To use wire with breadboard it needs to be solid core. To strip and cut wire, I just use a small pair of sharp side cutters.
Buttons

Although the above button has bent legs, they can easily be straightened to fit into a breadboard. Some electronics tutorials will tell you you require ‘pull-down’ resistors to use with the switch but this is not the case for the Arduino, as it has built in resistors, that can be turned on from software. It may still be worth getting a few 10K resistors to use with your switches.
What can I do with this stuff?
There is a good introduction to Arduino on Ladyada, where you will use need the stuff above to get started. In addition, I’ve made several different projects using just the above components, including, a POV Toy, an email notifier and a colour changing light.
Where next?
When you’ve finished with this stuff, you’ll probably want to look a different kinds of sensor. You can get a huge array of different types, such as temperature, light, acceleration or even blood alcohol content! For most simple sensors, you can use the Arduino’s analog inputs, for more complicated things you might have to use a number of digital pins or possibly I2C or SPI. There is a lot to learn about sensors, but that probably another blog post.
Filed under: Uncategorized
My first blog. Let’s see if I ever use it.
It will probably be mostly programming and hardware hacking.
Recent projects I might write up include:
- AVR prototype parts
- Rock Band pedal Arduino
- Caps locker device