Cov txheej txheem:

Tsev Cog Khoom Ntse: 12 Cov Kauj Ruam
Tsev Cog Khoom Ntse: 12 Cov Kauj Ruam

Video: Tsev Cog Khoom Ntse: 12 Cov Kauj Ruam

Video: Tsev Cog Khoom Ntse: 12 Cov Kauj Ruam
Video: Tseem Ev Lub Kawm - Koos Loos 2024, Hlis ntuj nqeg
Anonim
Ntse Tsev Tsev
Ntse Tsev Tsev

Koj puas tau muaj teeb meem tias nws kub dhau hauv koj lub tsev cog khoom, yog li tag nrho koj cov nroj tsuag tuag, vim tias koj tsis nco qab qhib lub qhov cua?

Saib tsis muaj ntxiv, lub tsev cog khoom ntse yog qhov kev daws teeb meem no.

Ua raws cov kauj ruam taug kev koj los ntawm kev tsim koj li Tsev Cog Khoom Ntse lossis hloov koj lub tsev cog khoom mus rau Lub Tsev Cog Khoom Ntse.

Kauj Ruam 1: Cheeb Tsam

Cheebtsam:

1 x Servo tsav

2 x Kev ntsuas kub

1 xf fan

2 x av noo sensor

2 x lub teeb sensor

8 x coj dawb

ntau yam resistors

1 x 4 los ntawm 7-ntu zaub

1 x MCP3008

1 x74c595

1 x Relais

1 x raspberry pi 3 qauv b

Cov qhob cij

jumpercables

lub tsev cog khoom me me

Kauj Ruam 2: Sau Rasbian ntawm Micro SD Card

Sau Rasbian ntawm Micro SD Card
Sau Rasbian ntawm Micro SD Card
  1. Rub tawm qhov tseeb version "rasbian stretch with desktop" los ntawm qhov chaw:
  2. Unzip cov ntaub ntawv raspbian.
  3. Rub tawm qhov hloov tshiab kawg thiab lwm qhov los ntawm qhov chaw ntawd:
  4. Hloov kho 32GB micro SD daim npav.
  5. Qhib echter, xaiv rasbian img thiab koj daim npav micro SD.
  6. Nyem rau nyem.

Kauj ruam 3: Ntxiv Ip thiab Pab kom SSH

Ntxiv Ip thiab Pab kom SSH
Ntxiv Ip thiab Pab kom SSH
Ntxiv Ip thiab Pab kom SSH
Ntxiv Ip thiab Pab kom SSH
  1. Ntxiv cov ntawv "ssh" rau hauv daim npav micro SD.
  2. Nrhiav cov ntawv "cmdline.txt" thiab qhib nws.
  3. Ntxiv "ip = 169.254.10.1" thaum kawg.
  4. Ntxig daim npav micro SD hauv kuv Raspberry Pi thiab muab lub zog rau nws.
  5. Txuas lub Raspberry Pi nrog lub ethernet cable rau koj lub PC.

Kauj Ruam 4: Pib Nrog Putty

Pib Nrog Putty
Pib Nrog Putty
  1. Rub tawm qhov tseeb version "rasbian stretch with desktop" los ntawm qhov chaw:
  2. Qhib putty thiab sau cov ntsiab lus hauv qab no:

    1. HostName (lossis IP chaw nyob): 169.254.10.1
    2. Hom kev sib txuas: SSH
    3. Txuag Sijhawm: Smart_Greenhouse
  3. Nyem rau "Txuag"
  4. Nyem rau "Qhib"
  5. Yog tias koj tau txais kev ceeb toom kev nyab xeeb los ntawm putty, nyem "Yog".

Kauj Ruam 5: Raspberry Pi Pib

Raspberry Pi Basics
Raspberry Pi Basics
  1. Defealt cedentials yog:

    1. username: pib
    2. lo lus zais: raspberry
  2. Hloov tus password tsis raug los ntawm kev hais kom ua "passwd" thiab nkag mus
  3. Ntaus thawj lo lus zais tam sim no raspberry thiab tom qab ntawd ob zaug koj tus password tshiab uas koj xaiv.

Kauj Ruam 6: Txuas rau Wi-nkaus thiab Hloov Kho Raspberry Pi

Txuas rau Wi-nkaus thiab Hloov Kho Raspberry Pi
Txuas rau Wi-nkaus thiab Hloov Kho Raspberry Pi
Txuas rau Wi-nkaus thiab Hloov Kho Raspberry Pi
Txuas rau Wi-nkaus thiab Hloov Kho Raspberry Pi
Txuas rau Wi-nkaus thiab Hloov Kho Raspberry Pi
Txuas rau Wi-nkaus thiab Hloov Kho Raspberry Pi
  1. Hom: sudo -i
  2. Hom: echo "password" | wpa_passphrase “SSID” >> /etc/wpa_supplicant/wpa_supplicant.conf
  3. Hloov tus password rau tus password ntawm koj lub wifi thiab SSID rau lub npe ntawm koj lub wifi.
  4. Txhawm rau txheeb xyuas hom: nano /etc/wpa_supplicant/wpa_supplicant.conf
  5. Yuav tsum muaj qee yam hauv cov ntawv no uas zoo li daim duab saum toj no. Siv "Ctrl" + "X" kom tawm cov ntawv.

  6. Hom: systemctl rov pib dua kev sib tham
  7. Hom: systemctl xwm txheej sib tham
  8. Hom: rov pib dua
  9. Tos 30 vib nas this, rov pib dua, nyem "Smart_Greenhouse" thiab nyem "Qhib"
  10. Nkag mus ntxiv
  11. Hom: ping 8.8.8.8
  12. Tom qab cov lus txib no, yuav tsum muaj qee yam uas zoo li cov duab saum toj no.
  13. Hom: sudo apt-tau hloov tshiab && sudo apt-tau hloov kho -y qhov no tuaj yeem siv sijhawm me ntsis los hloov kho.

Kauj Ruam 7: Pab kom SPI thiab 1-xaim

Pab kom SPI thiab 1-xaim
Pab kom SPI thiab 1-xaim
Pab kom SPI thiab 1-xaim
Pab kom SPI thiab 1-xaim
  1. Hom: sudo raspi-teeb tsa
  2. Xaiv "Interface Options"
  3. Xaiv "SPI", hais "Yog" thiab hais "Ok"
  4. Xaiv "Interface Options"
  5. Xaiv "1-xaim", hais "Yog" thiab hais "Ok"
  6. Xaiv "Finish"
  7. Hom: sudo reboot
  8. Tos 30 vib nas this, rov pib dua, nyem "Smart_Greenhouse" thiab nyem "Qhib"

Kauj Ruam 8: Tsim Lub Tsev Khaub Ncaws Ntse Ntsej Muag thiab Rub Tawm Txhua Pob Khoom Tsim Nyog

  1. Hom: sudo apt hloov tshiab
  2. Hom: sudo apt install -y python3-venv python3-pip python3-mysqldb mariadb-server uwsgi nginx uwsgi-plugin-python3
  3. Hom: mkdir Smart_Greenhouse && cd Smart_Greenhouse
  4. Hom: mkdir Smart_Greenhouse_frontend && cd Smart_Greenhouse_frontend
  5. Hom: python3 -m venv-system-site-packages env
  6. Hom: qhov chaw env/bin/qhib
  7. Hom: nab hab sej -m pip nruab mysql-connector-python argon2-cffi Flask Flask-HTTPAuth Flask-MySQL mysql-connector-python passlib
  8. Hom: sudo reboot

  9. Tos 30 vib nas this, rov pib dua, nyem "Smart_Greenhouse" thiab nyem "Qhib"
  10. Hom: cd Smart_Greenhouse
  11. Hom: mkdir Smart_Greenhouse_backend && cd Smart_Greenhouse_backend
  12. Hom: python3 -m venv-system-site-packages env
  13. Hom: qhov chaw env/bin/qhib
  14. Hom: nab hab sej -m pip nruab mysql-connector-python argon2-cffi Flask Flask-HTTPAuth Flask-MySQL mysql-connector-python passlib
  15. Hom: sudo reboot
  16. Tos 30 vib nas this, rov pib dua, nyem "Smart_Greenhouse" thiab nyem "Qhib"

Kauj Ruam 9: Uploade Code ntawm Raspberry Pi

Uploade Code ntawm Raspberry Pi
Uploade Code ntawm Raspberry Pi
  1. Rub tawm cov ntawv thov tshiab filezilla los ntawm qhov chaw ntawd:
  2. Rub tus lej los ntawm github:
  3. Pib fillezilla thiab sau cov ntsiab lus hauv qab no:

    1. Tus tswv tsev: 169.254.10.1
    2. Username: pib
    3. Lo lus zais: "tus password koj tau xaiv ntawm Raspberry Pi"
    4. Chaw nres nkoj: 22
    5. Nyem txuas
  4. Nyob rau sab laug "qhov chaw hauv zos" mus rau cov ntaub ntawv koj rub tawm los ntawm github
  5. Nyob rau sab xis "qhov chaw tsis txaus ntseeg" mus rau Smart_Greenhouse nplaub tshev
  6. Luag cov ntawv "conf" thiab "sql" mus rau Smart_Greenhouse nplaub tshev
  7. Qhib Smart_Greenhouse_backend hauv ob sab thiab rub "qauv" thiab "main.py" los ntawm sab laug mus rau sab xis
  8. Rov qab mus rau daim nplaub tshev yav dhau los ntawm ob sab
  9. Qhib Smart_Greenhouse_frontend hauv ob sab thiab rub "zoo li qub", "qauv" thiab "app.py" los ntawm sab laug mus rau sab xis
  10. Nws yuav tsum zoo li daim duab saum toj no.

Kauj ruam 10: Tsim Database

Tsim Database
Tsim Database
Tsim Database
Tsim Database
  1. Pib putty thiab nkag mus
  2. Hom: cd Smart_Greenhouse/
  3. Hom: sudo mariadb
  4. Hom: CREATE USER 'project1-admin'@'localhost' IDENTIFIED BY 'admin'; Tsim tus neeg siv 'project1-web'@'localhost' IDENTIFIED BY 'web'; Tsim tus neeg siv 'project1-sensor'@'localhost' IDENTIFIED BY 'sensor';
  5. Hom: CREATE DATABASE smartgreenhousedb;

  6. Hom: ZOO TSHAJ PLAWS YOOJ YIM RAU smartgreenhousedb.* Rau 'project1-admin'@'localhost' NROG QHOV ZOO TSHAJ PLAWS; GRANT SELECT, INSERT, Hloov tshiab, Rho tawm ntawm smartgreenhousedb.* TO 'project1-web'@'localhost'; GRANT SELECT, INSERT, Hloov tshiab, Rho tawm ntawm smartgreenhousedb.* TO 'project1-sensor'@'localhost'; NTSEEG NTAWV QHOV TSEEB;
  7. Hom: qhia databases;
  8. Nws yuav tsum zoo li daim duab saum toj no.
  9. Hom: tawm;
  10. Hom: sudo mariadb <sql/smartgreenhousedb.sql
  11. Hom: sudo mariadb
  12. Hom: siv smartgreenhousedb;
  13. Hom: qhia cov ntxhuav;
  14. Hom: tawm;

Kauj ruam 11: Tsis Siv Neeg Pib ntawm Cov Ntawv

Tsis Siv Neeg Pib ntawm Cov Ntawv
Tsis Siv Neeg Pib ntawm Cov Ntawv
  1. Hom: sudo cp conf/project1-*. Service/etc/systemd/system/
  2. Hom: sudo systemctl daemon-reload
  3. Hom: sudo systemctl pib qhov project1-*
  4. Hom: sudo systemctl xwm txheej project1-*
  5. Hom: sudo cp conf/nginx/etc/nginx/sites-available/project1
  6. Hom: sudo rm/etc/nginx/sites-enabled/default
  7. Hom: sudo ln -s/etc/nginx/sites-available/project1/etc/nginx/sites-enabled/project1
  8. Hom: sudo systemctl rov pib dua nginx.service
  9. Hom: sudo systemctl xwm txheej nginx.service
  10. Hom: sudo systemctl pab kom project1-flask
  11. Hom: sudo systemctl pab kom project1-sensor
  12. Nws yuav tsum zoo li daim duab saum toj no.

Kauj Ruam 12: Tsim Tsev Cog Khoom

  1. Ua lub tsev cog khoom.
  2. Ntxiv tag nrho cov khoom siv rau lub tsev cog khoom raws li daim duab hluav taws xob.
  3. Ntxiv zog thiab txaus siab.

Pom zoo: