Tweeting like an Arduino!
I’ve just released the first version of Tweetino, a little sketch for the Arduino which downloads the latest tweets and displays them on an LCD.
The idea is quite simple: the application periodically polls the Twitter servers for getting the latest tweet for the given user, and then the text is shown on a screen; there is already a similar sketch in the new Ethernet libraries for Arduino IDE 1.0, but the difference here is that the connection to the servers uses OAuth, so it is able to get tweets from private accounts (and not just the public ones, like the other implementation cited before).
The code is hosted on Github, as usual, and it has to be filled with several details before being used, in particular it needs the token and access keys that a user can obtain from dev.twitter.com by registering a new application; in particular, the secret keys are to be stored in the EEPROM memory before launching the Tweetino application. Please refer to the README file for more details.
First and foremost: I know that a good OAuth implementation should be developed in a separated library, instead of being entangled with the whole program, but the problem is that I’m testing everything on an Arduino Uno, which has just 2 KB of SRAM and OAuth requires some string manipulation, and there is not much space for it; moving everything in an external library requires some work which I have not done (yet), so for now just play around with the current code. Probably an Arduino Mega would help the development (having 8 KB of SRAM), but I don’t have any. Besides, trying to stick everything in just 2 KB has been quite fun.
Second, there is a known bug (sorry!): the Base64 library that I’m using sometimes returns a wrong value (at least with respect to the Erlang code implementation to which I am doing comparisons), and the request is refused by Twitter; given this fact (and the fact that I have no idea, for now, on the cause of the error), I have just added some code to repeat the request a few times in each cycle, in the hope that at least one of the calls behaves correctly. So, don’t expect some real time behavior!