Nanode / twitter blink example

Here are some notes on my adventures trying to make an ethernet connected Nanode that blinks when certain words are mentioned on twitter. I was working with Mac OS X and there were a few gotchas, so I’ve mentioned them here so I don’t forget and in case anything is useful to anyone else. There’s an exciting video of the resulting beast here featuring the acrylic case from the excellent and fast SKPang. The code (an unholy mixture of C++ and Processing) is here. I was coming at this as someone who’d previously only got blinking and similar going on a Arduino Duemilanove.

Getting the Nanode working

  • Buy a Nanode (ethernet Arduinos are also available, I chose a Nanode because it was recommended to me, also their support is very good and it arrived very quickly. I think in retrospect it’s a bit hard to use for a real novice like me, though I enjoyed finding out…). I got a prebuilt Nanode RFX (which has a Hope RF shield and a microSD slot). You need to also buy a Programming Adaptor, which you need in order to talk to a Nanode as the USB programming interface isn’t built in.
  • Download the Arduino IDE
  • Install the FTDI driver (see this comment, which helped me out a lot) – installing it will restart your computer. This is a different driver to the one you use with a standard Arduino – see the Arduino guide if you’re not using a Nanode
  • Open the blink Arduino example (under file -> examples -> Basic, or here) and change the output to 6
  • Connect the Nanode to the Mac using the FTDI cable using a USB cable
  • In the IDE, set the port to the new driver and the board to ‘Arduino Duemilanove with ATMega 328’
  • Compile and run the Blink example on the Nanode
  • The default LED on the Nanode should blink
  • Celebrate

Connecting up Ethernet

  • Install Ethernet Library -> cd ~/Documents/Arduino; mkdir libraries
  • Download EtherCard library and unzip it in this directory
  • Restart the Arduino IDE and you should see sketch / import library – a new library (not Ethernet but EtherCard at the bottom)
  • Start a new sketch
  • Next I copied and pasted this WebClient example from EtherCard into a new file, and that formed the basis of my code.
  • Click on sketch / import library – and import EtherCard – and it puts some import statements at the top
  • Add this at the top: #include <stdint.h>
  • Connect it to an ethernet connection (e.g. I shared airport to ethernet connection on my mac)

The one problem I had was that it appeared to work intermittently, or once per restart of the board. I think this must have been some sort of race condition. Anyway, I solved it by adding a tiny wait after these two lines:

void loop () {


 delay(100); //<--  add this.


If you look then at the serial monitor (button with the little magnifing glass on the top right of the Arduino IDE), you should see some results. Click restart on the Nanode if not. It takes a while to get the IP address.

A couple of useful links: