This week’s Homemade Hardware assignment is to do something interesting with an ATtiny. I have decided to make a useless light toy thing.

Uploading code to an ATTiny is slightly more involved than to something like an Uno. Fortunately we can use an Uno as an uploading interface (as described on the class site). You can do this with a breadboard and jumpers, but it’s helpful and repeatable to use a programming jig. Here’s mine:

I scrounged the junk shelf for some inspiration and found a film container. It looks like a nice diffuse material and is small enough to offer a challenge to put something interesting inside. It fits just enough PCB for an ATTiny plus a Sparkfun accelerometer breakout.

With the component parts in place I got to work figuring out what this useless toy thing would do. With an accelerometer I can know which direction is down. The film can has a natural ‘rollability’ to it, so I figured the fun little playful characteristic of this thing could be that its lights always point one way when you’re rolling it.

Fun fact: a neopixel strip can bend in on itself to become… a neopixel circle!

Tom Igoe told me specifically that I’d fail Light and Interactivity if I brought in a rainbow LED project, so I’ve chosen to get all my rainbow LED kicks in this class.

Two accelerometer axes (x and y) with some throwbacks to highschool geometry (arctan2), and a little bit of filtering (SimpleKalman) provided the code necessary to calculate down. Here’s a graph of the sensor readings.

Yellow and Dark Blue indicate raw X/Y accelerometer data. Red shows arctan2 (i.e. angle from x axis) of that data, Light Blue shows filtered and scaled angle.

After getting the interaction right okayish, the rest was simply a matter of soldering it on to small enough a through-hole board to fit into the canister. I enjoy this part as it feels like a puzzle.

Next steps will be to add a switch so that I can turn it off. As it currently stands there is a USB charging port for the LiPo, but to turn it off you must unplug the battery. This is not ideal.

I’d also like to refine the look, perhaps add a more thoughtful colour scheme, and work on making the change of colour more definite. I do like the subtle shift in colour, but I worry that the slow change is not very noticeable. I would like to try a few other outputs, such as having each colour ‘tick’ over to the next slot if a certain threshold is met.