Image above shows ethernet shield connected to an Arduino compatible Uno (Uno not included)
Description:
This is the latest (revision 3) version of our Arduino compitible eithernet shield. This latest version includes improvements over the our 2012 version including the addition of the Arduino standardised 1.0 pinout and a PoE Upgrade option.
This Ethernet Shield is based on the Wiznet W5100 Ethernet Chip and gives you an easy way to get your Arduino online. It is directly supported by the official Arduino Ethernet Library. It also includes an additional micro-SD card slot, which can be used to store files for serving over the network. It is compatible with the Arduino Duemilanove (168 or 328), Uno as well as Mega (1280/2560) and can be accessed using the SD and Ethernet libraries.
The Wiznet W5100 provides a network (IP) stack capable of both TCP and UDP. It supports up to four simultaneous socket connections. Use the Ethernet library to write sketches which connect to the internet using the shield.
Example Sketch:
Code: Select all
/* FILE: ARD_Ethernet_Shield_HCARDU0071_Example
DATE: 24/05/13
VERSION: 0.1
This is an example of how to use the HobbyComponents R3 Arduino Ethernet shield
(HCARDU0071). This Ethernet shield is based on the W5100 Ethernet controller and
is compatible with the standard Aduino Ethernet libraries. It requires no additional
libraries to work.
This program will serve a basic webpage at the ip address specified below. As an
example of content, the webpage contains the current status of the 6 analogue input
pins.
REVISIONS:
You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/
#include <SPI.h>
/* Include the standard Ethernet library */
#include <Ethernet.h>
/* MAC address of the Ethernet shield. If you are using this on your
own network, then the MAC address below will be fine, but remember if
you use more than one shield on your network they will need to be assigned
unique MAC addresses */
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
/* The IP address of the shield. Make sure this matches the IP
address range of your network and is not in use by any other
device on it */
IPAddress ip(192, 168, 1, 55 );
/* The port number the shield will respond to. Use port 80
for standard HTTP requests */
EthernetServer server(80);
/* Start the Ethernet interface */
void setup()
{
//pinMode(53, OUTPUT); //Uncomment this line if using a Mega
Ethernet.begin(mac, ip);
server.begin();
}
void loop()
{
/* All client requests are terminated with a blank line. This flag will
signify if the current line received from this client is a blank line */
boolean bBlankLineFlag = true;
/* Used to hold the current byre received from the client */
char cCurrentByte;
/* Loop counter used for reading the 6 analogue inputs */
int k;
/* Wait for a request from a client */
EthernetClient ethernet = server.available();
if (ethernet)
{
/* Continue to read data from the client one byte at a time until
there is no more data */
while (ethernet.connected())
{
/* Is there still data available to be read? ethernet class
ethernet.connected() returns the number of bytes available */
if (ethernet.available())
{
/* If data is available read the next byte */
cCurrentByte = ethernet.read();
/* If the next byte read is a new line termination ? */
if (cCurrentByte == '\n')
{
/* If so was it a blank line? */
if (bBlankLineFlag)
{
/* If it was then we can now send a response to the client’s http request... */
ethernet.println("HTTP/1.1 200 OK");
ethernet.println("Content-Type: text/html");
ethernet.println();
/* ...and add some useful content by reading the 6
analogue inputs and returning their status */
ethernet.println("<body>");
ethernet.println("<big><span style=\"font-weight: bold;\">www.hobbycomponents.com Ethernet Shield Example</span></big><br>");
ethernet.println("****************************************************<br>");
for (k = 0; k < 6; k++)
{
ethernet.println("Analogue input ");
ethernet.print(k);
ethernet.print(": ");
ethernet.print(analogRead(k));
ethernet.print("<br>");
}
ethernet.println("****************************************************<br>");
ethernet.println("</body>");
/* Disconnect from the client */
ethernet.stop();
}
/* The last received byte was the start of a new line so flag as no
data received for this line yet */
bBlankLineFlag = true;
/* If the last byte received wasn't a new line then it must be data... */
} else if (cCurrentByte != '\r')
{
/* ...and so flag this as not a blank line. */
bBlankLineFlag = false;
}
}
}
}
}
FAQ:
The main chip (Wiznet W5100) on my shield has solder bridges on some of the pins, is it faulty?
This is quite normal and is just where two or more adjacent pins (normally unused or ground pins) share the same pad area which effectively shorts these pins together. As a result the solder naturally flows between these pins making it appear that the short is not intentional. You can reference the image below of a working shield to confirm your board is ok.