Cov txheej txheem:

Tus Dej Dej Tsis Sib Haum: 9 Kauj Ruam (nrog Duab)
Tus Dej Dej Tsis Sib Haum: 9 Kauj Ruam (nrog Duab)

Video: Tus Dej Dej Tsis Sib Haum: 9 Kauj Ruam (nrog Duab)

Video: Tus Dej Dej Tsis Sib Haum: 9 Kauj Ruam (nrog Duab)
Video: "TSIS TXHOB" - TUPAO XIONG (Official Audio/Lyrics) 2024, Hlis ntuj nqeg
Anonim
Dej Dej Tsis Sib Haum
Dej Dej Tsis Sib Haum

Txog qhov kawg ntawm kuv thawj xyoo uas yog tub ntxhais kawm MCT Kuv tau ua lub luag haujlwm los ua qhov haujlwm uas muaj txhua yam txuj ci uas kuv tau kawm los ntawm cov chav kawm thoob plaws xyoo.

Kuv tab tom nrhiav txoj haujlwm uas yuav tshuaj xyuas txhua qhov kev xav tau los ntawm kuv cov kws qhia ntawv thiab tib lub sijhawm ua kev lom zem rau kuv. Thaum nrhiav ib lub ncauj lus kuv tsis tuaj yeem pab tab sis xav tau kev tshoov siab los ntawm Covid-19 (Qhov no yog txoj cai ua ntej nws mus rau thoob plaws ntiaj teb.) haus dej yam tsis tau kov qee lub khawm ua ntej dej yuav tawm los.

Txoj haujlwm no siv lub ntsuas ntsuas nrug deb txhawm rau txheeb xyuas yog tias lub khob lossis iav tau muab tso rau hauv qab cov dej tso tawm, cov kais dej yuav tom qab tso tawm cov dej rau 60 vib nas this (100ml / feeb). Qhov no yog ua kom nws zoo ib yam vim tias kuaj pom yog tias lub iav tau rub tawm pov thawj los ua qhov nyuaj dhau/qeeb ntawm txoj haujlwm uas yog vim li cas lub sijhawm ua haujlwm tau muab tso rau hauv qhov chaw. Tom qab koj lub iav tau ntim nrog 100ml dej koj tuaj yeem tos txog 5 vib nas this thiab yog tias lub iav tseem nyob ntawm xub ntiag ntawm qhov ntsuas qhov deb nws yuav npaj mus ntxiv rau lwm lub sijhawm (qhov no txhais tau tias tseem muaj sijhawm 5 feeb ntawm kev sau ob qhov sib txawv. cov khoom).

Khoom siv

Cheebtsam

- 1x RaspberryPi (Kuv siv lub 4th tiam sis cov laus dua yuav ua haujlwm ib yam nkaus)- 1x S8050 transistor lossis 1x PN2222 transistor yuav ua haujlwm ib yam nkaus- 1x Photoresistor- 1x HC-SR04 (Ultrasonic Distance Sensor)- 1x RFID-RC522- 3x Txawv xim LEDs (xiav, daj, liab)- 1x LCD1602- 1x Active Buzzer- 1x PCF8574- 1x MCP3008- 1x Dej Twj Tso Kua Dej (A 12v peristaltic pump was used, link to this item)

- 1x DC Power supply (12v, 600mAh)- 1x fais cib nrog 3 me me- 3x breadboards (koj tuaj yeem siv tau tsawg dua)- T-cobbler rau RaspberryPi GPIO pins- T-cobbler cable (rau txuas ntawm pi thiab cobbler)

Cov ntaub ntawv thiab cov cuab yeej siv

- Lub laum nrog cov laum hauv qab no:

- 4mm (rau qhov ua ntej tho qhov rau cov ntsia hlau) - 15mm (txhawm rau qhov rau qhov ntsuas qhov nrug)

- Txhua tus ntsia hlau- 30 tus ntsia hlau ntawm 45mm ntev- 6 screws ntawm 20mm- 2 lub qhov rooj rau lub qhov rooj- Ib phaj ntawm MDF ntawm ib puag ncig 130cm los ntawm 80cm- Ob peb cov ntaub ntawv

Kauj Ruam 1: Sib dhos Circuit

Sib dhos Circuit Court
Sib dhos Circuit Court
Sib dhos Circuit Court
Sib dhos Circuit Court
Sib dhos Circuit Court
Sib dhos Circuit Court

Rau lub Circuit Court peb muaj 2 lub ntsuas cua, lub ntsuas qhov nrug thiab lub tshuab ntsuas hluav taws xob. Qhov ntsuas qhov nrug tau siv los tshuaj xyuas yog tias lub khob tau muab tso rau hauv thaj tsam ntawm tus ciav dej thiab xaiv tau kuv ntxiv lub photoresistor, qhov no yog siv los tshuaj xyuas yog lub casing tau qhib los ntawm leej twg uas tsis xav qhib nws. Nyob rau sab saum toj ntawm qhov ntawd peb muaj tus nyeem ntawv RFID qhov no tuaj yeem siv los txheeb xyuas tus kws kho tsheb uas xav tau los qhib rooj plaub kom rov tso dej dua lossis rau qee qhov teeb meem kho tshuab.

Rau cov ntsiab lus nquag peb muaj LCD1602, lub suab nrov nrov thiab lub twj tso kua mis peristaltic, lub LCD tau siv los tso saib cov xwm txheej zoo li yog rooj plaub tau qhib lossis lub twj tso kua mis tau ua haujlwm ntxiv rau IP chaw nyob ntawm lub cuab yeej yuav pom, lub suab nrov yog siv los ua lub suab ceeb toom thaum rooj plaub tau qhib yam tsis muaj ib tus neeg tso cai.

Kuv tau ntxiv daim ntawv qhia zaub mov thiab cov lus pom ntawm qhov Circuit hauv qab no.

Kauj Ruam 2: Teeb Peb RaspberryPi

Txhawm rau teeb tsa peb RaspberryPi, peb yuav rub lub software los ntawm Raspberry site, nrog rau qhov no koj tuaj yeem rub tawm qhov version ntawm Raspbian koj xav tau thiab muab duab SDCARD rau koj. Tom qab cov cuab yeej no tau ua nws txoj haujlwm koj tuaj yeem qhib SDCARD hauv Windows Explorer, koj yuav tuaj yeem pom qhov muab faib ntawm koj li RaspberryPi. Hauv no peb yuav pom cov ntawv hu ua cmdline.txt (tsis txhob qhib cov ntawv no hauv notepad, qhib nws hauv Notepad ++ lossis lwm yam IDE). Peb yuav ntxiv ip = 169.254.10.1 mus rau qhov kawg ntawm cov ntawv no kom ntseeg tau tias peb tuaj yeem txuas rau peb lub cuab yeej hla ethernet (nco ntsoov tias koj tsis ntxiv ENTERS thaum kawg ntawm koj cov ntaub ntawv lossis koj yuav muaj teeb meem).

Tam sim no koj tuaj yeem tso koj daim npav SDCARD hauv koj RaspberryPi thiab khau raj nws, txuas Pi rau koj lub khoos phis tawj thiab siv Putty txuas rau koj Pi hla SSH. Kuv siv cov lus txib hauv qab no los txuas rau kuv Pi tsis txhob siv Putty. "ssh [email protected]" qhov no yuav tas sijhawm, yog li ua siab ntev thiab tos kom Pi pib khau raj. Thaum tau hais kom sai rau tus lej peb yuav sau tus password tsis raug ntawm "raspberry". Nco ntsoov hloov tus password no tom qab nkag mus txhawm rau tiv thaiv ib tus neeg uas mob siab los ntawm kev nkag mus rau koj li Raspberry Pi.

Tam sim no peb yuav teeb tsa peb Pi txhawm rau muab kev ua haujlwm tsim nyog rau peb cov cai. Use "sudo raspi-config" qhib cov ntawv teeb tsa teeb tsa thiab hauv no peb yuav mus rau Kev Xaiv Kev cuam tshuam.

Hauv qab no peb yuav hloov cov kev xaiv hauv qab no ON:- SPI- I2C

Ua raws li phau ntawv qhia no teeb tsa kev sib txuas is taws nem txuas rau ntawm koj Pi, tom qab koj ua tiav qhov no peb tuaj yeem txhim kho peb cov pob khoom xav tau.

Cov pob: (khiav cov lus txib hauv qhov kev txiav txim raws li lawv tau sau tseg ntawm no)

Cov hauv qab no kom tau txais qhov hloov tshiab kawg rau peb Pi -sudo apt hloov tshiab && apt upgrade -y

Nruab peb MySQL server thiab webserver-sudo apt install mariadb-server apache2

Kuv yuav siv MySQL Workbench txhawm rau teeb tsa cov ntaub ntawv tom qab hauv phau ntawv qhia no, yog tias koj tsis siv qhov no thiab nyiam phpmyadmin koj tuaj yeem teeb tsa qhov no nrog cov lus txib hauv qab no, koj tau siv dawb rau lwm MySQL Client zoo li ntev li koj 'muaj peev xwm tuaj yeem ntshuam cov ntaub ntawv khaws cia.- sudo apt nruab phpmyadmin

Tom qab koj tau ua tiav txhua yam saum toj no peb xav tsim tus neeg siv rau peb peb cov database. Use "sudo mysql -u root" nkag mus rau hauv koj li MySQL server, nyob ntawm no peb yuav tsim ib tus neeg siv hu ua db_admin nrog nws tus lej nkag mus, khaws lo lus zais no tau sau tseg rau qee qhov rau tom qab hauv cov lus qhia. GRE ALL PRIVILEGES ON *. * TO "db_admin"@"%" IDENTIFIED BY "yourPasswordHere" WITH GRANT OPTION;

Siv qhov "\ q" hais kom tawm ntawm MySQL davhlau ya nyob twg.

Cov nab hab sej Pob: Peb tseem yuav tsum tau teeb tsa qee pob sej ua ntej yuav pib, ua raws cov lus txib hauv qab no kom ntseeg tau tias txhua yam nyob ntawd rau qhov ua tau zoo.

sudo pip3 nruab Flask Flask-Cors Flask-SocketIO gevent gevent-websocket greenlet spi SPI-Pyspidev

Ib yam li cov hauv qab no MySQL txuas sej pob khoom apt nruab python3 -mysql.connector -y

Yog tias txhua yam mus zoo tam sim no koj tuaj yeem mus ntsib koj Pi ntawm koj tus webbrowser nrog qhov chaw nyob hauv qab no

Kauj ruam 3: Teem Up Backend

Teeb Qhov Backend
Teeb Qhov Backend

Nov kuv yuav piav qhia koj li cas tuaj yeem teeb tsa lub backend koj tus kheej, thawj zaug rub cov ntaub ntawv rar los ntawm hauv qab no, unrar nws rau qee cov npe luv luv. Txuas rau koj RaspberryPi nrog FileZilla lossis WinSCP nrog cov ntaub ntawv pov thawj hauv qab no:

IP: 169.254.10.1User: piPassword: raspberry (yog tias koj hloov tus password ua nws ntawm no ib yam nkaus)

Tom qab ntawd koj tuaj yeem txuas ntxiv xa cov ntaub ntawv uas koj tsis tau sau rau hauv cov npe uas koj xav tau hauv cov npe hauv tsev ntawm tus neeg siv pi. Rau qhov yooj yim vim peb yuav xav hauv qhov teeb tsa no uas peb tau tshaj tawm tag nrho peb cov ntaub ntawv hauv qab cov ntawv teev npe.

Khaws koj qhov FTP program qhib rau qib tom ntej!

Tam sim no qhib koj cov lus txib tam sim nrog koj qhov txuas SSH vim tias peb yuav xav hloov qee qhov chaw rau lub vev xaib yog li lub ntsej muag tuaj yeem sib tham nrog tus backend. Peb yuav qhib qhov pib Apache2 teeb tsa cov ntaub ntawv thiab hloov kho nws me ntsis: sudo nano /etc/apache2/sites-available/000-default.conf

Ntxiv cov kab hauv qab no hauv qab DocumentRoot hauv cov ntaub ntawv teeb tsa peb nyuam qhuav qhib: ProxyPass/api/https://127.0.0.1:5000/api/ProxyPassReverse/api/https://127.0.0.1:5000/api/

Koj tuaj yeem saib cov duab txuas rau qhov piv txwv.

Kauj Ruam 4: Teem Up Frontend

Ua ntej xa peb cov ntaub ntawv peb yuav tau ua qee yam ua ntej peb tuaj yeem pib xa peb cov ntaub ntawv tom ntej. Qhib koj cov lus txib tam sim nrog SSH kev sib txuas koj tau ua yav dhau los thiab siv cov lus txib hauv qab no kom hloov mus rau hauv paus cov neeg siv ntawm peb RaspberryPi: "sudo su -"

Tom qab qhov no peb tuaj yeem hloov tus password ntawm peb cov neeg siv hauv paus nrog cov lus txib hauv qab no: "passwd" Qhov no yuav nug koj kom nkag mus rau tus lej tshiab, tom qab koj tau ua qhov no koj tuaj yeem hloov rov qab mus rau koj li FTP program thiab nkag mus nrog koj cov ntaub ntawv pov thawj:

IP: 169.254.10.1User: rootPassword:

Rub cov ntaub ntawv rar los ntawm hauv qab no thiab unrar nws hauv daim nplaub tshev ib ntus, koj tuaj yeem txav cov ntaub ntawv no mus rau koj RaspberryPi mus rau cov npe hauv qab no/var/www/html/, tom qab koj tau ua tiav uas koj tuaj yeem mus ntsib tom ntej ntawm http:/ /169.254.10.1, koj tseem tuaj yeem cuam tshuam tsis tau vim tias lub backend tseem tsis tau ua haujlwm, Kuv yuav qhia koj tom qab ntawm phau ntawv qhia no yuav ua li cas.

Kauj Ruam 5: Ntshuam Database rau Peb Txoj Haujlwm

Ntshuam Database rau Peb Txoj Haujlwm
Ntshuam Database rau Peb Txoj Haujlwm
Ntshuam Database rau Peb Txoj Haujlwm
Ntshuam Database rau Peb Txoj Haujlwm

Qhib qhov koj nyiam MySQL server tswj hwm qhov program thiab txuas rau koj li Raspberry Pi nrog cov ntaub ntawv pov thawj peb tsim hauv Kauj Ruam 2.

Rub tawm cov ntaub ntawv khaws tseg los ntawm hauv qab no thiab ntshuam nws raws li koj ib txwm xav tau, MySQL chaw ua haujlwm koj yuav mus rau Cov Ntaub Ntawv> Qhib SQL Script thiab xaiv cov ntaub ntawv pov tseg koj rub tawm. Then nias CTRL + SHIFT + ENTER thiab SQL tsab ntawv yuav tsum tau khiav thiab cov qauv rau database yuav tsum tau tsim.

Kuv ntxiv cov ntawv pov thawj uas kuv siv rau kuv RaspberryPi ua piv txwv hauv qab no nrog rau ntau daim duab ntawm Database qauv, koj tuaj yeem saib nws thiab sim thiab tau txais lub tswv yim dav dav ntawm txhua yam ua haujlwm li cas.

Kauj Ruam 6: Pib Pib Peb Txoj Haujlwm

Pib Pib Peb Txoj Haujlwm
Pib Pib Peb Txoj Haujlwm
Pib Pib Peb Txoj Haujlwm
Pib Pib Peb Txoj Haujlwm

Ua ntej peb tuaj yeem pib peb txoj haujlwm peb yuav tsum hloov pauv cov ntaub ntawv pov thawj pov thawj hauv cov ntaub ntawv config.py, yog tias koj ua raws cov lus qhia raws nraim li phau ntawv qhia no hais tom qab koj tuaj yeem pom cov no hauv /home/pi/Documents/Backend/src/config.py nyob ntawm no koj yuav tsum hloov pauv daim ntawv pov thawj ntawm db_config sib txawv kom phim cov uas peb tau tsim ua ntej rau peb cov ntaub ntawv. Kuv tau ntxiv qhov piv txwv ntawm qhov koj yuav pom hauv cov ntawv hauv qab no.

Tom qab ntawd koj peb yuav ntxiv.service cov ntaub ntawv no yuav ua kom ntseeg tau tias peb cov phiaj xwm pib thaum RaspberryPi pib, xyuas kom tseeb tias koj hloov cov npe kom tsim nyog ntawm qhov koj tau teeb tsa cov ntaub ntawv rov qab. Siv cov lus txib hauv qab no los tsim cov ntaub ntawv pabcuam: sudo nano /etc/systemd/system/dispenser.serviceThis yuav tsim cov ntawv pabcuam thiab luam cov kab hauv qab no rau hauv cov ntawv no.

[Chav] Nqe lus piav qhia = Tus Muab Dej Tom Qab = mysql.service

[Kev pabcuam] Hom = simpleRestart = ib txwmRestartSec = 1User = piExecStart =/usr/bin/python3 /home/pi/Documents/Backend/index.py

[Nruab] WantedBy = multi-user.target

Hloov kho kab uas nws hais /home/pi/Documents/Backend/index.py mus rau qhov chaw koj teeb koj cov ntaub ntawv backend, yog tias koj tsis ua qhov no kom raug txoj haujlwm yuav tsis pib kom raug! Kuv yuav ntxiv cov piv txwv hauv qab no.

Tom qab koj tau ua li ntawd thiab tawm ntawm tus kws kho ntawv peb tuaj yeem pab cov kev pabcuam nrog cov lus txib hauv qab no:- sudo systemctl daemon-reload- sudo systemctl pab kom dispenser-sudo systemctl pib dispenser

Thiab raws li qhov ntxiv peb tuaj yeem khiav: sudo systemctl xwm txheej faib khoom Qhov no yuav qhia qee cov ntaub ntawv nyob ib puag ncig peb cov kev pabcuam, yog tias nws nquag lossis tsis, …

Kauj Ruam 7: Rooj plaub

Rooj plaub
Rooj plaub
Rooj plaub
Rooj plaub
Rooj plaub
Rooj plaub
Rooj plaub
Rooj plaub

Nrog koj zoo siab peb nyob ze rau qhov ntawd, Kuv yuav ntxiv qee cov duab uas yuav qhia qhov tseeb uas kuv siv rau kuv qhov haujlwm, Kuv siv MDF daim hlau ntawm 18mm tuab, koj tuaj yeem xaiv qhov tuab sib txawv. Kuv lub casing tuaj yeem siv ua cov lus qhia los tsim koj li lossis koj tuaj yeem rov tsim dua qhov kuv tau ua. (Yog tias koj siv cov tuab tuab sib txawv ntawm MDF kuv cov duab yuav tsis tso cai rau koj tsim kuv ntxiv, nco ntsoov hloov nws!) Cov vaj huam sib luag uas kuv tau ua:- 2 vaj huam sib luag ntawm 32cm los ntawm 42cm (sab vaj huam sib luag)- 1 vaj huam sib luag ntawm 24cm los ntawm 32cm (phaj hauv qab)- 2 vaj huam sib luag ntawm 16cm los ntawm 24cm (phaj pem hauv ntej uas LCD nyob qis thiab phaj nyob sib ze)- 1 vaj huam sib luag ntawm 28cm los ntawm 24cm (nruab nrab phaj pom los ntawm sab xub ntiag)- 1 vaj huam sib luag ntawm 30cm los ntawm 24cm (phaj saum)

Kauj Ruam 8: Ua Tsaug Cov Khoom Kawg

Txaus Siab Kawg Cov Khoom
Txaus Siab Kawg Cov Khoom
Txaus Siab Kawg Cov Khoom
Txaus Siab Kawg Cov Khoom

Koj tau mus txog qhov kawg thiab tam sim no cia siab tias yuav ua kom txhua yam muaj tiag. Yog tias koj tsuas yog tus nyeem ntawv hla dhau, kuj zoo siab txais tos, Kuv ua tsaug rau koj nyeem txog qib kawg!

Kuv tau siv ntshav ntau, hws thiab kua muag rau hauv txoj haujlwm no yog li kuv yuav txaus siab rau nws yog tias koj tawm lus tawm tswv yim, ib qho kev thuam ntawm kev txhim kho nws yog txais tos!

Kauj Ruam 9: Teeb Meem

Kuv yuav tso txoj haujlwm hauv nws lub xeev tam sim no ua tus qauv ua haujlwm uas tuaj yeem pom ntau yam kev txhim kho.

Cov cai hauv paus ntawm tus backend tau teeb tsa hauv txoj hauv kev uas tus tswv qhev sib raug zoo tuaj yeem ua tau zoo nyob qhov twg ib tus ciav dej yuav ua raws li lub hauv paus tseem ceeb thiab txhua lwm qhov chaw yuav thawb cov ntaub ntawv thiab hloov pauv dua REST api ntawm tus tswv. Kuj tseem muaj qhov seem ntawm API token system hauv cov cai vim qhov no tau npaj los ua tab sis txiav tom qab vim yog lub sijhawm txwv.

Kuv tau muab kuv cov lej tso rau kuv tus Gitlab server thiab nyob ntawd koj tuaj yeem saib tus lej tag nrho:

Pom zoo: