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.

Step 1: Setup

Setting it up is as simple as plugging the header pins from the shield into your Arduino.

Note that the Ethernet Shield sold at Radioshack is online compatible with Arduino Uno Rev. 3 boards (or later). It has too many pins to plug into earlier version Arduino boards.


Step 2: Shield Features

The Ethernet Shield is based upon the W51000 chip, which has an internal 16K buffer. It has a connection speed of up to 10/100Mb. This is not the fastest connection around, but is also nothing to turn your nose up at.

It relies on the Arduino Ethernet library, which comes bundled with the development environment.

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. Using the SD card is not covered in this Instructable. However, it is covered in the Step 8 of the Wireless SD card instructable.

The board also has space for the addition of a Power over Ethernet (PoE) module, which allows you to power your Arduino over an Ethernet connection.

For a full technical overview, see the official Ethernet Shield page.

Step 3: Get started

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.

Step 4: Server

You can use the Arduino Ethernet shield as a web server to load an HTML page or function as a chat server. You can also parse requests sent by a client, such as a web browser. The following two examples show how to use it to serve HTML pages, and parse URL strings.

One important thing to keep in mind is that you will have to enter your Arduino's IP address in both of the examples below in order for them to work.

The following code changes the web page served based on a button press:
To make this example code work, simply attach a button between pin D2 and 5V,  a 10K resistor between pin D2 and ground, and then load the IP address of your Arduino into your web browser. The page should load with a black background. Press and hold the button, and then refresh the browser page. The site should now load with a white background.

The following code lights up an LED depending on the URL that is sent to the Arduino:

To make this work connect the positive lead an LED to pin D2, and the negative lead in series with a 220 ohm resistor to ground.

To turn on the LED enter this into your browser:

To turn off the LED enter this into your browser:

Note: You should obviously replace [YOUR IP ADDRESS HERE] with your IP address.

Step 5: Client

You can also use the Ethernet Shield as a client. In other words, you can use it to read websites like a web browser.

Websites have a lot of text both visible and hidden, which makes programming on the client side very tricky. Reading information from websites typically involves parsing a lot of strings. This is maddening, but worth it, if that is what you intend to do.

I was going to write some code to read Twitter messages, but such a code already exists as an example within the Arduino programmer. Instead, I simply modified it slightly to turn on an LED if a special message is read.

To make this work connect the positive lead an LED to pin D2, and the negative lead in series with a 220 ohm resistor to ground.

Don't forget to enter your own IP address into the code below, or it will not work.

Here is the code:

Presumably you are going to want to read something other than the recent post on the RandyMcTester Twitter feed.

To read other Twitter feeds, change the following bit of text:
client.println("GET /1/statuses/user_timeline.xml?screen_name=[NEW TWITTER NAME HERE]&count=1 HTTP/1.1");
hi,<br><br>i've got the same problem. set a fixed ip.. it doesn't solve the problem but you go further<br><br>IPAddress ip(132 ,206 ,95 ,251); <br>Ethernet.begin(mac, ip);
<p>I get this message : <br>Failed to configure Ethernet using DHCP <br>any idea how to fix this thx ?</p><p>ipconfig /all gives me the physical address that i put in mac[]. <br>it also says dhcp enabled : no <br>even if code is for DHCPaddressPrinter.</p><p>in case of ethernet server code : <br>i cant open my ip address in web browser. <br>when i ping it says &quot;destination host unreachable&quot;.</p>
<p>Have you set up the ip of the Ethernet shield? the ip should be same range as your PC's ip like </p><p> for PC</p><p> for shield.<br><br>And also some cheap W5100 shields has a problem with a resistor array situated near the RJ45 socket. It should be 510 instead of 511 (51Ohm instead of 510ohm)</p>
I get this message :<br>Failed to configure Ethernet using DHCP<br>any idea how to fix this ?<br>Pls reply asap.<br>Thanks, it would be a great help
<p>Have you configured the ip address of ethernet shield? </p>
<p>Hey, I have been using HanRun HR911105A and when I connect it to my Laptop through ethernet cable it doesn't detect the connection and there is no blinking of LED's on the ethernet shield as well as on the Laptop.</p><p>Thanks in advance hopefully someone can help!!</p>
Can i ask if whats your mac adress for your ethernet? We have a project and its the same ethernet shield we use, but we dont know the mac address. Reply asap. Thank you
<p>The Arduino shield and the computer both have the same RJ45 connections. That is, the send and receive pins are on the same pin for both sender and receiver. If you connect them directly with a cable, the send pins match up and the receive pins match up and therefore you get no communications. </p><p>You either need an Ethernet hub/switch or a cross over cable that crosses over the Send and Receive pins. The hub/switch is definetly the easiest way to go and you can pick them up cheaply from amazon. </p>
<p>Just a thought, when you normally plug your Arduino board into your computer the usb cable supplies the power. Most ethernet does not support power over internet (POI), so unless you are also connecting to your PC using usb at the same time you will need to supply external power to your board.</p><p>If you already provided external power ignore this comment. </p>
<p>Hi ! Your<br>instructions are very well managed and self explanatory. But I&rsquo;m<br>facing issues at the beginning. Whenever I&rsquo;m powering up the UNO board, the<br>chip on the Ethernet shield is getting hit up within 2-3 secs. So, I'm unable to start the shield at all.</p><p>Please suggest / help...</p>
<p>Hi, am able to ping the Ethernet shield but cant get anything in browser.</p><p>What's the use of the EthernetServer Server(80)</p>
<p>i made an internet controlled rover using the arduino ethernet shield following <a href="http://www.instructables.com/id/Internet-Controlled-RC-Car/" rel="nofollow">http://www.instructables.com/id/Internet-Controlle...</a> this instructables...but it only works for my internet connection...i cant operate it from other internet connections with the same ip address...if anyone could help :(</p>
<p>Thanks Randofo</p><p>The Step 5. (Twitter Reader) section does not work. Please confirm this <a href="http://www.instructables.com/member/randofo/">http://www.instructables.com/member/randofo/</a></p><p>... I presume it would need a Twitter API</p>
<p>the twitter api updated and now you need authentication, which i have no idea how you get authentication...</p>
<p> Arduino with AJAX</p><p>https://www.youtube.com/playlist?list=PLbUAcqHuByzfm9od5kHKArjKIAtfbT0LD</p>
<p>to copy the code from the text area, simply (tested on chrome) rightClick the textArea and click inspect element, than expand the textArea element and there you have it</p>
<p>I am unable to copy the sample code that you provided. Is it available somewhere that it copied? Thanks.</p>
<p>Yes, that's annoying -- wish the author would change that. I downloaded the PDF, cut and pasted the text into the arduino editor. I think you might have to have a pro instructables membership to download the PDF.</p>
Does anyone know how to connect the radio module NRF24L01
<p>Can we use wifi insted of CAT5 cables for wireless communication?</p>
<p>looks like photo is not correct. Looks like the black wire of switch is connected to ground, not 5V. Hooked up to 5V instead and it seems to be working. Get DARK/LIGHT on website [firefox]</p>
<p>can you use this shield connected to your computers ethranet port</p>
<p>please help me, serial monitor can't be open....<br>it says &quot;Board at COM49 is not available&quot;</p>
<p>thanks for sharing nice idea</p>
<p>I get this message :<br>Failed to configure Ethernet using DHCP<br>any idea how to fix this thx ?</p>
<p>Hi, thanks for the wonderful walk-through! However, the twitter client doesn't seems to work.. Any idea?</p>
<p>Thanks ! it worked for me. Just a little reminder : to get the info on your monitor, don't forget to set it to the same baud rate as the one set by the program (ie DhcpAddressePrinter) for the serial connection (check the number XXX in Serial.begin(XXX)). To change the baud rate, you can use the &quot;check list button&quot; at bottom right of the monitor</p>
<p>Thanks for the tutorial, but i have a question to the server work example.<br>If i would like to use other strings other than &quot;$1&quot; and &quot;$2&quot;, like &quot;$ledon&quot; for switching on the led connected, what adjustment need to do to the codes.<br>I find it difficult to solve this problem. </p>
<p>Didn't work with 1.0, but first time with 1.6.1</p>
<p>Let me first start by saying that I am a complete noob when it comes to anything Arduino. My kit hasn't even arrived in the mail yet so please go easy on me. :) </p><p>However, I have a question regarding this project. Specifically the RJ45 Ethernet Shield. In your example you are using the RJ45 to interact with the Arduino via a website/internet, is it possible to use the Arduino + Shield to interact with a series of rocker switches via a 8 channel relay board? If so, I was thinking that it would make the installation of my project really clean being able to use the RJ45 cable between my Arduino and the switches that will be located perhaps 10-15 feet away. <br><br>Any and all help is appreciated.</p>
<p>This Tutorial is Fantastic and very very very very clear everything.Got this tutorial after 4 days searching on my related topic.</p><p>Many Many Thanks Dear. </p>
<p>Excuse me, does anyone know how to access the ethernet shield from the outside of the local network - that is from the internet? I guess the local dynamic IP has to be changed, right..? Where to get that IP?</p>
<blockquote>how to access the ethernet shield from the outside of the local network - that is from the internet?<br></blockquote><p>You need to port forward the IP and port you are using of the ethernet shield to the internet</p><p>This website may help: <a href="http://portforward.com/" rel="nofollow">http://portforward.com/</a></p><blockquote>I guess the local dynamic IP has to be changed, right..?</blockquote><p>Yes if you are port forwarding the ethernet shield should have a static local IP. You can define the ethernet shield IP in the code. </p><p><a href="http://arduino.cc/en/Reference/EthernetIPAddress" rel="nofollow">http://arduino.cc/en/Reference/EthernetIPAddress</a></p><p>you can find your DNS servers, gateway, and subnet by typing <em>ipconfig /all </em>in a windows command line.</p><p>Make the ip of the ethernet shield any ip not currently used on you network. An easy way do do this is to take IP address listed in <em>ipconfig /all </em>and change the numbers after the last dot to<em> 254 and put that in the arduino code as its IP.</em></p><blockquote>Where to get that IP?</blockquote><p>If you mean your public IP you can find that by visiting </p><p><a href="http://www.whatismyip.com/" rel="nofollow">http://www.whatismyip.com/</a></p>
Nice thank u
<p>thanks for your information,</p><p>secretfood.net</p>
<p>It's useful thank</p>
<p>Nice Tutorial!!</p><p>I'm a engineer in WIZnet providing W5100 to the official Arduino Ethernet Shield.</p><p>WIZnet made W5500 and WIZ550io/ioShield-A. If you are interested in W5500 and make a tutorial of W5500, I will give a WIZ550io to you free. If you want, feel freely to contact me. </p><p>Thank you.</p>
my ethernet shields ic gets hot will u plsplspls help me for that <br>am using arduino leonardo board <br>pls help me <br> <br>regards <br>pyt
I have one of the Non-POE (power Over Ethernet) 5100's, and it does the same to me.. I think it's the 3.3V regulator trying to run the single chip, which is chewing-up massive wattage.. (even if it is being powered from the +5V regulator from the Arduino.) I've often wondered, if I could repower this off the 3.3V off an external power supply, but someone said that's a bad idea, as the back-feed could burn-out the regulator, and other chips switching between the 9 down to 5, and 5 down to 3.3, or even the USB to serial chip. <br>
<p>You need to supply the arduino and the shield with 7 or 7.5 v, you can use a dc-dc power regulator. I use a 12v power suply and a dc to dc regulator, who give me 7.5v and everything is fine. </p>
Did you do anything to change it, and/or did you plug it in correctly? It sounds like you are shorting something.
<p>Wow! a whole year later? No, It's something about the 3.3 regulator, that is handling a lot of amperage from the 5100.. I thought I saw somewhere on another instructable, someone solved the problem (slightly) by DOUBLING the regulator. (stacking another one on top of the original, so you had 2 in parallel.) http://www.instructables.com/id/Beef-up-your-Arduino-power/</p>
That happens with my wiznet W5100 too. It just happens I think.
<p>Thanks a lot work at the first run.No problem with me here.</p>
'and open the serial monitor. It should print out the IP address in use.' <br> <br>This dosen't work...........WTF

About This Instructable




Bio: My name is Randy and I founded the Instructables Design Studio. I'm also the author of the books 'Simple Bots,' and '62 Projects to ... More »
More by randofo:Glow Projects Guitar Pedals Beginner Electronics Projects 
Add instructable to: