Cov txheej txheem:

UCL-lloT-Sab nraum zoov-teeb Triggered los ntawm Sunrise/sundown: 6 Cov kauj ruam
UCL-lloT-Sab nraum zoov-teeb Triggered los ntawm Sunrise/sundown: 6 Cov kauj ruam

Video: UCL-lloT-Sab nraum zoov-teeb Triggered los ntawm Sunrise/sundown: 6 Cov kauj ruam

Video: UCL-lloT-Sab nraum zoov-teeb Triggered los ntawm Sunrise/sundown: 6 Cov kauj ruam
Video: Austin Mahone - Mmm Yeah ft. Pitbull 2024, Hlis ntuj nqeg
Anonim
UCL-lloT-Sab nraum zoov-lub teeb txhais los ntawm Sunrise/hnub poob
UCL-lloT-Sab nraum zoov-lub teeb txhais los ntawm Sunrise/hnub poob

Nyob zoo txhua tus! Nrog kev ua haujlwm me ntsis, qee ntu thiab cov cai kuv tau sau ua ke cov lus qhia no uas yuav qhia koj txij thaum pib mus txog qhov kawg yuav ua li cas tsim lub teeb sab nraum zoov no. Lub tswv yim pib los ntawm kuv txiv, leej twg thaum lub caij ntuj sov yuav tsum tawm mus thiab hloov pauv thaum lub teeb ci los ntawm. Nrog lub hnub poob hloov pauv sai thiab lub hnub tuaj txhua lub xyoo puag ncig, nws nug yog tias kuv tuaj yeem nrhiav txoj hauv kev los ua nws. Thiab yog li peb nyob ntawm no. Ib txoj haujlwm me me.

Kauj Ruam 1: IO Sau Npe thiab Yam Koj Yuav Tsum Tau

Cov npe IO thiab yam koj xav tau
Cov npe IO thiab yam koj xav tau
Cov npe IO thiab yam koj xav tau
Cov npe IO thiab yam koj xav tau
Cov npe IO thiab yam koj xav tau
Cov npe IO thiab yam koj xav tau

Arduino MEGA 2560. Nws yog qhov kuv tau siv tsawg kawg, Kuv paub tias koj tuaj yeem siv lwm tus tau yooj yim.

DS3231 thiab nws yog lub tsev qiv ntawv. (https://rinkydinkelectronics.com/library.php?id=73… Nws yog ib qho tseem ceeb kom paub tias cov pins teeb tsa rau SDA thiab SCL txawv li cas nyob ntawm Arduino koj tab tom siv.

I052116 IR Infrared Motion Detector Sensor Module. Cov qauv tshwj xeeb no tuaj yeem sib pauv rau koj lub sensor ntawm kev xaiv, nws ncaj ncees xaiv tau rau txhua yam.

Kauj ruam 2: Flowchart

Daim phiaj
Daim phiaj

Raws li pom hauv daim duab yooj yim, ntau qhov hnyav nqa nyob hauv Node-Red. Nrog cov kab yooj yim, lub tswv yim yog los ntawm Node-Red koj yuav ncav tes mus rau lub vev xaib uas paub tias lub hnub poob thiab sawv thaum twg. Thaum nws muaj nws, nws yuav xa cov ntaub ntawv mus rau Arduino qhia nws. Los ntawm Arduino peb yuav tau txais lub teeb liab uas qhia meej thaum lub Teeb tau ua tiav, yog li koj tuaj yeem tshawb xyuas los ntawm koj lub tsev tsuas yog thaum lub teeb hlawv tawm., uas muaj lub teeb tig rau x lub sijhawm.

Kauj ruam 3: Fritzing

Fritzing
Fritzing

Muab piv rau lwm cov phiaj xwm kev cabling yog qhov yooj yim ntawm no. Dab tsi koj yuav tsum tau paub txog yog tias koj yuav xav tau WIFI module txhawm rau tiv tauj nrog Node-Red server, lossis tau txais lub computer pov tseg los tuav Node-Red server ntawm qhov uas txuas nrog Arduino. Tsis pom ntawm daim duab yog kev sib txuas ntawm Arduino thiab Laptop, thiab kuv thov txim ua ntej rau qhov tsis zoo Fritzing daim duab!

Kauj ruam 4: Coding

Coding
Coding
Coding
Coding

Yog tias muaj ib yam kuv pom yog tias nrog Firmata (rau Arduino kev sib txuas lus nrog Node-Red), lub tsev qiv ntawv DS3231 thiab ntau dua, muaj ntau lub tsev qiv ntawv thauj khoom. Raws li tau tshaj tawm, cov lej tsis ua tiav, yog li pseudo-code suav nrog.

Suav nrog hauv lub tsev qiv ntawv los ntawm DS3231 tau teeb tsa ua ntej rau txhua tus ntawm Arduino cov laug cam, thiab thaum Mega nws tus pin 20 thiab 21 vim lawv yog SDA thiab SCL pins ntawm mega. Thaum sib txuas, lub moos tuaj yeem hais qhia meej tias nws yog hnub twg, thiab nws yuav tsum ua dab tsi. Dab tsi kuv pom tias ua haujlwm tau yooj yim dua thaum nws los txog rau taug qab cov lej, yog siv int tsis siv txoj hlua. Yog li kuv tau ua dab tsi yog tias kuv hloov cov lej ntawm txoj hlua rau hauv int, tab sis raws li int siv tsis tau: cais lub moos, kuv txiav txim siab ua lwm yam ntxiv. nrog feeb. Ntau feeb. Yog hais tias lub moos yog 13:21 piv txwv li, kuv yuav muab thawj ob tus lej sib cais thiab teem sijhawm nrog rau caum. Tam sim no peb nyob ntawm 801 feeb, zoo li 13 zaug 60 sib npaug 780 thiab koj ntxiv 21 feeb kawg. Yog tias peb Node-Liab hais tias lub hnub poob thaum 16:58 (thaum lub caij ntuj no), peb tau txais lub teeb pom kev sab nraum zoov kom qhib nruab nrab ntawm 1018 feeb thiab lub sijhawm tau teem tseg ua ntej kaw, uas yuav yog 1380 (23:00 teev tsaus ntuj)). Yog tias peb lub sijhawm nyob nruab nrab ntawm cov ntawd, lub teeb qhib. Cov lej saum toj no yog qhov tseem ceeb ntawm txhua qhov haujlwm, yam tsis tau txais Node-Red los txuas rau Arduino thiab sib tham. Kuj tseem muaj lub ntsuas hluav taws xob uas ua kom lub teeb qhib (Yav dhau los hnub poob, txawm li cas los xij) yuav raug siv, tab sis lwm yam uas yog tag nrho cov haujlwm saum toj no.

Kauj Ruam 5: Node-Liab

Node-Liab
Node-Liab
Node-Liab
Node-Liab
Node-Liab
Node-Liab
Node-Liab
Node-Liab

Tsis yog qhov tshwj xeeb loj txaus, tsis yog tias nws xav tau nyob hauv qhov no. Thawj 2 kab ntawm cov node yog qhov loj ntawm txoj haujlwm. Siv qhov GET muaj nuj nqi, peb khaws cov kev kwv yees hnub no seb lub hnub yuav sawv thiab teeb tuaj li cas. Los ntawm qhov ntawd peb siv tus CSS xaiv los khaws peb cov ntaub ntawv tshwj xeeb, feem ntau nkag mus rau ntawm cov vev xaib "Txheeb Cov Khoom" ntawm lub firefox raws li qhia hauv daim duab. Nco ntsoov, tias tsis yog txhua lub vev xaib ua haujlwm no thiab qhov kuv siv tshwm sim los ua haujlwm zoo kawg nkaus li no. Los ntawm qhov ntawd nws yuav sau cov ntaub ntawv mus rau tus lej 13 vim tias yog qhov kuv tau xaiv nws los ua, txawm hais tias kev sim tseem tsis tau hais yog tias tus pin nkag mus rau lub sijhawm sib txawv tuaj yeem ua haujlwm tau. Raws li tau piav qhia hauv ntu ntu, cov ntaub ntawv yuav los ntawm Arduino mus rau Node-Red, qhov uas nws yuav qhia tom qab ntawm lub vev xaib uas nkag tau yooj yim uas ib tus tuaj yeem txheeb xyuas nws tau yooj yim. Koj yuav xav tau Firmata rau qhov no yog tias koj xav siv Arduino ua haujlwm tau txais los ntawm node-red-node-arduino lub tsev qiv ntawv ntawm Node-Red. Txawm hais tias tsis tau teeb tsa tag nrho, thiab nws yuav raug hloov kho raws li kuv ua tiav txoj haujlwm, Kuv tau txuas cov cai rau Node-Red Flow hauv cov ntawv nyeem kom nkag tau yooj yim.

Kauj Ruam 6: Kev xa thiab siv

Kev xa thiab siv
Kev xa thiab siv

Thiab kom ua tiav qhov peb qhia tau, yog qhov ua tau zoo ntawm nws. Nrog ob peb lub tsev muaj qib ntawm lub teeb pom kev tsis zoo, ib xyoos ib puag ncig daws tau txais tos nrog ntau tus tswv tsev. Txhawm rau txuas qhov no nrog teeb siv hluav taws xob uas tsis yog Arduino, Kuv tsis pom zoo ua nws koj tus kheej tshwj tsis yog koj paub tseeb tias koj ua dab tsi. Nrog rau txoj haujlwm dhau los, Kuv yuav ua txoj haujlwm no nrog kev pab ntawm kws kho hluav taws xob kom ntseeg tau. Lub teeb pom kev ntawm koj lub tsheb los ntawm lub ntsuas hluav taws xob lossis nruj me ntsis raws lub sijhawm, Kuv xav kom koj tsim raws li qhov kuv tau ua tiav yog tias koj txhais tau tias tau muab nws los siv dhau qhov kev xeem theem tam sim no. Feem ntau ntawm kuv cov teeb meem nrog txoj haujlwm tau nruj me ntsis hauv Node-Red mus rau Arduino ib feem, thiab kuv vam tias kuv tau tswj hwm los piav qhia meej li sai tau. ua tiav

Pom zoo: