The Brains

I had a few things in mind that I really wanted for the finished clock:

  • I decided early that I wanted the clock to read my twitter feed to determine status.

  • It should be completely self-contained. I fudged and allowed external power, but I really wanted to avoid hard-wiring a network connection.

  • It should be possible to upgrade the logic for determining location without ripping apart the hardware.

  • It shouldn't require manually setting every time power is lost.

The solution I picked was a combination of an Arduino* board to drive the servos and wireless router to to fetch the twitter feeds and derive the status to set.

(*I actually ended up using a Seeduino in the final build. The Arduino worked perfectly, but that's my mess-around board and I didn't want to commit it to this project.)

I found an Asus wireless router(WL-520GU) that was capable of running dd-wrt and had a USB port.

It was relatively inexpensive and small enough to fit into the chassis.

Here's the general logic it uses.

  1. My final design uses a script to fetch four twitter feeds every couple minutes.

  2. The script then parses out the first words and searches for a matching 'status'.

  3. If no match is found, it sets the status to 'Read Me'

  4. The script outputs a string with the hand number followed by a separator character, and then a letter from a-l for the status like '1>d2>b3>g4>a'. This would set the 1 hand to 'school' the 2 hand to 'Church', the 3 hand to 'Home' and the 4 hand to 'Mortal Peril'.

  5. The string is passed to the arduino which checks if the hand location is known. If it is and hasn't changed, it does nothing. If it's unknown or changed, it drives the corresponding servo to the new location and stores the current location.

Admittedly, this is very basic. However, it should be relatively easy to improve the logic over time to make the router smarter about determining location. I'd like to play with Google Latitude to see if some of the statuses could be derived automatically.

I've attached the arduino sketch and the bash script that runs on the Asus router below. The sketch needs the megaservo library. At a minimum, you'll need to modify the bash script to use your own twitter feeds.

Apologies in advance. I'm not much of a programmer so these are very basic. I'd welcome any improvements people can make to these files. I know the twitter API could be used more efficiently. The current version makes a separate api call for each hand. I'm sure this could be improved by making the four twitter accounts "friends" of one another and then using the API to lookup all feeds in one call.