Cov txheej txheem:

Ntse Chaw Nres Tsheb Siv Raspberry Pi: 5 Kauj Ruam
Ntse Chaw Nres Tsheb Siv Raspberry Pi: 5 Kauj Ruam

Video: Ntse Chaw Nres Tsheb Siv Raspberry Pi: 5 Kauj Ruam

Video: Ntse Chaw Nres Tsheb Siv Raspberry Pi: 5 Kauj Ruam
Video: tuav wb lub neej kom ruaj khov - Mang Vang ft. Christina Xyooj [Official Audio] 2021-22 2024, Kaum ib hlis
Anonim
Chaw Nres Tsheb Ntse Siv Raspberry Pi
Chaw Nres Tsheb Ntse Siv Raspberry Pi

Hauv cov lus qhia no peb yuav tsim qhov chaw nres tsheb tsis siv neeg txuas nrog lub web interface. Koj yuav tuaj yeem pom qhov chaw raug coj mus, txiav txim siab leej twg nkag mus thiab leej twg tawm mus thiab nws tau nruab nrog lub tshuab teeb pom kev zoo tsis siv neeg.

Khoom siv

Kho vajtse

  • 2 x Ultrasonic sensors
  • 1x servo lub cev muaj zog
  • 4x LEDs dawb
  • 1x Lub teeb nyob ntawm tus tiv thaiv
  • 1x 2*16 LCD Zaub

Xam

  • 1x Raspberry Pi 3 B+
  • 1x SD daim npav (8-16GB qhov kev xaiv yog koj li)
  • 1x Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A
  • 1 x MCP3008
  • 1x Resistor 2.2K Ohm
  • 9x Resistors 1K Ohm

Ntau yam

  • Jumper xov hlau
  • Cov qhob cij
  • UTP-kab
  • Adapter rau koj raspberry pi
  • Ib daim ntawv ntawm multiplex (koj tuaj yeem siv yam khoom twg koj xav tau rau lub casing)
  • Phom phom

Software

  • PuTTY
  • Software kho cov cai (koj tuaj yeem siv txhua yam koj xav tau tsuav nws txhawb nqa: Python, HTML, CSS thiab java tsab ntawv
  • Win32 Disk Imager
  • Raspbian OS duab
  • VNC Viewer (yeem)

Kauj ruam 1: Teeb RPI

Ua ntej peb pib nrog txuas cov cuab yeej kho vajtse, sau

software thiab ua lub casing peb yuav xav teeb tsa koj li PI nrog cov software tsim nyog koj yuav xav tau los ua qhov haujlwm.

Koj yuav xav tau daim duab ntawm Raspbian tso rau hauv koj daim npav SD thiab sau nws mus rau SD daim npav Win32 Disk Imager. Koj tuaj yeem pom cov ntawv txuas rau ob qho hauv qab no.

- Win32 Disk Imager:

- Raspbian duab:

Kev teeb tsa

  1. Qhib Win32 Disk Imager

    1. Xaiv cov duab koj nyuam qhuav rub tawm los ntawm daim nplaub tshev icon
    2. Xaiv koj daim npav SD ntawm qhov nco cia
    3. Nyem rau sau
    4. Thaum cov txheej txheem ua tiav koj lub khoos phis tawj yuav zaum nug koj yog tias koj xav ua hom SD daim ntawv tsis txhob ua qhov no

Thaum koj ua tiav nrog cov theem no koj yuav tsum tau ua qee yam ntxiv yog li koj tuaj yeem nkag mus rau software ntawm koj li PI.

  1. Qhib daim npav SD hauv koj tus neeg tshawb nrhiav
  2. Qhib cov ntawv "cmdline.txt"
  3. Koj yuav pom kab ntawv ntev ntawm qhov kawg ntxiv: ip = 169.254.10.1
  4. Txuag cov ntawv
  5. Tsim cov ntaub ntawv npe ssh uas tsis muaj kev txuas ntxiv (yog tias koj tsis paub yuav ua li cas tsuas yog nyem rau ntawm cov ntawv tshiab, xaiv cov ntawv tshiab tshem tawm qhov txuas ntxiv thiab npe nws ssh)
  6. Kauj ruam kawg ntawm ntu no yog tshem tawm daim npav SD kom nyab xeeb thiab muab tso rau hauv Raspberry PI

Txuas

Thaum koj ua tiav cov kauj ruam dhau los nws yog lub sijhawm los txuas rau koj tus pi thawj zaug. Ua ntej koj yuav tsum tau ntsaws rau hauv koj lub UTP cable, ib kawg hauv koj lub khoos phis tawj lwm qhov hauv koj tus pi (nws yog qhov tseem ceeb uas koj ntsaws rau hauv LAN cable ua ntej koj ntsaws nws).

  1. Nruab Putty:
  2. Thaum koj tau teeb tsa nws qhib nws thiab nkag mus rau 169.254.10.1 hauv IP box
  3. Xaiv SSH thiab sau rau hauv chaw nres nkoj 22
  4. Nyem qhib
  5. Sau rau hauv lub npe siv: pi thiab tus password raspberry qhov no yog tus txheej txheem nkag mus rau ntawm cov duab tshiab

Raspi-teeb tsa

Ua ntej peb txav mus rau koj yuav tsum hloov pauv ob peb qhov teeb meem hauv cov ntawv qhia zaub mov raspi-config qhib nws los ntawm kev siv:

sudo raspi-teeb tsa

1. Pab kom I2C thiab SPI nyob rau hauv kev xaiv nws pawg cuam tshuam

2. Xaiv koj li WIFI coutry ntawm qeb kev faib chaw

3. Teem lub Desktop/CLI teeb tsa hauv cov khau raj xaiv qeb rau Desktop Autologin.

4. Hauv qab cov kev xaiv Advanced xaiv A1 nthuav tawm cov ntaub ntawv system (qhov no ua kom ntseeg tau tias koj siv qhov chaw ntawm tag nrho SD daim npav

5. Tam sim no tawm thiab sudo reboot

Wifi

Tam sim no nws yog lub sijhawm los teeb tsa koj li kev sib txuas wifi tawm ntawm chav kawm koj yuav xav tau daim ntawv pov thawj ntawm koj li wifi.

Ua ntej nkag mus rau hauv paus hom los ntawm kev ua cov lus txib no

Sudo -ib

Tam sim no koj muaj txoj cai tsim nyog los ua cov lus txib no:

Nco ntsoov hloov SSID rau koj lub npe wifi thiab PASSWORD rau koj tus password wifi

Wpa_passphrase “SSID” “PASSWORD” >> /etc/wpa_supplicant/wpa_supplicant.conf

Nkag mus rau WPA Client los ntawm kev ua cov lus txib no:

wpa_cli

Xaiv lub interface

Kev sib txuas wlan0

Reload tus config

Rov kho dua

Kawg tab sis tsis tsawg kawg yog tias nws ua haujlwm. Koj tuaj yeem ua qhov no los ntawm kev nkag mus:

Ip ib

Ntawm no koj tuaj yeem tshawb xyuas yog tias koj muaj tus IP nyob hauv WLAN0 cuam tshuam yog tias tsis sudo reboot (yeej tsis ua tiav (:).

Yog tias koj tsis xis nyob ua nws los ntawm kab hais kom ua koj ib txwm tuaj yeem ua nws ntawm GUI ntawm Raspbian uas yog tus neeg siv tau zoo dua me ntsis.

  1. Nruab VNC-viewer ntawm no:
  2. Nyem cov ntaub ntawv, kev sib txuas tshiab thiab nkag mus rau IP-chaw nyob bar: 169.254.10.1 thiab xaiv lub npe twg los xij koj xav tau
  3. Sau rau hauv lub npe siv: pi thiab tus password raspberry
  4. Nyem rau lub cim wifi thiab txuas qhov ntawd

Pob

Tam sim no peb tau txuas nrog internet peb tuaj yeem teeb tsa pob khoom peb xav tau los ua txhua txoj cai.

Ua ntej peb yuav xav tau hloov kho cov npe pob rau qhov tshiab los ntawm kev khiav:

sudo apt hloov tshiab

sudo apt hloov tshiab

Apache Webserver

Peb yuav xav tau tus webserver los khiav peb daim ntawv thov web. Peb tuaj yeem ua tiav qhov no los ntawm kev txhim kho apache webserver los ntawm kev ua cov lus txib no:

sudo apt nruab apach2 -y

Nab hab sej pob

Txhawm rau ua txhua yam haujlwm peb yuav xav tau ob peb pob. Cov no yog cov uas peb yuav xav tau.

  • Lub hwj
  • Flask-Cors
  • Flask-Extension
  • Flask-MySQL
  • Flask-SocketIO
  • Nab hab sej

Koj tuaj yeem nruab lawv los ntawm kev ua cov lus txib no:

pip nruab Flask Flask-Cors Flask-Extension Flask-MySQL Flask-SocketIO python-socketio

Kauj ruam 2: Database

Database
Database

MariaDB

Khiav cov lus txib hauv qab no txhawm rau teeb tsa MariaDB qhov no yog lub hauv paus database xav tau txhawm rau taug qab txhua cov ntaub ntawv uas lub ntsuas tau nyeem hauv.

sudo apt nruab mariadb-server

Tam sim no peb yuav xav tau kev nyab xeeb rau peb kev teeb tsa

Mysql_secure_installation

Thaum koj khiav cov lus txib nws yuav nug peb rau tus lej nkag hauv paus peb tseem tsis muaj ib qho yog li tsuas yog nias nkag mus.

Tam sim no nws yuav nug koj yog tias koj xav tau ib qho rau qhov laj thawj kev nyab xeeb peb xav tau ib qho yog li nias Y ntawm koj cov keyboard thiab xaiv tus lej twg koj xav tau.

Tam sim no nws tseem yuav nug koj ob peb lo lus nug ntxiv tsuas yog teb Y rau txhua tus ntawm lawv

Zoo tam sim no uas peb tau ua tiav rau qhov no peb yuav tsum tau mus rau hauv SQL plhaub.

Txhawm rau ua qhov no peb thawj zaug yuav tsum dhau los ua lub hauv paus dua los tso cai rau peb muaj txoj cai los ua qhov no los ntawm kev nkag mus rau cov lus txib no ntxiv:

sudo -i ua

Tam sim no nkag mus rau mysql plhaub

mysql ua

Tam sim no peb tab tom tsim tus neeg siv tso lub npe koj xav tau ntawm cov lus hais ua ntej @ thiab tus lej koj xav tau tom qab txheeb xyuas los ntawm

Tam sim no peb yuav tsum yaug cov lus tso cai los ntawm kev ua cov lus txib no:

NTSEEG NTAWV QHOV TSEEB;

Tom qab koj ua tiav cov theem no koj tuaj yeem rov tsim cov phiaj xwm db los ntawm daim duab saum toj no. Hmoov tsis zoo Kuv tsis tuaj yeem muab koj pov tseg ntawm cov ntaub ntawv vim kuv tab tom ntsib qee qhov software tsis raug.

Kauj Ruam 3: Kev thaiv kab hlau

Thaiv
Thaiv
Thaiv
Thaiv
Thaiv
Thaiv

Tam sim no nws yog lub sijhawm los ua txoj hlua ntawm txoj haujlwm. Txhawm rau ua kom cov txheej txheem yooj yim me ntsis los ntawm thawj zaug ua cov phiaj xwm hauv qhov program hu ua fritzing. Fritzing ua rau nws yog li nws yooj yim dua los tsim koj cov xov hluav taws xob hauv lub neej tiag tiag thiab koj tau txais daim duab meej ntawm yam koj tab tom ua.

Kauj Ruam 4: Vaj Tsev

Vaj tse
Vaj tse
Vaj tse
Vaj tse
Vaj tse
Vaj tse

Thawj kauj ruam yog txiav ntoo hauv cov duab zoo li pom hauv daim duab. Kuv tau ua nws ntawm lasercutting tab sis pom ib txwm yuav ua haujlwm ib yam nkaus. Tom qab ntawd koj yuav xav pleev xim ntoo dub kom tau xim asphalt. Thaum cov xim tau qhuav lawm koj tuaj yeem pleev xim kab txaij dawb kom tau txais qhov chaw nres tsheb ntawd. Rau lub laj kab kuv tsuag cov xim pleev xim kom zoo li tus ncej. Rau qhov laj kab nws tus kheej Kuv tau hla qee qhov goas mus rau tus ncej. Qhov teeb meem yog ua los ntawm paer maché uas kuv tau pleev xim rau tom qab.

Kauj ruam 5: Coding

Coding
Coding
Coding
Coding
Coding
Coding

Backend: Lub backend ntawm txoj haujlwm tau sau hauv Python thiab TSQL. Nws nyeem tag nrho cov ntaub ntawv ntawm lub ntsuas cua thiab sau nws mus rau lub hauv paus uas peb tau tsim ua ntej me ntsis. Nws kuj tseem siv lub vev xaib kom peb tuaj yeem txuas peb lub ntsej muag rau nws. Kuv tau sau cov cai xav tau rau sab nraub qaum hauv pycharm tab sis sab nrauv koj tuaj yeem siv txhua yam koj xav tau.

Koj tuaj yeem pom cov cai rau tus backend ntawm no:

Frontend: Tus frontend tau sau ua HTML, CSS thiab Javascript. Kuv siv kev sib xyaw ua ke ntawm qhov muag pom duab chaws thiab phpstorm los sau cov cai. Txoj cai pib sau tag nrho lub vev xaib thiab hauv javascript cov ntaub ntawv koj tuaj yeem pom cov cai xav tau kom tau txais cov ntaub ntawv los ntawm cov backend.

Koj tuaj yeem pom cov cai rau lub ntsej muag ntawm no:

Pom zoo: