Ethernet shield Guide for arduino
To use the shield, mount it on top of an Arduino board (e.g. the Uno). To upload sketches to the board, connect it to your computer with a USB cable as you normally would. Once the sketch has been uploaded, you can disconnect the board from your computer and power it with an external power supply.
Connect the shield to your computer or a network hub or router using a standard ethernet cable (CAT5 or CAT6 with RJ45 connectors). Connecting to a computer may require the use of a cross-over cable (although many computers, including all recent Macs can do the cross-over internally).
The shield must be assigned a MAC address and a fixed IP address using theEthernet.begin() function. A MAC address is a globally unique identifier for a particular device. Current Ethernet shields come with a sticker indicating the MAC address you should use with them. For older shields without a dedicated MAC address, inventing a random one should work, but don’t use the same one for multiple boards. Valid IP addresses depend on the configuration of your network. It is possible to use DHCP to dynamically assign an IP to the shield. Optionally, you can also specify a network gateway and subnet.
The latest revision of the Ethernet Shield includes a micro-SD card slot, which can be interfaced with using the SD library.
Connecting the Ethernet shield
The Arduino Ethernet Shield allows you to easily connect your Arduino to the internet. This shield enables your Arduino to send and receive data from anywhere in the world with an internet connection. You can use it to do fun stuff like control robots remotely from a website, or ring a bell every time you get a new twitter message. This shield opens up endless amounts of possibility by allowing you to connect your project to the internet in no-time flat.
setting it up is as simple as plugging the header pins from the shield into your Arduino.
There is also an on-board micro SD slot which enables you to store a heck-of-a-lot of data, and serve up entire websites using just your Arduino. This requires the use of an external SD library, which does not come bundled with the software.
plug the Arduino into your computer’s USB port, and the Ethernet shield into your router (or direct internet connection).
Next, open the Arduino development environment. I highly recommend upgrading to Arduino 1.0 or later (if you have not done so already). This version of the software has built in DHCP support, and does not require manually configuring an IP address.
To figure out what IP address has been assigned to your board, open the DhcpAddressPrinter sketch. This can be found at:
File –> Examples –> Ethernet –> DhcpAddressPrinter
Once open, you may need to change the Mac address. On newer versions of the Ethernet shield, you should see this address on a sticker attached to the board. If you are missing a sticker, simply making up a unique mac address should work. If you are using multiple shields, make sure each has a unique mac address.
Once the mac address is properly configured, upload the sketch to your Arduino, and open the serial monitor. It should print out the IP address in use.
The following code lights up an LED depending on the URL that is sent to the Arduino:
Web Server Demo
thrown together by Randy Sarafan
Allows you to turn on and off an LED by entering different urls.
To turn it on:
To turn it off:
* Ethernet shield attached to pins 10, 11, 12, 13
* Connect an LED to pin D2 and put it in series with a 220 ohm resistor to ground
Based almost entirely upon Web Server by Tom Igoe and David Mellis
created 18 Dec 2009
by David A. Mellis
modified 4 Sep 2010
by Tom Igoe
boolean incoming = 0;
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network: