shield.I’llbecontrollingoneLEDandaservo,butyoucanapplythismethodtocontrolanyelectronicdeviceyouwant.(suchasDCmotors,buzzers,relays,steppermotors,etc..)
essthatwebserverthroughyourbrowser.Afterthatitshowsawebpagesimilartothatonebelow.Whenyoupressthebutton“TurnOnLED”yoururlwillchangeto:“/toolstofindallthepartsforyourprojectsatthebestprice!
Note:essthatIPaddressfromyourhome.Thismeansyoumustbeconnectedtothesamerouterthatyou’essingmywebserverwithmyiPad.
Thanksforreading,ment.Ifyoulikethispostprobablyyoumightlikemynextones,sopleasesupportmebysubscribingmyblogandmyFacebookPage.
BuildWebServerprojectswiththeESP32andESP8266boardstocontroloutputsandmonitorsensorsremotely.LearnHTML,CSS,municationprotocolsDOWNLOAD»
BuildaHomeAutomationSystemfromScratch»WithRaspberryPi,ESP8266,Arduino,andNode-RED.
HomeAutomationusingESP8266eBookandvideocourse»BuildIoTandhomeautomationprojects.
ArduinoStep-by-StepProjects»Build25Arduinoprojectswithourcourse,evenwithnopriorexperience!
Thanksforyourfeedback!yesthat’sexactlywhatIwanttoshow.youcanusethiscodetoapplytoyourownprojectsforhomeautomation
Wow….reallyawesomeprojectdude.YoucanuseHTMLalsotocreateattractiveandpowerfulwebapplicationi.e.webpage.Iwillgiveyoulinkaboutthat.Thisisthelinkhere:ofthings-pune.blogspot.in/2013/07/this-is-open-source-home-automation.html
Hi!!ThanksforthefeedbackErAjinkyaDixit!YeswecancustomizetheCSSfileandtheHTMLtocreateabetterwebpage.ButI’eryexperiencedinthatprogramminglanguagesyet.SoI’vejustmadeabasicwebpagewithmyknowledgeThanksfortheresource!Mynextwebpagewillbemorecustomized.
Hi,yesCon.Youcandownloadthesourcecodeforthewebpagehere:/downloadOrsimplyclickthelikeortweetbuttonandthedownloadlinkwillunlock.
thebestwayisbyenteringyouremailandyou’esstoasecretpagewhereyoucandownloadallmyprojectseverytimeIreleaseanewone.
hmmIpressedlikebutonlygotthesourcecodeforthearduinonotthebrowser
wouldupleasesendmetheandroidwebpagesourcecode
whatyoumeanbytheandroidwebpage?essedthroughyourtablet/smartphonebrowser…andallthement,Rui
whataniceprojectrui,butit’shield,canyshield,orhowtoconfigurethatonrouterusingdhpc?
ThanksDecka.RightnowI’shield.Sostaytuned,becausethatprojectwillbereleasedsoon…Imightdowhatyou’relookingforlaterthough.Allthebest,Rui
YeahIknow,Igotit!UnfortuneletyIdon’thavetimerightnowtodothat.asisaid…maybelater
Thankyouverymuchforyourreplyandineedsomemoredetailslikeiwanttogetthesensorvaluethroughhtml..and.iwanttoknowwhatisgoingonhomethroughsensor..supposeifanyhumanisenterintothehome.ithastoinformtowebpagethroughHTMLusingPIRsensor….sothiskindofapplicationineed…ihopeyouwillunderstandverywell,pletemyprojectassoonaspossible…..
HiNataraj,sorryfortakingafewdaystoanswer..I’vebeenreallybusy.Whatyou’relookingforisanArduinodatawebserver…hatprojectwithmineifyouwanttocustomizethelookofthehmtlpage!
Hi,Reallygreatprojectshere!Ilearnedalot.Aquestion:Iseewhenclickingthebuttonsonthepagetheyworkokeforawhilebitaftersometimethesiteseemstohang.Sometimestextsmessedupandnothingworksanymore.Doyourecognizethis?Isthereasolution?IseeithappensrunningIEonmyPCbutalsorunningChromebrowserandSafarionmyiPad.
work/shield.InanotherprojectI’shieldisconnectedfortoolong,Itgetsdisconnectedandnolongerworksuntilyouresetmanuallythearduino.
WiththiswebserverprojectI’vetestedtorunfor17hours,8hours,mendyoutodo,menttheprojectwithSerial.print(s…
HelloRul,Thanksforyourhelp!Yes,it’5100chip.IordereditfromBangGood.Workedfineinotherprojects.Youwrote:“17hours,8hours,32hours…”buthaveyoualsodonesometestingbyusingallbuttonsoneafteranothermultipletimes?Let’ssay10time.
HelloRui,Ithinktheproblemisfixed.Changedthedelaytimefrom1to100inthispartofthesketch:
I’mgladtohearthat!ThanksfortryingmyprojectJaap.
ifyoucanhelpmecontrolthelightsviatheweb,controllightintensity,
SearchonthewebforaPWMprojecttocontrolthelightsintensity.Thenchangemycodeforthisproject.soinsteadofcontrollinganledtoturnon/offyou’regoingtoincreaseordecreasethelight.
InoticethecodereferencesaCSSfile.Isitpossibletohavethecodebestandalone?MeaningonewouldnothavetohostaCSSfile?
yes,youcancustomizethehtmlwithouttheCSSfile.TheCSSjustmakesiteasytocustomizethehtmlwithoutrepeatingthesamestylingoptionsagainandagain.
HiRui,I’butIhaveoneproblem…With4leds,worksok,butifIconfigurea5thled,don´twork…..
CanIsendyouthecodetosomeemailtoseeifyouseeanyfaults??(Iderecognizesthecodewithouterrors..)
HiMurp,Idon’thavethetimetodebugyourcodeI’msorry…Idon’tknowhowexperiencedyouarewithElectronics,sojustafewquestionsareyoudefiningtherightLED’spinsproperlyasinputs?areyourLED’sintherightway?
Toyourquestions,noandyes..Ledsareconfiguredas“int”–>outputsandallisconnectedok(Itworksokwith4butnotwith5..With5,thebuttonsareonscreenbutdon´tworkifIpressany…)
Thecode,Ithinkthatworksright(NoerroronIDE,lessthan20000bytes),butIdon´tunderstandwhat´sthematter…
Andallworksok(Arduino,leds,ions,code…),andforthat,ponents..
Regards(Aboutmyexperiencewithelectronics,let’ssaymylevelismediumjeje)
Thatmightbeaproblemwithyourhtmlthen…You’reprobablydoingsomesortofmistakethatmakesanerroronthehtmlpage(inyourip/webserverpage)andbreaksthepagessoanybuttonworks…
esarycode,anymoreline,anylessline,andbecauseIdon´tunderstandwhatistheproblem…
firstofalliwouldliketosaythanksforsharingallthosesupercoolprojects.
whenyouarenotinhomeifyouopenaportatyourrouterandsetittoforwardthepackagestoarduino(imtalkingaboutasimpleportforward)essarduinoswebpag?
HiDimitris,You’re100%rightthisprojectcouldworkexactlyasyoudescribed.There’sjustoneproblem,anyonewithyouripcancontrolyourhome.(Andthat’sreallyeasytofindifsomeoneleavesnearyou…)
ThebestwaytodothatistoencryptthatdataandalsocreatesomesortofauthenticationbutthatrequiresamorepowerfuldevicesuchasaRaspberryPiforexample.I’vemadeaprojectthatalshield.pleasetakealook:/
Hei,it’sawesomeprojectdude.Ihaveaquestionforyou.AfterIreadthisproject,canIassumethattheLEDandservowascontrolledoverIP?orit’ssomethingdifferent?
You’rerightdany.WiththismethodyoucanonlycontroltheLEDandservoifyou’reconnectedtothesamerouter.Thenyouopenthebrowserwiththearduinowebserverip
Thanksforyourresponse,sojustlikewhatIthought.I’mabitcurious,canitworksonalinuxrouter?Doyouthinkitcanwork?
Hi,essthewebserverthroughmybrowser.Itypedtheaddress:192.168.1.178onmybrowswer,itshownablankpage.Isitbecauseofmyrouter?Thanks
I’mnotsure,Itshouldbeworkingjustfine…there’patibilitywithyourrouter.
HelloRui,HowicanaddmorepagestothissayHomePage:ControltworelaysFirstFloor:ControltworelaysandsensorsLikethat
HowicanaddmorepagestothisprojectSayHomePage:ControlTworelaysFirstFloor:ControlrelaysandsensorsMasterBedRoom:etc…..PlsHelp
HiHallow,Simplyinsertthosebuttonsonmyarduinocode,takealookatmycodeandseehowiaddtheotherbuttons.
HelloRuiyousaidearlierthatarduinoisnotpowerfullenoughforencryptionandsoanyonemightbeabletocontrollyourhouseusingthiswebserver.ithoughtaboutitandimodifiedyourcodeinordertocreateasimplepin-passwordthatisneededinordertoactivatetherelays.
itisdonebydeclaringanewvariablethatneedstogetacertainvalueinordertolettherelaysactivate.
inordertogivevaluestothisvariableiadded12newbuttonsfor0-
9,*and#whatiamdoingissimpleoradvancedmathematicoperationsinordertogiveaspecificvalueinthevariablebypressingthecorrectpinonthebuttonsiadded.thisisthelinkofthesketchimade.itmaybeusefulltosomeone./s/1w1nolo7i6ufb0p/web_server_modified_pc_control.inorelayspassword:ariablevaluetobenumber9whenyouarriveatthewebsitethepinvariablevaluressthebutton4inordertoadd4tothepinvariablefollowedby3inordertomultiplythecurrentpinvalue
(4)*3followedby2inordertosubstruct2fromthecurrentpinvalueandfinally1inordertosubstruct1fromthecurrentpinvalueafterthisthefinalpinvariablevalueis9andnowyoucanactivatetherelays.
soinconclusionyoucanselectwhatmathematicoperationdoeseverysinglebutton,youcanuseasmanydigitsasyouwantforthepin(4-5-8-10buttons)andyoucanalsoselectthevalueofeverysinglebutton,whichmeansyoucandoprettymuchanythingwiththepassword.
nowanotherinterestingthingidone,isthatiseteverysinglebuttonthutrandompasswordshewillkeepresetingthepinvalueandwontbeabletoactivatetherelays.youcanalsousethisfunctionifyoumistakenlypressedtwiceabuttonwhichwillmeanthatthepinvaluewillbewrongandyouwillhavetoresetthepinvalueinordertoreenterthepassword.justpressanyoftheunusedbuttonsandthepinisreseted.youcanaddbigpasswordslike812digitsandsoontomakebruteforceattacksdifficultoryoucanaddbuttonswithletterstoo.
iaddedsomepinvaluereportsoverserialconnectionfordebuggingandalsoiadded2outputsinordertoconnect2ledswitharesistoroneachoneofthem.oneledisoffwhenthepinvalueisnotyetcorrectandlightsuponlywhenthepinvalueiscorrect(passwordcorrect)thesecondoneiskeptoffwhenthepinvalueislowerthanthecorrectoneandisturnedonifthepinvalueisoverthecorrectone.those2ledsisjustforvisualindicationofpin-passwordstatus(foments)
finallythelastmodificationimadeisthatiremovedtheservobuttonsandimadetheotheputer’spowerandresetbuttons.
thatsit,theprojectfinallyisheavillymodifiesinordertomatchmyneedsbutithoughtishouldpostitherebecausesomeonemaywanttousesimplepasswordprotectedrelaysinthiswebserverproject.ihopeyouandeveryoneelselikesit.
HiDimitris,Thankyousomuchforsharingyourwork!It’sareallycleverideawhatyoudidthere.ThedataisstillnotencryptedbySSHforexample,soifsomeoessyourwebserver.(Ifyouhaveyourrouterportsopen)
Again,thanksforsharing!Imightdoatutorial/projectwithyourideainmind.Haveaniceday,RuiSantos
heerycool,itrytounderstandbutnotreallyhelp,tq
Firstlyletmeinformyouthatiamnoarduinoexpert.iamjustabeginnerwhohasalmostnoknowledgeonprogramming.afterallididntusedthisprojectbecausewhileatfirstitwasworkingokafterafewhoursarduinowascrashing.ithoughtitmusthadtodowithitsmemorygettingfullanditriedremovingalltheunnecessarystufffromthecodewhichdidhelpbutstillarduinowascrashingafterafewdaysandtheprojectwaitfromcrashingortolocatetheproblembuthavingsaidthatifyoustillneedmoreinfoandwanttogetthelatestsketchimadethatworksforafewdaysicanemailittoyousoyoucantrytofixit.
thebasicideaisprettysimpleactually.intheoriginalprojectmadebyruiyoucouldjustpressabuttontoactivatearelay.iwantedtodialapasswordbeforebeingabletoactivatetherelays.inordertodoityouneedto1)declareanewvariableatthesetuppartofthesketchwhichwillbesetat0atthebeggining(umberinordertoallowtheuseoftherelays)2)addmorebuttonsonthewebpageinordertohaveanumerickeypad3)makethesenewbuttonstoaddanumbertothevariableyoudeclaredtostep1,youcanalsosubstructanumberfromthevariable,multiplyanumberormakeanymathepaticoperationandstorethenewvaluetothevariable4)mandinordertooperatetherelays)ifthevariabledeclaredinahasacertainvaluethenactivatetherelay,ifnotresetthevariablevalue(soanewpincanbeentered)
HiTristan,DefinitelytheArduinoYunisreallypowerful.IntheArduinoIDEexamplescodetabyouwillfindsimilarprojectsthatprovideyouawebinterfaceforyourproject
hi!Ruithanksforthepost…sheild,iwanttomakeaprojectlikeyours,sheild,andhowtoconnectunowithpc(Whichport)?and,sheildworkwithoutarduinouno?
Youcanconnectyourarduinotoanypcportyouwant.TheninyourArduinoIDEyoujustneedtoselecttherightCOMportforyourproject(UsuallytheArduinoIDEselectstherightCOMportbydefault)shield,becausetheArduinounobyhimselfcan’tserveawebpage.
Hellorui,imhavingsometroublewiththisprojectandisuspectthatsomewhereinyourcodeyouhavemadeamistake.sinceidontreallyknowtocodeithoughtishouldgiveyousomeinformationandmaybeyouhaveaclueonwhatsgoingonorthepossiblereason.
theonlymodificapletelyremovedeverythingthathastodowiththeservobutton-libraryandinsteadthebuttonthatusedtocontrolltheservonowisjustanonoffswitchliketheledswitch.theproblemisthatifyoukeepessthepage,ingthearduinoipaddressitrespondstothepingsbutdoesntservethepage.inordertofixthisallyouhavetodoistoopenthearduinosdkandjustenabletheserialmonitor.nothingmore!justthat!oncethewindowoftheserialmonitoropensandthearduinoreportsthatthewebserverrunsontheipaddressyousetit,thenthewebpageimmediatelystartstobeservedagain.
iwastryingsomehesrespondingsoithoughtthatmaybethereisamemoryoverflowissueorsomethinglikethat.
thenagainidontknowifitsrouterrelated,stoforwardtheporttothearduinoandyouhavetosetthearduinotosendpackagestotherouterfromtimetotimesotherouteralwaysknowsthatthearduinoisstillconnected-workingandneedstoreceivethepackagesontheport80.
ihopeyoucanreviewyourcodeandfindoutwhatiscausingthismalfunction,becausethisisareallyniceprojectbutthismalfunctionmakesitunusable.
WhatifweusearduinoWIFISHIELD?Isthesourcecodethesame?
Ruiantesdemaisdeixa-mefelicitar-teporpartilharesosteusexcelentesprojetos.Omeunívelemprogramaçãoémuitobaixoentãogostariadetefazerumapergunta.ÉpossívelcorreroCSSapartirdoSDcard?
Renomeeioficheiropararespeitaroformato8.3Consigoiniciarosdcardelistarosficheiros,masnãoreferiroficheironocódigodoarduino.
masapáginaaparecesemaformatação.Agradeçodesdejátodaaajudaquemepuderesdarousenãotiverestempoquemeapontassesnadireçãocerta
JáresolvioproblemametiocódigoCSSdentrodoHTMLcasocontrárioteriadechamarumsegundoficheironoarduinoparaalemdoindex.htm(style.cssporex)pararesponderaopedidoHTTPeapresentarapáaformataçãopretendida.
helloIcannotseemtocontrolmyarduinobecausethewebpageisnotdisplayedhelpme
Ruisiryourprojectsarereallyawesumnit’shelpswestudentwhoesnewforthisarduino!!!!thanksruisir
Hey..SendmewebpagecodinganddetailedprocessforthisprojectTy…
Youcandownloadthecoderighthereonthisblogpost.Thanks!
heyruisantos…shieldhlk-rm04tocreatesomewebserver.tq…
FirstlyIwannathankyoutoshareyourknowledgewithus.
Ihavebasedinyourprojecttoimplementmyone.Iwannaturnon/turnoffseverallights(butIneedtomonitortherealstatusoftheselights),controlTVs,radioandetc.IknowhowtodothisinArduino,butIhavedifficultyinphp.
Inthisprogrambelow,Iamusingjustonebuttontoturnon/turnoffalightandIamusingaLDRsensortocheckthelight’sstatus.
HowIwannausetheArduinoinpararelwithaswitchinthewall,thestatusoflightjustupdatewhenIrefreshthewebpage.Thisisn’thappeningautomatically.
Mydoubtis:howcanIchangethisprogramtoupdatethestatusalwaysthischangedwithoutneedtorefreshthepage?
/*ReferencedbyRuiSantosVisit:formorearduinoprojects
intRele_1=2;//IluminaçãoEntradabyteEstado_rele_1=0;//Estadobobinadoreléintsensor=0;//PinoanalógicoemqueosensorLDRestáalorSensor=0;//Variávelusadaparalerovalordosensoremtemporeal.
bytemac[]={0xDE,0xAD,0xBE,0xEF,0xFE,0xED};//physicalmacaddressbyteip[]={192,168,25,105};//ipinlan(that’swhatyouneedtouseinyourbrowser.(“192.168.1.178”)bytegateway[]={192,168,25,1};//[]={255,255,255,0};//Serverserver(80);//serverportStringreadString;
voidsetup(){//municationsandwaitforporttoopen:Serial.begin(9600);//velocidadedaconecaowhile(!Serial){;//waitforserialporttoconnect.NeededforLeonardoonly}//apostersetadoopino,coçlocandoqualsuafunçãopinMode(Rele_
1,OUTPUT);
//connectionandtheserver://.begin(mac,ip,gateway,);server.begin();Serial.print(“serverisat“);Serial.println(.localIP());}
voidloop(){//Clientclient=server.available();if(client){while(client.connected()){if(client.available()){charc=client.read();
//readcharbycharHTTPrequestif(readString.length()0){Estado_rele_1=!Estado_rele_1;digitalWrite(Rele_
1,Estado_rele_1);delay(50);}//clearingstringfornextreadreadString=””;
Willthisprojectwillworkanywhereandanyplaceaslongasthearduinoandthedevicecontrollingitareconnectedinthesamerouter?CanIconnectittodifferentroutersandIwillworkoneachofthem??
essthewebserverwhenyou’reconnectedwithdevicethatisconnectedtothesamerouter.
hyerui,mandintoarduinounoandtheniinputtheipaddressatthebrowser,thebrowsercan’tdetectthatip,whattheproblemrui??
esscontrolwebsites(ip192168178)Itriedtochangeitbutfailed.I’ments,butnotpositiveplsreplyforme..sorryforbadenglishproficiency.tksreplyormail:phuphi,cool@
utinyourownIPaddressordoesitnotmatter?Thanks
work.ThatIPaddressthatI’vesetwillworkinmostcases
#include#includebytemac[]={0xDE,0xAD,0xBE,0xEF,0xFE,0xED};IPAddressip(172,16,20,157);IPAddressgateway(172,16,16,1);(255,255,224,0);
inte2=10;intin3=11;intin4=12;intcount=0;voidsetup(){
Serial.begin(9600);while(!Serial){//waitforserialporttoconnect.NeededforLeonardoonly}.begin(mac,ip);server.begin();Serial.print(“serverisat“);Serial.println(.localIP());Serial.println(“configuretheinputandoutput”);pinMode(
8,INPUT);pinMode(
2,OUTPUT);pinMode(e1,OUTPUT);pinMode(e2,OUTPUT);pinMode(in1,OUTPUT);pinMode(in2,OUTPUT);pinMode(in3,OUTPUT);pinMode(in4,OUTPUT);
(){Clientclient=server.available();if(client){Serial.println(“newclient”);//anhttprequestendswithablanklinebooleancurrentLineIsBlank=true;while(client.connected()){if(client.available()){charc=client.read();Serial.write(c);//ifyou’vegottentotheendoftheline(receivedanewline//character)andthelineisblank,thehttprequesthasended,//soyoucansendareplyif(c==‘ ’