Nanode’s a go-go

I have recently bought a couple of nanodes to play with. These are ethernet enabled arduinos for cheap and easy internet connectivity. Devices can be controlled from anywhere via the internet. Data can be streamed to data logging sites. The potential uses for these little boards is vast. This is a post about my experiences of getting started with one.

They were designed by Ken Boac along with a large number of other people including a heavy involvement by the folk at the London Hackspace – check out the project nanode pages.

There is a load more info here, from the hackerspaces wiki. And a load of applications are listed here.

A number of people are using them for power and energy monitoring (such as the openenergymonitor project). At my local hackspace (nottingham hackspace), they are using a number of them to instrument the space and control entry via RFID – they even use the nanode to ring the doorbell (what could go wrong?…).

So I need to think of something great to do with mine.

To start with though this is a blog post on my practical experiences in getting the device going.

Firstly, follow this construction guide carefully – except use a 1 ohm or a shorting link where the PCB says ferrite.  Also, you need to make sure you get the 3V3 regulator is twisted before fitting it in.

Follow the power checks carefully. Switch on the power and you should have the ‘blinky’ code installed on the Atmel 328 already. The LED should blink satisfyingly.

Now we want to get it to talk to an ethernet device:

Firstly download the Ethershield library from github. Install this into your arduino libraries folder.

Next you must modify a few parts of the code. I started with the Ethershield_DHCPTest example.

I entered a MAC code: This is a unique reference number for every ethernet device. I used this line, which is equivalent to the hex numbers for NANOD then with the last number being the serial number of the Nanode board:

static uint8_t mymac[6] = { 0x4e,0x40,0x4e,0x4f,0x44,0x23 };

You must also change this line a bit further down to include the number 8 (meaning pin 8):

Serial.println("Init ENC28J60");

Upload this code and connect to a router of some kind using a normal ethernet cable. Open the serial terminal from Arduino. Set it to 19200 baud rate. Press reset on the nanode.

You should get a message something like this in the serial terminal:

DHCP Client test
Init ENC28J60
Init done
ENC28J60 version 7
Sending initial DHCP Discover
My IP:

This is telling me the MAC address (as we programmed it) and, as it is DHCP (Dynamic Host Configuration Protocol), the IP address assigned to it from the router.

So it works! But its not yet giving me data via ether net yet.

To do that as an initial test I used the EtherShield_Webserver example. I saved this as my own sketch.

Again, there are a few things to change. Firstly the MAC address (I used the same as before):

static uint8_t mymac[6] = { 0x4e,0x40,0x4e,0x4f,0x44,0x23 };

Also use the IP address you obtained in the test above (This example is not DHCP hence you have to explicitly state the IP address):

static uint8_t myip[4] = {192,168,1,136};

You also need to change the code so it uses pin 8, as we did before:

// initialize enc28j60
es.ES_enc28j60Init(mymac,8);    // Add the ,8 here

I also changed some of the text code so it was a bit more personalised. Connect the device to the router, apply power and then use a web browser to check out the IP address you programmed. You should see something like this:

Its a great device with huge potential. Not sure what I am going to do first with mine. Probably power and energy on-line monitor for the house to start with… but loads of folk are doing that. I’ll have a think about something a bit more special.

Leave a Reply

Your email address will not be published. Required fields are marked *