Introduction: Arduino Ethernet Shield Tutorial

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


sayedmosalem made it! (author)2017-07-24

I have connected the eithernet shield directly to my laptop and put them in the same network, after that I was able to switch the led on/off. but when I put my lap top and the shield to the my Home network I can ping the shield from the laptop but I can't switch the led on/off.

novianiw made it! (author)2017-01-30

from this program i cant get my ip address from ethernet shield..
i only get server is at -> this ip address from web server
what i should do ? i am using ethernet shield HanRun HR911105A 16/02

RogerioAlencar made it! (author)2016-01-25

Arduino with AJAX

Maruf93 made it! (author)Maruf932017-01-20

It would be better if you make it in English...I don't understand anything from your video....

MORACK made it! (author)2016-12-22



KaushalK made it! (author)2015-06-23

I get this message :
Failed to configure Ethernet using DHCP
any idea how to fix this thx ?

ipconfig /all gives me the physical address that i put in mac[].
it also says dhcp enabled : no
even if code is for DHCPaddressPrinter.

in case of ethernet server code :
i cant open my ip address in web browser.
when i ping it says "destination host unreachable".

supul.sapukotana made it! (author)supul.sapukotana2016-09-09

Have you set up the ip of the Ethernet shield? the ip should be same range as your PC's ip like for PC for shield.

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)

ScottB308 made it! (author)ScottB3082016-11-09

So how do you know if your buying the good one if there is no version numbers on these board ? Also Are you saying the ones with the Bad Resistor values are NO GOOD at all or flakey ?

ReinaldN made it! (author)2016-09-19


i've got the same problem. set a fixed ip.. it doesn't solve the problem but you go further

IPAddress ip(132 ,206 ,95 ,251);
Ethernet.begin(mac, ip);

Jan LoubelleB made it! (author)2016-09-06

I get this message :
Failed to configure Ethernet using DHCP
any idea how to fix this ?
Pls reply asap.
Thanks, it would be a great help

supul.sapukotana made it! (author)supul.sapukotana2016-09-09

Have you configured the ip address of ethernet shield?

SarangA1 made it! (author)2016-03-09

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.

Thanks in advance hopefully someone can help!!

Jan LoubelleB made it! (author)Jan LoubelleB2016-09-06

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

DaveB101 made it! (author)DaveB1012016-07-27

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.

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.

simonM90 made it! (author)simonM902016-03-28

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.

If you already provided external power ignore this comment.

rajdey made it! (author)2016-09-01

Hi ! Your
instructions are very well managed and self explanatory. But I’m
facing issues at the beginning. Whenever I’m powering up the UNO board, the
chip on the Ethernet shield is getting hit up within 2-3 secs. So, I'm unable to start the shield at all.

Please suggest / help...

BelalB made it! (author)2016-06-02

Hi, am able to ping the Ethernet shield but cant get anything in browser.

What's the use of the EthernetServer Server(80)

mabrar made it! (author)2016-05-30

i made an internet controlled rover using the arduino ethernet shield following 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 :(

DragNfLyDale made it! (author)2015-11-01

Thanks Randofo

The Step 5. (Twitter Reader) section does not work. Please confirm this

... I presume it would need a Twitter API

joeb213 made it! (author)joeb2132016-04-14

the twitter api updated and now you need authentication, which i have no idea how you get authentication...

xibraimi made it! (author)2016-01-15

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

AllenQ made it! (author)2015-11-08

I am unable to copy the sample code that you provided. Is it available somewhere that it copied? Thanks.

richfiddler11 made it! (author)richfiddler112016-01-01

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.

DiwanM made it! (author)2015-10-05

Does anyone know how to connect the radio module NRF24L01

GayanH made it! (author)2015-08-20

Can we use wifi insted of CAT5 cables for wireless communication?

hiker_alan made it! (author)2015-07-23

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]

makeosaurus made it! (author)2015-07-09

can you use this shield connected to your computers ethranet port

MalikA5 made it! (author)2015-06-18

please help me, serial monitor can't be open....
it says "Board at COM49 is not available"

animeguard made it! (author)2015-06-03

thanks for sharing nice idea

gcharai made it! (author)2015-05-29

I get this message :
Failed to configure Ethernet using DHCP
any idea how to fix this thx ?

summervin made it! (author)2015-05-11

Hi, thanks for the wonderful walk-through! However, the twitter client doesn't seems to work.. Any idea?

GodoC made it! (author)2015-04-19

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 "check list button" at bottom right of the monitor

嘉瑜陳 made it! (author)2015-03-27

Thanks for the tutorial, but i have a question to the server work example.
If i would like to use other strings other than "$1" and "$2", like "$ledon" for switching on the led connected, what adjustment need to do to the codes.
I find it difficult to solve this problem.

voltman made it! (author)2015-03-25

Didn't work with 1.0, but first time with 1.6.1

oregondunerz made it! (author)2015-02-26

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. :)

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.

Any and all help is appreciated.

cool.honny.5 made it! (author)2015-02-23

This Tutorial is Fantastic and very very very very clear everything.Got this tutorial after 4 days searching on my related topic.

Many Many Thanks Dear.

daniel.kral.37 made it! (author)2015-02-13

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?

Pixelsquared made it! (author)Pixelsquared2015-02-13
how to access the ethernet shield from the outside of the local network - that is from the internet?

You need to port forward the IP and port you are using of the ethernet shield to the internet

This website may help:

I guess the local dynamic IP has to be changed, right..?

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.

you can find your DNS servers, gateway, and subnet by typing ipconfig /all in a windows command line.

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 ipconfig /all and change the numbers after the last dot to 254 and put that in the arduino code as its IP.

Where to get that IP?

If you mean your public IP you can find that by visiting

Sarmadalabbad made it! (author)2015-02-01

Nice thank u

nur.rohmat1 made it! (author)2015-01-26

thanks for your information,

intanrahmithul made it! (author)2015-01-22

IdeS made it! (author)2014-12-01

It's useful thank

midnightcow made it! (author)2014-11-13

Nice Tutorial!!

I'm a engineer in WIZnet providing W5100 to the official Arduino Ethernet Shield.

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.

Thank you.

parth_bhat made it! (author)2013-05-03

my ethernet shields ic gets hot will u plsplspls help me for that
am using arduino leonardo board
pls help me


Gelfling6 made it! (author)Gelfling62013-10-15

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.

alin.bartos made it! (author)alin.bartos2014-10-23

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.

randofo made it! (author)randofo2013-05-03

Did you do anything to change it, and/or did you plug it in correctly? It sounds like you are shorting something.

Gelfling6 made it! (author)Gelfling62014-08-01

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

Dylon124 made it! (author)Dylon1242013-11-09

That happens with my wiznet W5100 too. It just happens I think.

antoniol1 made it! (author)2014-08-29

Thanks a lot work at the first run.No problem with me here.

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:Sponge BotSingle Motor BotChocolate Peanut Butter Fudge Recipe
Add instructable to: