Sointoday's video, we'regoingtobeusingourweknowyouknow, a WiFiand L 298 inmotormodule, a fanandananalogtemperaturesensortobeabletocreate a wirelesssensorthatwillbeabletogiveyounotificationsandyou'llbeabletomanuallytrigger a fan.
So a lotoftheprojectsthatwedo, wehavesometypeofsensor.
Andthenthatsensoriswhatautomaticallytriggers a physicaleventhappen.
Basically, theArduino, youknowisgoingtocontinuouslyreadfromtheanalogtemperaturesensor, andthenit's goingtogiveanoutputthatwecanseein a Webbrowser, soitwillshowus a verybignumberforthetemperature.
Providethatin a formatthatyoucanusein a Webbrowser, andthenifthetemperaturegetstoohighandyoudecidetoturnonthefan, thenyoucanclickon a linkandturnonthefan.
Sowiththat, let's goovertheworkbenchso I canshowyouthecomponentsthatareinvolvedinthisproject.
Then I'llshowyouthecodeandthen I'llshowyouhowitallcomestogether.
Sohereistheprojectasit's beenbuilt.
Unfortunately, thislooks a littlebitoflike a mess, but I'lltrytoexplaineverythinggoingonhere.
Now, ifwe'regoingtotake a lookatthis l 298 in a motormodule, oneofthethings I havetalkedaboutinthepastwiththesemodelsisthattherearemultiplewaysinordertopowerthemoduleand a powerthewholesystem.
Now, Oneofthereasonsthat I didthisisthatwe'rehaving a weirdproblemwiththeanalogtemperaturesensor.
The M L.
A temperaturesensorwasactingreallyquirkywhen I actuallyconnectedthepowersuppliesandthesethingsweretryingthiopowereachotherwhennothingwasconnected, itwouldworkfine.
Butwhen I wouldconnectthe 12 voltpowersupplytotheArduinoboard, powerwouldcomeinpowerwouldcomeintotheanalogtemperaturesensor, buttheoutputthatwouldcomeoutwouldgetallwonky.
I'm honestlynotsurewhythatoccurred, butitwas a problemthat, frankly, I couldn't getaround.
Andsothisis a reasonwhyyoumaywanttohaveeverythingonseparateelectricalcircuits, butthisisbasicallywhatwehavesetupforhere.
I hopethatmakessense.
I knowit's getting a littleconfusing.
There's a lotofstuffgoingon, butreally, ifyoujust, youjustgothroughandlookatthecodeandyoulookateverything, yourealizethatit's actuallynotthatcomplicatedsothatlet's gooverandtake a lookatthecode.
Sohere's a codeforthisparticularproject.
Itmayseem a littlebitcomplicatedatfirstblush, butwhatyou'llnoticeifyoutake a lookatitisreallyWe'rejustdoing a lotofcopypasting a littlebitofmodificationandaddontoalltheprojectsthatwehavedoneinthepastandagain.
That's reallywhatanyprojectis.
Youtakeallthelittlecomponentsyoucreatedbeforeblewthemorducttapedthemtogethertogetsomething a lotlarger.
Sothefirstthingthatwe'regoingtodoiswe'regonnahavetoincludethelibrariesfortheWiFicommunicationSP I not H andWiFiNaina.
Sothiswillallowustocommunicatewithyard.
Weknowboardoverwifi.
Instance, wehavethatanalogtemperaturesensor.
Wehavetodefinethetemperaturesensorpen.
Sotofind a tempsensor a fivesothetemperaturesensorisgoingtoconnecttoanalogpanfive.
Thenwehavetodefinethepinsthataregoingtoberequiredforthemotormodule s o onthemotormanual.
E n A.
There's a pencalled e n A andthatisforspeed.
There's I inone, and I andtwo I, andoneisthefirstpowerpenonthemotormodule.
Iantoisthesecond.
Andsospeedisgoingtogotodigitalpeneightonthere.
Weknowborn I andonewillget a digitalpinnineandIanto, gotoDick.
It'llpan 10.
Theyweregonnagodown.
We'regonnasetupeverythingfortheWiFi.
So P r s s I d equalstest.
I have a guestWiFinetworksetuponmynetwork.
I havesimplyputthe s s i d totestwehave a carpassword.
Ifyouhave a passwordforyouryournetwork.
Thisiswhereyouwouldputitin.
I haveleftmineblank.
Yes, I don't havetotroubleshootcrappypasswordthingswhile I'm doingallofthis.
Thenwehaveendkeyindex.
Ifyou'reusingmultiplekeysonyourwife, I Youwouldputsomethinginhereagain.
012345678 Wedon't haveanythingtoworryabout.
Soit's justsaidit.
Zerothenpassedthatwe'regoingtocreate a variableforthestatusfortheWiFiconnectionorjustdon't setthat w ellidolstatus.
Thenwe'regoingtohave a WiFiserverandwe'regoingtosettheservertoport 80.
Soifthere's a reasonyouwanttobeon a differentpoor, let's sayyou'redoingporkforwardedfromtheoutsideworld.
IfweneedThio, no, we'regonnadoiswe'regonnacomedownhere.
I'm goingtoSouthieEnvironmentthatthissketchisgoingtorunin, sowedopinmode e n a I andoneeyeandtwoandweallsetthosetwooutputthoseairdigitalpinssoon, they'regoingtobesendinginformationtothemotormodule, sowesendthemtooutput.
Thenwhatwe'regoingtodowiththat E and a peniswe'regonnaanalogrightin a 2 55 Sobasically, we'rewritingtothe e n a pen, andwe'resayingwhatspeedwewantthemotortorunat.
SothisisagaincopyandpastefromallofourotheranalogtemperatureprojectsReadingvoltagetemperature, Seetemperature f Thisjustthisjustpullsin, pullsintheinformationfromtheanalog a temperaturesensoron, thenturnsthatintosomethingthatwecanactuallyuseforthis.