Cov txheej txheem:

Tsev Automation: 7 Kauj Ruam
Tsev Automation: 7 Kauj Ruam

Video: Tsev Automation: 7 Kauj Ruam

Video: Tsev Automation: 7 Kauj Ruam
Video: Plab Plab Ntswg..(Pluav Pluav Ntswg) Maiv Twm New Song 2023-2024 2024, Kaum ib hlis
Anonim
Tsev Automation
Tsev Automation

Hloov koj lub tsev mus rau hauv lub tsev ntse, nrog rau qhov no koj tuaj yeem tswj hwm txhua yam khoom siv hluav taws xob hauv koj lub tsev hauv ib qho app nkaus xwb. Tab sis rau txoj haujlwm no, kuv tau ua kom tsuas yog tswj hwm txhua lub teeb pom kev hauv tsev. Txhua yam ua tau yooj yim nrog Raspberry pi 3 thiab xa tawm rau kev tswj lub cev hloov pauv thiab ib qho app tsim los ntawm kos kom tswj kev xa mus rau kev tswj chaw taws teeb.

YUAV TSUM MUAJ NTAUB NTAWV

Raspberry pib 3

8-Channel 5v Relay Module

Micro SD daim npav (8GB)

Poj niam-rau-Poj Niam Jumper hlau

SOFTWARE SIV

Win32DiskImager

Kauj Ruam 1: Wring Raspberry Pi Nrog 8-channel Relay

Wring Raspberry Pi Nrog 8-channel Relay
Wring Raspberry Pi Nrog 8-channel Relay
Wring Raspberry Pi Nrog 8-channel Relay
Wring Raspberry Pi Nrog 8-channel Relay

Hlau raws li daim duab qhia saum toj no

Kauj Ruam 2: Teeb Raspbian Lite ntawm Raspberry Pi

Mus ntsib

Scroll cia thiab rub tawm Raspbian Lite (tam sim no - Buster)

unzip cov ntaub ntawv.zip thiab koj yuav tau txais cov ntawv.img

khiav Win32DiskImager

xauj rau.img cov ntaub ntawv hauv qab "Cov Ntaub Ntawv Duab" xaiv

xaiv qhov tseeb tsav "Ntaus" (piv txwv li E:)

nyem rau ntawm "Sau" khawm kom pib txheej txheem hlawv

nyem "YOG" thaum hais kom sai

ib zaug ua tiav, ntxig koj daim npav SD rau hauv raspberry pi thiab qhib nws

Kauj ruam 3: Hloov kho Raspbian

Teeb IP zoo li qub rau Raspbian ua ntej hloov tshiab, YUAV UA LI CAS?

Nkag mus rau hauv raspbian davhlau ya nyob twg

Tus neeg siv: piPassword: raspberry

yam

sudo nano /etc/dhcpcd.conf

nqes mus rau txhua txoj hauv kev thiab muab cov kab ntawv no tso rau

eth0 ua

zoo li qub ip_address =/24 zoo li qub routers = zoo li qub domain_nameservers = interface wlan0 zoo li qub ip_address =/24 routers zoo li qub = zoo li qub domain_nameservers =

txuag nws los ntawm nias "ctrl+x" thiab "y"

thaum kawg reboot koj pi, nrog "sudo reboot"

tom qab ua tiav kev rov pib dua, khiav cov lus txib no kom hloov kho raspbian rau qhov hloov tshiab kawg

sudo apt-tau hloov tshiab

sudo apt-tau hloov tshiab

sudo apt-tau nruab dist-upgrade

Kauj Ruam 4: Nruab Pob

Lub sijhawm los teeb tsa txhua qhov kev cia siab yuav tsum tau ua

hauv davhlau ya nyob twg khiav cov lus txib no

sudo apt-tau nruab nodejs

sudo apt-tau nruab npm

sudo apt-tau nruab git

sudo npm nruab pm2 -g

Txheeb xyuas yog txhua yam teeb tsa raug los ntawm kev ua cov lus txib no

node -v

npm -v

pm2v wb

git -rov qab

Kauj Ruam 5: Clonning "HomeAutomationServer" Repository

Clone "HomeAutomationServer" repository los ntawm github

git clone

ib zaug cloned, mus rau hauv "HomeAutomationServer" cov npe thiab khiav qhov no

npm nruab

Txhua qhov kev cia siab uas yuav tsum tau ua rau txoj haujlwm yuav raug teeb tsa

Kauj Ruam 6: Khiav Server Nrog Pm2

Khiav server nrog pm2

ntaus qhov no hauv dav hlau los tsim txoj hauv kev rau pm2

pm2 pib

theej cov lus txib tsim thiab muab tshuaj txhuam rau hauv lub davhlau ya nyob twg thiab ua nws

Thaum kawg, pib server nrog pm2, ntaus cov lus txib no, koj yuav tsum nyob hauv cov npe raug los ntawm tam sim no

pm2 pib server.js -npe "HomeAutomationServer" -saib

khiav cov lus txib no kom txuag neeg rau zaub mov mus rau pm2 yog li pm2 yuav pib siv koj lub server ntawm txhua lub khau raj

pm2 ruaj

Kauj ruam 7: Reboot Server

Reboot server nrog cov lus txib no

sudo rov pib dua

ib zaug rebooted, ntaus cov lus txib no txhawm rau txheeb xyuas yog tias cov neeg rau zaub mov cia li khiav tom qab rov pib dua

pm2 lis

Nrog qhov ntawd koj tau ua tiav qhov kev qhia rau teeb tsa server ua haujlwm nrog pm2

Tab sis Ua Ntej Ua Ntej QHOV TSEEB KAWG, cia kuv qhia koj tias qhov no tsuas yog ib nrab ntawm daim ntawv thov, yog li, qhov twg yog cov lus qhia ntxiv uas koj nug, mus ntsib https://github.com/khairmuhammad-ybh/HomeAutomati… rau qhov kev qhia zaum kawg rau nruab lub app ntawm koj lub cuab yeej.

Hloov tshiab

Rub tawm thiab teeb tsa lub apk muab ntawm no: HomeAutomation thiab sim nws

Pom zoo: