Go Down

Topic: Arduino Ethernet Shield (Read 12523 times) previous topic - next topic

nuelectronics

Mar 20, 2008, 03:50 pm Last Edit: Mar 20, 2008, 03:53 pm by nuelectronics Reason: 1
[size=16]Put your Arduino on-line [/size]  

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


John_Ryan

#1
Mar 20, 2008, 05:57 pm Last Edit: Mar 20, 2008, 05:59 pm by John_Ryan Reason: 1
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 :)

tvdbon

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

nuelectronics

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

[size=16]Flash -- 7700 bytes;  SRAM -- around 520 bytes [/size]

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.

uh

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/)


nkcelectronics

#5
Mar 20, 2008, 09:37 pm Last Edit: Mar 20, 2008, 10:16 pm by nkcelectronics Reason: 1
@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.

wayoda

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




nuelectronics

Quote
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  ;)

wayoda

Hi,
Quote
Quote
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



aballen

Really nice, do you plan on selling unassembled kits?

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

Cheater

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.

tvdbon

Quote
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 ...  ;)

nuelectronics

Quote
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?  

uh

#13
Mar 26, 2008, 07:40 pm Last Edit: Mar 26, 2008, 07:58 pm by uh Reason: 1
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.....

Code: [Select]

// 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("<br>");
     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)

Cheater

Quote
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.

Go Up