Teensy Moonica, The 8-Legged Gift for A Developer

Published on . Takes about 4 minutes to read.

A good friend of mine had a birthday coming up and I found myself socially obligated to do something about that. The idea - use my skills as a developer to MAKE something developer-ish. This was a collaborative project with Valeria.

I buy more things than I make. I used to think it was a sign of some kind of capitalistic progress to be able to buy food and gifts instead of making them myself, but I’m not sure anymore. When it comes to difference making there is a different trend line. Money can come and go, but my time on this planet is finite. How I spend my time, or who I spend it with means more than anything else in my universe. From at least the selfish view, giving my time is the most valuable gift I can give.
Scott Berkun, essay #49 - How to make a difference

Idea

Build hardware that can interface with a computer (via the USB port) and send input commands to the PC that can be detected and processed. As a bonus, include output devices such as LED-s that could be activated from code.

The idea came from the fact that I found myself typing PHPUnit commands for different test suites manually way too often. Wouldn’t it be great to activate a test suite with a press of a button and have a green LED light up when everything is done? (or a red on in case of a failure). “Normal” people would go “???” about this, but trust me, for a developer, this is good stuff.

UI draft

I came up with a rectangular-shaped control panel. Really fancy stuff, like you see in sci-fi movies or airplanes. Excited, I got in touch with a mutual friend who also happens to be a designer. A brainstorming session and a couple of hours later and the original idea had been morphed into a much cuddlier version - a USB soft toy.

The toy would be an octopus with eight legs, each leg would act as a switch. I was to build the electronics innards while she’d do the sewing part.

Parts

Tools

  • Adjustable temperature soldering iron and solder, solder paste
  • Hot air gun for the heat shrink
  • Wire-handling tools: pliers, strippers, clippers
  • Digital multimeter
  • Breadboard and jumpers for prototyping
  • Helping Hands

The Build

Breadboard

Prototyping was quite fast. This was my first bigger build and I had to figure out how to use PWM to control the buzzer and LED brightness. In no time at all, the circuit was assembled on my breadboard. I used the equipment of the robotics lab of EIK to assemble and solder the circuit.

Software was a bit trickier. A lot of hours went into refactoring and documentation. The most complex part was serial communication. Initially, I tried to be verbose, sending button events as long strings (“Button 1 pressed”) and parsing the string in Python. Then I saw Saying a Lot with Very Little (Arduino Digital Input to Python and refactored the code to send all button states as one byte - much more efficient way of communication.

Oops!

We - me and Val - had hacking evenings on several occasions. During the last one, an accident happened. It turns out that the contacts of microswitches are actually quite fragile (go figure) and do not like to be abused. I managed to break one of the already assembled switches which meant no joy for that evening. All of the switches needed replacement by a stronger version (and also where the solder connections were made at a correct angle to begin with). Adafruit’s tactile square buttons fit the build and replaced the less durable buttons.

Finale

Moonica - the name of our animal - was stuffed and wrapped and given to the birthday boy (although by the time the project was finished the actual birthday was two months into the past).

Moonica

The project was great fun to do and also taught us a lot. I got into electronics in January 2013 and this was the first “official”, non-prototype build. I learned to program in C / Arduino, got to try out PWM and implement serial interfacing.

Links