Professional Documents
Culture Documents
Teachers(/teachers/)
ArduinoEthernetShieldTutorial by
randofo(/member/randofo/)inarduino(/explore/category/technology/keyword/arduino/)
AboutThisInstructable
License:
8 846,170 views
738 favorites
randofo
(/member/randofo/)
RandySarafanlovesyou!
(http://www.randysarafan.com)
(/member/randofo/)
Follow 10616
Bio:MynameisRandyandIfoundedthe
InstructablesDesignStudio.I'malsothe
authorofthebooks'SimpleBots,'and'62
Projectsto...More(/member/randofo/)
Morebyrandofo:
(/file/F969ZO6H05NHCWJ/)
(/id/Adjustable(/id/Sponge (/id/Single
Bookshelf/) Bot/) MotorBot/)
TheArduinoEthernetShieldallowsyoutoeasilyconnectyourArduinotothe
internet.ThisshieldenablesyourArduinotosendandreceivedatafrom
anywhereintheworldwithaninternetconnection.Youcanuseittodofunstuff Related
likecontrolrobotsremotelyfromawebsite,orringabelleverytimeyougeta
ArduinoEthernetWebServer
newtwittermessage.Thisshieldopensupendlessamountsofpossibilityby
(HACKED)(/id/Arduino
allowingyoutoconnectyourprojecttotheinternetinnotimeflat. EthernetWebServer
HACKED/)
(/id/Arduino byMatthewBlevins
Step1:Setup connectarduinowith
ethernet(/id/Connect
ArduinoWithEthernet/)
byLuckyS22
(/id/Connect (/member/LuckyS22/)
RunEthernetshieldon
arduino(/id/RunEthernet
shieldonarduino/)
byLinksprite
(/id/Run (/member/Linksprite/)
InternetDevicesforHome
Automation(/id/Internet
DevicesforHome
Automation/)
(/id/Internet byakellyirl(/member/akellyirl/)
ArduinoWebServer
(/id/ArduinoWebServer/)
bydiytransistor
(/member/diytransistor/)
(/id/Arduino
(/file/FZ05SN7H05NT26I/)
Settingitupisassimpleaspluggingtheheaderpinsfromtheshieldintoyour
Arduino.
NotethattheEthernetShieldsoldatRadioshackisonlinecompatiblewith
ArduinoUnoRev.3boards(orlater).Ithastoomanypinstoplugintoearlier
versionArduinoboards.
advertisement
Step2:ShieldFeatures
(/file/FMK3BSQH05NOV88/)
TheEthernetShieldisbasedupontheW51000chip,whichhasaninternal16K
buffer.Ithasaconnectionspeedofupto10/100Mb.Thisisnotthefastest
connectionaround,butisalsonothingtoturnyournoseupat.
ItreliesontheArduinoEthernetlibrary,whichcomesbundledwiththe
developmentenvironment.
ThereisalsoanonboardmicroSDslotwhichenablesyoutostoreaheckofa
lotofdata,andserveupentirewebsitesusingjustyourArduino.Thisrequires
theuseofanexternalSDlibrary,whichdoesnotcomebundledwiththe
software.UsingtheSDcardisnotcoveredinthisInstructable.However,itis
coveredintheStep8(https://www.instructables.com/id/ArduinoWirelessSD
ShieldTutorial/step8/PreparetheSDcard/)oftheWirelessSDcard
instructable.
TheboardalsohasspacefortheadditionofaPoweroverEthernet(PoE)
module,whichallowsyoutopoweryourArduinooveranEthernetconnection.
Forafulltechnicaloverview,seetheofficialEthernetShield
(http://arduino.cc/en/Main/ArduinoEthernetShield)page.
Step3:GetStarted
(/file/FDP0VOXH05NHCWO/)
(/file/FTAOCMQH05Y7KE8/)
PlugtheArduinointoyourcomputer'sUSBport,andtheEthernetshieldinto
yourrouter(ordirectinternetconnection).
Next,opentheArduinodevelopmentenvironment.Ihighlyrecommend
upgradingtoArduino1.0orlater(ifyouhavenotdonesoalready).Thisversion
ofthesoftwarehasbuiltinDHCPsupport,anddoesnotrequiremanually
configuringanIPaddress.
TofigureoutwhatIPaddresshasbeenassignedtoyourboard,openthe
DhcpAddressPrintersketch.Thiscanbefoundat:
File>Examples>Ethernet>DhcpAddressPrinter
Onceopen,youmayneedtochangetheMacaddress.Onnewerversionsof
theEthernetshield,youshouldseethisaddressonastickerattachedtothe
board.Ifyouaremissingasticker,simplymakingupauniquemacaddress
shouldwork.Ifyouareusingmultipleshields,makesureeachhasaunique
macaddress.
Oncethemacaddressisproperlyconfigured,uploadthesketchtoyourArduino,
andopentheserialmonitor.ItshouldprintouttheIPaddressinuse.
Step4:Server
(/file/FSRVTRFH05NTD9O/)
YoucanusetheArduinoEthernetshieldasawebservertoloadanHTMLpage
orfunctionasachatserver.Youcanalsoparserequestssentbyaclient,such
asawebbrowser.Thefollowingtwoexamplesshowhowtouseittoserve
HTMLpages,andparseURLstrings.
OneimportantthingtokeepinmindisthatyouwillhavetoenteryourArduino's
IPaddressinbothoftheexamplesbelowinorderforthemtowork.
Thefollowingcodechangesthewebpageservedbasedonabuttonpress:
/*
WebServerDemo
throwntogetherbyRandySarafan
Asimplewebserverthatchangesthepagethatisserved,triggeredbyabuttonpress.
Circuit:
*Ethernetshieldattachedtopins10,11,12,13
*ConnectabuttonbetweenPinD2and5V
*Connecta10KresistorbetweenPinD2andground
BasedalmostentirelyuponWebServerbyTomIgoeandDavidMellis
Edithistory:
created18Dec2009
Tomakethisexamplecodework,simplyattachabuttonbetweenpinD2and
5V,a10KresistorbetweenpinD2andground,andthenloadtheIPaddressof
yourArduinointoyourwebbrowser.Thepageshouldloadwithablack
background.Pressandholdthebutton,andthenrefreshthebrowserpage.The
siteshouldnowloadwithawhitebackground.
ThefollowingcodelightsupanLEDdependingontheURLthatissenttothe
Arduino:
/*
WebServerDemo
throwntogetherbyRandySarafan
AllowsyoutoturnonandoffanLEDbyenteringdifferenturls.
Toturniton:
http://yourIPaddress/$1
Toturnitoff:
http://yourIPaddress/$2
Circuit:
*Ethernetshieldattachedtopins10,11,12,13
*ConnectanLEDtopinD2andputitinserieswitha220ohmresistortoground
TomakethisworkconnectthepositiveleadanLEDtopinD2,andthenegative
leadinserieswitha220ohmresistortoground.
ToturnontheLEDenterthisintoyourbrowser:
http://[YOURIPADDRESSHERE]/$1
ToturnofftheLEDenterthisintoyourbrowser:
http://[YOURIPADDRESSHERE]/$2
Note:Youshouldobviouslyreplace[YOURIPADDRESSHERE]withyourIP
address.
Step5:Client
(/file/FQLQ62HH05NP76W/)
YoucanalsousetheEthernetShieldasaclient.Inotherwords,youcanuseit
toreadwebsiteslikeawebbrowser.
Websiteshavealotoftextbothvisibleandhidden,whichmakesprogramming
ontheclientsideverytricky.Readinginformationfromwebsitestypically
involvesparsingalotofstrings.Thisismaddening,butworthit,ifthatiswhat
youintendtodo.
IwasgoingtowritesomecodetoreadTwittermessages,butsuchacode
alreadyexistsasanexamplewithintheArduinoprogrammer.Instead,Isimply
modifieditslightlytoturnonanLEDifaspecialmessageisread.
TomakethisworkconnectthepositiveleadanLEDtopinD2,andthenegative
leadinserieswitha220ohmresistortoground.
Don'tforgettoenteryourownIPaddressintothecodebelow,oritwillnotwork.
Hereisthecode:
/*
TwitterClientwithStrings
ThissketchconnectstoTwitterusinganEthernetshield.ItparsestheXML
returned,andlooksfor<text>thisisatweet</text>
YoucanusetheArduinoEthernetshield,ortheAdafruitEthernetshield,
eitheronewillwork,aslongasit'sgotaWiznetEthernetmoduleonboard.
ThisexampleusestheDHCProutinesintheEthernetlibrarywhichispartofthe
Arduinocorefromversion1.0beta1
ThisexampleusestheStringlibrary,whichispartoftheArduinocorefrom
version0019.
Presumablyyouaregoingtowanttoreadsomethingotherthantherecentpost
ontheRandyMcTesterTwitterfeed.
ToreadotherTwitterfeeds,changethefollowingbitoftext:
client.println("GET/1/statuses/user_timeline.xml?screen_name=[NEW
TWITTERNAMEHERE]&count=1HTTP/1.1")
Comments
Wehaveabenicecommentpolicy.
Pleasebepositiveandconstructive. wIMadeit! AddImages PostComment
Hi,Thispostisreallyinformative.
I'mfacingdifficultyconnectingarduinoethernetwithPCusingaswitch(Dlink).
Whenbothareconnecteddirectly(p2p)usingethernetcable,arduinodevice
canbepinged.However,whenconnectedviaswitchpingdoesn'twork,and
bothdevicescan'tcommunicatewitheachotherupdatedtheMACaddr.
severaltimes,nothingworked.I'mstuck.Canyousuggestsomethingonthis?
Ihaveconnectedtheeithernetshielddirectlytomylaptopandputtheminthe
samenetwork,afterthatIwasabletoswitchtheledon/off.butwhenIputmy
laptopandtheshieldtothemyHomenetworkIcanpingtheshieldfromthe
laptopbutIcan'tswitchtheledon/off.
fromthisprogramicantgetmyipaddressfromethernetshield..
ionlygetserverisat0.0.0.0>thisipaddressfromwebserver
whatishoulddo?iamusingethernetshieldHanRunHR911105A16/02
ArduinowithAJAX
https://www.youtube.com/playlist?
list=PLbUAcqHuByzfm9od5kHKArjKIAtfbT0LD
20170120
ItwouldbebetterifyoumakeitinEnglish...Idon'tunderstand
anythingfromyourvideo....
IHAVERECENTLYPURCHASEDANARDUINOKITWITHETHERNET
SHIELDANDIAMNOTABLETOUPLOADTHEPROGRAMONTHE
BOARD.THEERRORSHOWNIS:
THEI/OOPERATIONHASBEENABORTEDBECAUSEOFEITHERA
THREADEXITORANAPPLICATIONREQUEST
KaushalK(/member/KaushalK/)
Igetthismessage: 20150623 Reply
FailedtoconfigureEthernetusingDHCP
anyideahowtofixthisthx?
ipconfig/allgivesmethephysicaladdressthatiputinmac[].
italsosaysdhcpenabled:no
evenifcodeisforDHCPaddressPrinter.
incaseofethernetservercode:
icantopenmyipaddressinwebbrowser.
whenipingitsays"destinationhostunreachable".
supul.sapukotana(/member/supul.sapukotana/) . KaushalK(/member/KaushalK/)
20160909 Reply
HaveyousetuptheipoftheEthernetshield?theip
shouldbesamerangeasyourPC'siplike
192.168.0.2forPC
192.168.0.10forshield.
AndalsosomecheapW5100shieldshasaproblemwitharesistorarray
situatedneartheRJ45socket.Itshouldbe510insteadof511(51Ohm
insteadof510ohm)
ScottB308(/member/ScottB308/) . supul.sapukotana(/member/supul.sapukotana/)
20161109 Reply
Sohowdoyouknowifyourbuyingthegoodoneif
thereisnoversionnumbersontheseboard?AlsoAreyousayingthe
oneswiththeBadResistorvaluesareNOGOODatallorflakey?
hi,
i'vegotthesameproblem.setafixedip..itdoesn'tsolvetheproblembutyou
gofurther
IPAddressip(132,206,95,251)
Ethernet.begin(mac,ip)
Igetthismessage:
FailedtoconfigureEthernetusingDHCP
anyideahowtofixthis?
Plsreplyasap.
Thanks,itwouldbeagreathelp
supul.sapukotana(/member/supul.sapukotana/) . JanLoubelleB
(/member/Jan+LoubelleB/) 20160909 Reply
Haveyouconfiguredtheipaddressofethernetshield?
Hey,IhavebeenusingHanRunHR911105AandwhenIconnectittomy
Laptopthroughethernetcableitdoesn'tdetecttheconnectionandthereisno
blinkingofLED'sontheethernetshieldaswellasontheLaptop.
Thanksinadvancehopefullysomeonecanhelp!!
JanLoubelleB(/member/Jan+LoubelleB/) . SarangA1(/member/SarangA1/)
20160906 Reply
Caniaskifwhatsyourmacadressforyourethernet?
Wehaveaprojectanditsthesameethernetshieldweuse,butwedont
knowthemacaddress.Replyasap.Thankyou
20160727
TheArduinoshieldandthecomputerbothhavethesameRJ45
connections.Thatis,thesendandreceivepinsareonthesamepinfor
bothsenderandreceiver.Ifyouconnectthemdirectlywithacable,the
sendpinsmatchupandthereceivepinsmatchupandthereforeyouget
nocommunications.
YoueitherneedanEthernethub/switchoracrossovercablethatcrosses
overtheSendandReceivepins.Thehub/switchisdefinetlytheeasiest
waytogoandyoucanpickthemupcheaplyfromamazon.
20160328
Justathought,whenyounormallyplugyourArduinoboardinto
yourcomputertheusbcablesuppliesthepower.Mostethernetdoesnot
supportpoweroverinternet(POI),sounlessyouarealsoconnectingto
yourPCusingusbatthesametimeyouwillneedtosupplyexternal
powertoyourboard.
Ifyoualreadyprovidedexternalpowerignorethiscomment.
Hi!Your
instructionsareverywellmanagedandselfexplanatory.ButIm
facingissuesatthebeginning.WheneverImpoweringuptheUNOboard,the
chipontheEthernetshieldisgettinghitupwithin23secs.So,I'munableto
starttheshieldatall.
Pleasesuggest/help...
Hi,amabletopingtheEthernetshieldbutcantgetanythinginbrowser.
What'stheuseoftheEthernetServerServer(80)
imadeaninternetcontrolledroverusingthearduinoethernetshieldfollowing
https://www.instructables.com/id/InternetControlle...
(https://www.instructables.com/id/InternetControlledRCCar/)this
instructables...butitonlyworksformyinternetconnection...icantoperateitfrom
otherinternetconnectionswiththesameipaddress...ifanyonecouldhelp:(
ThanksRandofo
TheStep5.(TwitterReader)sectiondoesnotwork.Pleaseconfirmthis
https://www.instructables.com/member/randofo/
(https://www.instructables.com/member/randofo/)
...IpresumeitwouldneedaTwitterAPI
(https://cdn.instructables.com/F17/YTHG/IGGTXOFC/F17YTHGIGGTXOFC.LARGE.jpg)
20160414
thetwitterapiupdatedandnowyouneedauthentication,which
ihavenoideahowyougetauthentication...
tocopythecodefromthetextarea,simply(testedonchrome)rightClickthe
textAreaandclickinspectelement,thanexpandthetextAreaelementandthere
youhaveit
Iamunabletocopythesamplecodethatyouprovided.Isitavailable
somewherethatitcopied?Thanks.
20160101
Yes,that'sannoyingwishtheauthorwouldchangethat.I
downloadedthePDF,cutandpastedthetextintothearduinoeditor.I
thinkyoumighthavetohaveaproinstructablesmembershiptodownload
thePDF.
DoesanyoneknowhowtoconnecttheradiomoduleNRF24L01
CanweusewifiinstedofCAT5cablesforwirelesscommunication?
lookslikephotoisnotcorrect.Looksliketheblackwireofswitchisconnected
toground,not5V.Hookedupto5Vinsteadanditseemstobeworking.Get
DARK/LIGHTonwebsite[firefox]
canyouusethisshieldconnectedtoyourcomputersethranetport
pleasehelpme,serialmonitorcan'tbeopen....
itsays"BoardatCOM49isnotavailable"
Igetthismessage:
FailedtoconfigureEthernetusingDHCP
anyideahowtofixthisthx?
Hi,thanksforthewonderfulwalkthrough!However,thetwitterclientdoesn't
seemstowork..Anyidea?
Thanks!itworkedforme.Justalittlereminder:togettheinfoonyourmonitor,
don'tforgettosetittothesamebaudrateastheonesetbytheprogram(ie
DhcpAddressePrinter)fortheserialconnection(checkthenumberXXXin
Serial.begin(XXX)).Tochangethebaudrate,youcanusethe"checklist
button"atbottomrightofthemonitor
Thanksforthetutorial,butihaveaquestiontotheserverworkexample.
Ifiwouldliketouseotherstringsotherthan"$1"and"$2",like"$ledon"for
switchingontheledconnected,whatadjustmentneedtodotothecodes.
Ifinditdifficulttosolvethisproblem.
Didn'tworkwith1.0,butfirsttimewith1.6.1
LetmefirststartbysayingthatIamacompletenoobwhenitcomestoanything
Arduino.Mykithasn'tevenarrivedinthemailyetsopleasegoeasyonme.:)
However,Ihaveaquestionregardingthisproject.SpecificallytheRJ45
EthernetShield.InyourexampleyouareusingtheRJ45tointeractwiththe
Arduinoviaawebsite/internet,isitpossibletousetheArduino+Shieldto
interactwithaseriesofrockerswitchesviaa8channelrelayboard?Ifso,Iwas
thinkingthatitwouldmaketheinstallationofmyprojectreallycleanbeingable
tousetheRJ45cablebetweenmyArduinoandtheswitchesthatwillbelocated
perhaps1015feetaway.
Anyandallhelpisappreciated.
ThisTutorialisFantasticandveryveryveryverycleareverything.Gotthis
tutorialafter4dayssearchingonmyrelatedtopic.
ManyManyThanksDear.
Excuseme,doesanyoneknowhowtoaccesstheethernetshieldfromthe
outsideofthelocalnetworkthatisfromtheinternet?Iguessthelocaldynamic
IPhastobechanged,right..?WheretogetthatIP?
Pixelsquared(/member/Pixelsquared/) . daniel.kral.37(/member/daniel.kral.37/)
20150213 Reply
howtoaccesstheethernetshieldfromtheoutside
ofthelocalnetworkthatisfromtheinternet?
YouneedtoportforwardtheIPandportyouareusingoftheethernet
shieldtotheinternet
Thiswebsitemayhelp:http://portforward.com/(http://portforward.com/)
IguessthelocaldynamicIPhastobechanged,right..?
Yesifyouareportforwardingtheethernetshieldshouldhaveastatic
localIP.YoucandefinetheethernetshieldIPinthecode.
http://arduino.cc/en/Reference/EthernetIPAddress
(http://arduino.cc/en/Reference/EthernetIPAddress)
youcanfindyourDNSservers,gateway,andsubnetbytypingipconfig/all
inawindowscommandline.
Maketheipoftheethernetshieldanyipnotcurrentlyusedonyou
network.AneasywaydodothisistotakeIPaddresslistedinipconfig/all
andchangethenumbersafterthelastdotto254andputthatinthe
arduinocodeasitsIP.
WheretogetthatIP?
IfyoumeanyourpublicIPyoucanfindthatbyvisiting
http://www.whatismyip.com/(http://www.whatismyip.com/)
Nicethanku
thanksforyourinformation,
secretfood.net
It'susefulthank
NiceTutorial!!
I'maengineerinWIZnetprovidingW5100totheofficialArduinoEthernet
Shield.
WIZnetmadeW5500andWIZ550io/ioShieldA.IfyouareinterestedinW5500
andmakeatutorialofW5500,IwillgiveaWIZ550iotoyoufree.Ifyouwant,
feelfreelytocontactme.
Thankyou.
myethernetshieldsicgetshotwilluplsplsplshelpmeforthat
amusingarduinoleonardoboard
plshelpme
regards
pyt
20131015
IhaveoneoftheNonPOE(powerOverEthernet)5100's,and
itdoesthesametome..Ithinkit'sthe3.3Vregulatortryingtorunthe
singlechip,whichischewingupmassivewattage..(evenifitisbeing
poweredfromthe+5VregulatorfromtheArduino.)I'veoftenwondered,if
Icouldrepowerthisoffthe3.3Voffanexternalpowersupply,but
someonesaidthat'sabadidea,asthebackfeedcouldburnoutthe
regulator,andotherchipsswitchingbetweenthe9downto5,and5down
to3.3,oreventheUSBtoserialchip.
20141023
Youneedtosupplythearduinoandtheshieldwith7or7.5v,
youcanuseadcdcpowerregulator.Iusea12vpowersuplyandadcto
dcregulator,whogiveme7.5vandeverythingisfine.
20130503
Didyoudoanythingtochangeit,and/ordidyouplugitin
correctly?Itsoundslikeyouareshortingsomething.
Wow!awholeyearlater?No,It'ssomethingaboutthe3.3regulator,that
ishandlingalotofamperagefromthe5100..IthoughtIsawsomewhere
onanotherinstructable,someonesolvedtheproblem(slightly)by
DOUBLINGtheregulator.(stackinganotheroneontopoftheoriginal,so
youhad2inparallel.)https://www.instructables.com/id/Beefupyour
Arduinopower/
20131109
ThathappenswithmywiznetW5100too.ItjusthappensIthink.
I MoreComments
Newsletter AboutUs
Letyourinboxhelpyoudiscoverourbest WhoWeAre(/about/)
projects,classes,andcontests.Instructables Advertise(/advertise/)
willhelpyoulearnhowtomakeanything! Contact(/about/contact.jsp)
Jobs(/community/PositionsavailableatInstructables/)
enteremail I'min!
Help(/id/howtowriteagreatinstructable/)
FindUs Resources
Facebook(http://www.facebook.com/instructables) ForTeachers(/teachers/)
Youtube(http://www.youtube.com/user/instructablestv) ResidencyProgram(/pier9residency)
Twitter(http://www.twitter.com/instructables) GiftPremiumAccount(/account/give?sourcea=footer)
Forums(/community/?categoryGroup=all&category=all)
Pinterest(http://www.pinterest.com/instructables)
Answers(/tag/typequestion/?sort=RECENT)
Google+(https://plus.google.com/+instructables)
Sitemap(/sitemap/)
TermsofService(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) |
PrivacyStatement(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079) |
LegalNotices&Trademarks(http://usa.autodesk.com/legalnoticestrademarks/) | MobileSite(https://www.instructables.com)
(http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)
2017Autodesk,Inc.