Cov txheej txheem:

QHOV QHOV TSEEB QHOV TSEEB QHOV TSEEB TSHIAB (Pi Tsev Ruaj Ntseg): 7 Kauj Ruam
QHOV QHOV TSEEB QHOV TSEEB QHOV TSEEB TSHIAB (Pi Tsev Ruaj Ntseg): 7 Kauj Ruam

Video: QHOV QHOV TSEEB QHOV TSEEB QHOV TSEEB TSHIAB (Pi Tsev Ruaj Ntseg): 7 Kauj Ruam

Video: QHOV QHOV TSEEB QHOV TSEEB QHOV TSEEB TSHIAB (Pi Tsev Ruaj Ntseg): 7 Kauj Ruam
Video: Tseem Ev Lub Kawm - Koos Loos 2024, Kaum ib hlis
Anonim
Image
Image

Lub kaw lus tau tsim los txhawm rau txheeb xyuas kev nkag mus (tsis tau tso cai nkag mus) rau hauv ib lub tsev lossis lwm thaj chaw. Txoj haujlwm no tuaj yeem siv hauv thaj chaw nyob, kev lag luam, chaw tsim khoom, thiab kev ua tub rog rau kev tiv thaiv kev ua tub sab lossis khoom puas, nrog rau kev tiv thaiv tus kheej tiv thaiv cov neeg nkag. Txoj haujlwm no suav nrog PIR Motion Sensor uas yuav kuaj pom tus neeg nkag nkag nkag thiab ceeb toom rau tus tswv. Txhawm rau sim qhov xwm txheej ntawm lub sijhawm tiag tiag, peb tau siv nws hauv peb lub chaw haujlwm los ntsuas seb nws yuav pab tau peb li cas thiab cov txiaj ntsig tau zoo heev.

Khoom siv

Kho vajtse:

  • NodeMCU ESP8266
  • PIR Tsab ntawv tsa suab Sensor
  • Cov qhob cij
  • Jumper Hlau

Software:

  • Blynk (Android lossis iOS)
  • Arduino IDE Cov

Kauj Ruam 1: Nws Ua Haujlwm Li Cas?

Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?

Raws li koj paub, NodeMCU yog WiFi-qhib microcontroller, uas tuaj yeem txuas rau internet ntawm WiFi. Yog li, siv daim ntawv thov BLYNK Blynk, peb tuaj yeem qhib lub cuab yeej. Rau lub hom phiaj no, peb txuas lub khawm nrog tus pin virtual, yog li thaum lub sijhawm qhib lub pob nyem, tus nqi hauv qhov sib txawv "xeev" yuav hloov ntawm "1" mus rau "0" (Xa cov lej).

Hauv qib tom ntej, yog tias "lub xeev" yog 1, PIR Sensor pib tshuaj xyuas cov neeg nkag. Yog li, thaum twg tus neeg nkag nkag (piv txwv li, txav mus los) raug kuaj pom, lub ntsuas cua yuav xa tus nqi siab rau NodeMCU. Thaum NodeMCU nyeem tus nqi siab, HTTP thov yuav xa los ntawm NodeMCU. Qhov kev thov HTTP no (WebHooks API) yuav ua rau ClickSend SMS Kev Pabcuam, yog li peb tau txais SMS hauv peb Lub Xov Tooj sai li sai tau raws li Tsab Ntawv Pom Zoo.

HTTP (Hypertext Transfer Protocol) yog tus txheej txheem Daim Ntawv Thov txheej txheem uas ua haujlwm raws li kev thov-lus raws txheej txheem ntawm cov neeg siv khoom thiab server.

HTTP tus thov kev pab xa HTTP thov thiab tau txais HTTP cov lus teb los ntawm HTTP server.

Nws tau siv dav hauv IoT raws li cov ntawv thov xws li Tsev Automation, lub cav tsheb ntsuas ntsuas ntsuas nyob deb rau kev tshuaj xyuas, thiab lwm yam.

Kauj ruam 2: Kho vajtse

Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse

PIR Tsab ntawv tsa suab SensorPIR

sensors tso cai rau koj nkag siab lub zog, yuav luag ib txwm siv los tshuaj xyuas seb tib neeg tau txav mus los lossis tawm ntawm cov ntsuas ntau. Lawv yog cov me me, pheej yig, lub zog qis, siv tau yooj yim thiab tsis hnav tawm. Vim li ntawd, lawv feem ntau pom muaj nyob hauv cov cuab yeej siv thiab cov cuab yeej siv hauv tsev lossis lag luam. Lawv feem ntau hu ua PIR, "Passive Infrared", "Pyroelectric", lossis "IR motion" sensors.

NodeMCU

NodeMCU yog qhov qhib LUA raws li 9firmware tsim rau ESP8266 wifi nti. Los ntawm kev tshawb nrhiav kev ua haujlwm nrog ESP8266 nti, NodeMCU firmware tuaj nrog ESP8266 Kev txhim kho pawg thawj coj/khoom siv piv txwv li NodeMCU Kev Txhim Kho Pawg. Txij li NodeMCU yog qhov qhib-platform platform, nws tsim kho vajtse yog qhib rau kev hloov/hloov kho/tsim. NodeMCU Dev Kit/board suav nrog ESP8266 wifi qhib nti. ESP8266 yog tus nqi qis Wi-nkaus nti tsim los ntawm Espressif Systems nrog TCP/IP raws tu qauv. Yog xav paub ntxiv txog ESP8266, koj tuaj yeem xa mus rau ESP8266 WiFi Module.

Kauj Ruam 3: Kho Blynk App

Kev teeb tsa Blynk App
Kev teeb tsa Blynk App
Kev teeb tsa Blynk App
Kev teeb tsa Blynk App
Kev teeb tsa Blynk App
Kev teeb tsa Blynk App

Nruab Blynk App los ntawm Playstore/AppStore. Nkag mus lossis Tsim Tus Kheej Tshiab yog tias koj tsis muaj Tus Kheej. Tsim Khawm Widget thiab ua nws li toggle switch. Kho lub pob nrog Virtual tus pin V1. Lub pob no yuav qhib lossis qhib lub cuab yeej. piv txwv li, lub cuab yeej yuav ua haujlwm nkaus xwb yog tias qhov hloov pauv ON. Tom ntej no, Tsim LED Widget ntawm Virtual Pin V2. Tom qab ntawv nyem rau ntawm Play Button ntawm lub ces kaum sab xis saum toj kom tawm Kho Hom. Cov Kauj Ruam yog muab rau hauv qab no.

Kauj Ruam 4: Kho WebHooks

Kho WebHooks
Kho WebHooks
Kho WebHooks
Kho WebHooks
Kho WebHooks
Kho WebHooks

Yog Qhov No Yog Qhov ntawd, tseem hu ua IFTTT, yog lub vev xaib pub dawb pub dawb uas tsim cov saw ntawm cov lus yooj yooj yim, hu ua applets. Ib qho applet tau tshwm sim los ntawm kev hloov pauv uas tshwm sim hauv lwm qhov kev pabcuam hauv web xws li Gmail, Facebook, Telegram, Instagram, lossis Pinterest. Peb tab tom teeb tsa lossis SMS qhov tshwj xeeb los ntawm Qhov Txuas Txuas Platform no.

Ua ntej tshaj plaws, qhib IFTTT lub vev xaib los ntawm nyem qhov no. Nkag mus nrog koj tus lej Google. Tom qab ntawd tsim ib qho tshiab applet. Txhawm rau tsim ib qho tshiab applet, Nyem rau ntawm Account Account ntawm lub kaum sab xis saum toj (Nyob ze Tshawb) thiab nyem tsim. Tam sim no nyem rau ntawm no thiab tshawb rau WebHooks. Nyem rau Txuas. Lub qhov rai tshiab yuav tau ntim nrog lub thawv xim xiav uas muaj "Tau txais lub vev xaib Thov". Nyem rau ntawm lub npov. Tam sim no koj yuav raug nug kom muab TUS NEEG NYOB. Ntaus ESP_MOTION hauv lub thawv thiab nias "Tsim tawm".

Tam sim no nyem rau qhov ntawd thiab tshawb nrhiav SMS thiab xaiv ClickSend SMS. Cov yam ntxwv no yuav xa SMS mus rau tus lej xov tooj uas tau teeb tsa. Nyem rau Txuas thiab tsim ib tus as khauj tshiab, tom qab ntawd kaw lub qhov rais qhib tshiab, thiab nyem Txuas Txuas Txuas dua thiab nkag mus nrog tus lej nyiaj thiab tso cai. Tam sim no sau daim ntawv nrog cov ntsiab lus xav tau. Thawj Teb yog Tus Neeg Txais Xov Tooj Tus Xov Tooj, daim teb thib ob yog tus xa cov ntsiab lus, uas tuaj yeem yog lub npe lossis tus lej (tsis muaj teeb meem tiag), thiab lub npov thib peb yog Lub Cev Lus, koj tuaj yeem kho nws raws li koj nyiam.

Thiab thaum kawg, nyem rau Tsim Tsim Khawm.

Kauj Ruam 5: Hloov Txoj Cai

Xa cov Code
Xa cov Code
Xa cov Code
Xa cov Code
Xa cov Code
Xa cov Code
Xa cov Code
Xa cov Code

Peb tau teeb tsa kev pabcuam SMS. Tam sim no peb yuav tsum teeb tsa lub PIR Sensor thiab NodeMCU nrog peb teeb tsa WebHooks API. Qhib Cov Cai tau muab hauv qab no, Nco ntsoov tias koj tau teeb tsa ESP8266 Core, yog tias koj tsis tau, tshawb rau nws. Koj tuaj yeem pom ntau cov lus tshaj tawm hauv lub vev xaib. Tam sim no koj yuav tsum tau hloov qee qhov Code. WebHooks URL txhawm rau ua rau tshwm sim, WiFi SSID, Tus lej password thiab Blynk kev lees paub tus lej.

const char* iftttURL = "WEBHOOKS URL"; const char* ssid = "SSID"; // Koj Lub Npe WiFi. const char* password = "PASSWORD"; // Koj li WiFi Password. char auth = "BLYNK_AUTHTOKEN"; // Koj li Blynk Kev lees paub tus lej cim.

Qhib WebHooks Cov Ntaub Ntawv Nplooj ntawv kom tau txais qhov URL kom ua haujlwm. Nyem rau ntawm Cov Ntaub Ntawv khawm ntawm nplooj ntawv no.

Koj yuav pom qee yam zoo li no

"https://maker.ifttt.com/trigger/{event}/with/key/cngKKJ6py15q3adxlbAv*****************"Ntawm no, Koj yuav tsum hloov kho lub npe txheej xwm uas yog nyob hauv cov kab nkhaus, tshem cov kab zauv thiab ntaus hauv Cov Txheej Txheem lub npe nyob ntawd thiab theej tag nrho qhov txuas. Cov ntawv tom qab 'tus yuam sij' yog koj li WebHooks Key. Tam sim no Muab tshuaj txhuam qhov URL theej hauv koj li Arduino code. Tam sim no ib qho tseem ceeb yuav tsum tau saib xyuas yog tias, koj yuav tsum Tshem Tawm ib tsab ntawv Los Ntawm Qhov Txuas. Tshem tawm "S" los ntawm https://. Qhov txuas yuav zoo li no

"https://maker.ifttt.com/trigger/ESP_MOTION/with/key/cngKKJ6py15q3adxlbAv*****************"

Tam sim no ntaus koj li WiFi SSID thiab Password.

Qhov ntxiv uas koj yuav tsum tau hloov yog Blynk kev txheeb xyuas tus lej cim. Koj tuaj yeem pom cov cim hauv koj li Email uas koj siv los sau npe. theej lub Token thiab muab tso rau hauv koj li Code.

Lub hom phiaj ntawm txhua kab ntawm kab lus tau qhia hauv Txoj Cai raws li Lus Qhia, Yog li kuv yuav tsis rov sau nws dua.

Tam sim no Xaiv Pawg Thawj Coj, uas yog NodeMCU hauv kuv rooj plaub, thiab chaw nres nkoj uas pawg thawj coj tau txuas nrog. Thiab nyem lub pob Upload. Qhib Blynk app ntawm koj lub xov tooj thiab Qhib lub cuab yeej. Tam sim no pom koj LOW-COST Tub sab nyiag khoom ntaus ntawv hauv kev nqis tes ua.

Tam sim no, yog tias peb Xaiv Cov Ntawv Ceeb Toom Tshwj Xeeb rau SMS no, Peb tuaj yeem siv nws ua lub tswb nrov. Xws li, Thaum twg pom muaj kev txav mus los, Tswb yuav qhib.

Kauj Ruam 6: Circuit thiab Code

Circuit thiab Code
Circuit thiab Code

Rub tawm Circuit thiab Code Los ntawm peb GitHub Chaw Tso Khoom.

github.com/pibotsmakerhub/pi-home-security

Kauj Ruam 7: Saib Cov Vev Xaib kom paub tseeb tias koj ua tau zoo

Saib cov vis dis aus hauv youtube kom ntseeg tau tias koj tau ua txhua yam raug.

Qhov ntawd yog txhua qhov hauv Txoj Haujlwm no, Ua Tsaug

Pom zoo: