Arduino Ethernet Shield

Put your Arduino on-line

I have developed a Ethernet shield for Arduino boards. The board uses the Microchip's ENC28J60 SPI based ethernet controller. A tiny open-source TCP/IP stack has been developed as an Arduino IDE library. The memory usage is moderate -- 7700 bytes FLASH space and around 520 bytes of SRAM are used for the following application, A webserver with temperature sensor reading. It leaves around half of the FLASH and SRAM space for your own application :)

The schematic and the open-source TCP/IP stack are avaiable on my website http://www.nuelectronics.com.

There is also a details project description at http://www.nuelectronics.com/estore/index.php?main_page=project_eth

Fig 1. EtherShield V1.0 Fig 2. EtherShield with Arudino and the DS18B20 temperature senor (in the middle board) Fig 3. Arduino Webserver with Temperature reading

Very nice.

On this page

http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=4

"Open-source TCP/IP stack -- available as an Arduino library, download here"

Is linking to the LCD library

http://www.nuelectronics.com/download/projects/LCD4Bit_mod.zip

This page

http://www.nuelectronics.com/estore/index.php?main_page=project_eth

Has the correct link :)

very cool, and how much space would the library take on the chip? Will it work on a atmega8 as well ?

The memory usage -- for the above webserver with Temperature reading example

Flash -- 7700 bytes; SRAM -- around 520 bytes

So for ATMEGA8 with 8K flash and 1K SRAM, this example will be difficult to fit in unless you don't use bootloader. But the temperature reading routine takes around 2K space in the Flash. my other example, the webserver example, only use 5.5K flash space, so it should fit into the ATMEGA8 without problems.

very nice... by coincidence just today i posted some really really feeble arduino webserver code at ladyada's forum, based on the xport ethernet shield; http://forums.ladyada.net/viewtopic.php?t=5458

but your system looks a LOT more robust! looks like you can have some nice CGI on there too... hope you have a few in stock ;)

(incidentally, accessing your website directly www.nuelectronics.com attempts to forward to the nonexistent http://estore/ rather than http://www.nuelectronics.com/estore/)

@nuelectronics, nice work!

I realized you are using the name "Arduino" in your products... did you check the Arduino Team policy regarding the use of the Arduino name? http://www.arduino.cc/en/Main/Policy.

Hi,

the library does not compile (on linux) because etherShield.cpp tries to include EtherShield.h but the name of the file is etherShield.h (camelCase).

Ususally the C-header/source-files are in all lower-case so I suggest you rename the files to ethershield.h ethershield.cpp or go with the classname EtherShield.h EtherShield.cpp

Eberhard

Hi,

the library does not compile (on linux) because etherShield.cpp tries to include EtherShield.h but the name of the file is etherShield.h (camelCase).

Ususally the C-header/source-files are in all lower-case so I suggest you rename the files to ethershield.h ethershield.cpp or go with the classname EtherShield.h EtherShield.cpp

Eberhard

Thanks for the advice.

The library was only tested on Windows machine, since I don't have a Linux PC. I've changed the line #include "EtherShield.h to #include "etherShield.h" in file etherShield.cpp. The new file has been uploaded to my website.

Hope it will work on Linux. I'd really appreciate if someone could test it. Thanks ;)

Hi,

Hi,

the library does not compile (on linux) because etherShield.cpp tries to include EtherShield.h but the name of the file is etherShield.h (camelCase).

Ususally the C-header/source-files are in all lower-case so I suggest you rename the files to ethershield.h ethershield.cpp or go with the classname EtherShield.h EtherShield.cpp

Eberhard

Thanks for the advice.

The library was only tested on Windows machine, since I don't have a Linux PC. I've changed the line #include "EtherShield.h to #include "etherShield.h" in file etherShield.cpp. The new file has been uploaded to my website.

Hope it will work on Linux. I'd really appreciate if someone could test it. Thanks ;)

Now it compiles without errors. Eberhard

Really nice, do you plan on selling unassembled kits?

It should drop the price, and I for one don't mind assembling my shields.

Also have you considered putting a AVR on the shield so the code required to interface with it is reduced? Put all the low level code on the on board processor and expose a simple API over I2C or something.

Also have you considered putting a AVR on the shield so the code required to interface with it is reduced? Put all the low level code on the on board processor and expose a simple API over I2C or something.

I agree that would be pretty cool and not only for arduino but avr/microcontrollers in general. Just make sure that we can still program the onboard avr as well .... Darn, now I wish I thought of such a shield with the onboard avr idea. Let me know if you need help with the firmware for your onboard avr. if your planning on doing it ... ;)

Also have you considered putting a AVR on the shield so the code required to interface with it is reduced? Put all the low level code on the on board processor and expose a simple API over I2C or something.

En... It is a good idea - can be implemented with Full TCP/IP protocol rather than the Single data packet at the moment. But are we going to reinvent the WIZNET module?

the example code was perhaps a little daunting for newbies.

to make it a bit more straightforward i’ve pulled out a few of the functions – probably worth adding something like this to the library to make it simpler for those who basically just want to be able to serve webpages with dynamic values.

you can download the template here (just make sure you have the etherShield library installed; and set your IP address to one that doesn’t already exist on your network).

then your setup and loop would look simply like this…

// you can change this line if you want to serve, for example, XML or some other content type
#define HTTP_HEADER "HTTP/1.0 200 OK\r\nServer: arduino\r\nContent-Type: text/html\r\n\r\n"

void setup(){
  setupEthernet("192.168.000.060", 80);   // must include padded 0s in the IP address
}

void loop(){

  //put your code here 
   
  // then check for requests, and if so, serve the webpage  
  if (ethernetRequest()){
    writeHeader();    
    writePage("<h1>This is your Arduino speaking!</h1>");     
    writePage("<h3>Analog values:</h3>");     
    for (int i = 0; i < 6; i++){
      writePage("
");
      writePage(analogRead(i));
    }
    servePage();
  }
}

(btw, couldn’t get alternative ports to work either in my example or in the original; however didn’t spend a long time debugging)

En... It is a good idea - can be implemented with Full TCP/IP protocol rather than the Single data packet at the moment. But are we going to reinvent the WIZNET module?

What? Your shield only does single packets? (UDP only?) Hmm that limits its usefulness.

Maybe switch over to Wiznet with a onboard AVR controller? The Wiznet chews about 8kb as well to interface with it. But it can handle TCP/IP in hardware which makes it substantially simpler.

En... It is a good idea - can be implemented with Full TCP/IP protocol rather than the Single data packet at the moment. But are we going to reinvent the WIZNET module?

What? Your shield only does single packets? (UDP only?) Hmm that limits its usefulness.

Maybe switch over to Wiznet with a onboard AVR controller? The Wiznet chews about 8kb as well to interface with it. But it can handle TCP/IP in hardware which makes it substantially simpler.

No... We have webserver implementation, and HTTP is based on TCP. It is the a simplified TCP/IP implementation that uses the "single data packet", which sends the FIN immediately together with the data, rather than uses standard multiple packets TCP/IP protocol.

This makes the state handling for the closing of the connection a lot simple, and leave more space (flash & RAM) for user application. "Single data packet" means that your webpage(s) needs to be in one packet (limited by 1K RAM space), which should be OK for many applications that Arduino can handle.

Also have you considered putting a AVR on the shield so the code required to interface with it is reduced?

But are we going to reinvent the WIZNET module?

It does sounds a little that way. :-)

I've actually previously contemplated making a Netduino shield with an AVR on it that would provide a Lantronix-compatible interface, but it's still on the "to do" pile.

--Phil.

This makes the state handling for the closing of the connection a lot simple, and leave more space (flash & RAM) for user application. “Single data packet” means that your webpage(s) needs to be in one packet (limited by 1K RAM space), which should be OK for many applications that Arduino can handle.

Well that technique makes it completely useless for most purposes. :frowning:
HTTP is basically the only protocol which does that.

Sticking a AVR on the shield gives you significantly more power.

Also have you considered putting a AVR on the shield so the code required to interface with it is reduced?
Put all the low level code on the on board processor and expose a simple API over I2C or something.

En… It is a good idea - can be implemented with Full TCP/IP protocol rather than the Single data packet at the moment. But are we going to reinvent the WIZNET module?

Not a chance… wiznet can handle 25Mbps, put in a module for $20. This is far less powerful and more expensive. I should say what is being reinvented is the stone wheel

Where can you get a wiznet module for $20? Everywhere I look they are closer to $40, and thats just the wiznet module... then you need a shield, are you telling me you can get this put together and retail the whole thing for less then $24, cause if so I want one. This was only $24. For the price I think its pretty nice.

Ladyada has a really nice shield out, but I it's another $40 for the wiznet module... thats pretty much everywhere.

I think this is pretty useful. 1K is a pretty big message to send from a device with a limited amount of memory. Mine will serve up tiny xml messages that are consumed and displayed elsewhere via xsl transform.