User Tools

Site Tools


dbrooke_nodes:dbag

Adding Ethernet support to the Sensor Board V3

Background

Some sort of network connection is required for a gateway and I had previously used a serial connection between a gateway node and a Raspberry Pi before connecting a radio module directly to the Pi for my DBPG node.

Using a Pi just for this seemed like overkill and while building an AVR Sensor Board V3 I realised that the necessary connections to interface to an ethernet board were available on the headers so I decided to try it.

Hardware

The ethernet board I used was one of the many ENC28J60 based ones, which appear to be available for as little as £3 (just search the web for ENC28J60).

The ENC28J60 chip uses the SPI bus (Serial Peripheral Interface Bus) which the node is already using for the radio module, and which is also available on the ISP header. The connections are not identified on the silk screen but are like this:

The SS signal is not available on this header but two spare digital I/O pins, D3 and D4, are brought out to the 7 pin header and I chose to use D4 to provide the SS signal.

The ethernet board I used can be powered with 3.3V so I was able to use the ISP header VCC pin to supply it.

For testing I used a minimally equipped sensor board and provided power to it from an external 3.3V regulator via the 7 pin header G and + pins.

Connection Summary

Labelling on the Ethernet board may differ between manufacturers.

Ethernet Board Sensor Board External
ISP header 7 pin header
SI MOSI
SO MISO
SCK SCK
CS D4
GND GND
3.3 VCC
+ 3V3 Supply
G GND Supply
RX Serial Debug
TX
G

Software

Repository

My variant of the software, with support for the ENC28J60, can be found on this branch:

https://github.com/dbrooke/UKHASnet_Firmware/tree/ENC28J60

Library

In addition to the usual libraries the EtherCard library is required.

Configuration

In addition to the usual configuration the following lines should be added to the Node-specific config section for your node in NodeConfig.h

static byte mymac[] = { 0x02,0x55,0x4b,0x48,0x41,0x53 }; // ethernet mac address - must be unique on your network
const char website[] PROGMEM = "www.ukhas.net"; // upload website name

In the unlikely event that you already have a device with that MAC address then change something other than the first (0x02) byte since that contains reserved bits.

Usage

In most cases it should be sufficient to just connect to a network with Internet access and apply power to the node.

The node uses DHCP to configure its IP address, gateway and DNS server and will then use DNS to look up the address of the web server specified in NodeConfig.h to which it will then begin uploading its own beacons and any packets received by the radio module.

dbrooke_nodes/dbag.txt · Last modified: 2015/01/24 11:31 by dbrooke