Cov txheej txheem:
- Kauj Ruam 1: Pib Nrog Node-liab
- Kauj Ruam 2: Kev faib cov ntaub ntawv hauv Node-liab
- Kauj Ruam 3: Database Nrog Wampserver
- Kauj ruam 4: Database
- Kauj Ruam 5: Node-liab rau Wampserver
- Kauj Ruam 6: Siv Cov Ntaub Ntawv Los Ntawm Wampserver rau Node-red
- Kauj Ruam 7: Ua kom tiav
Video: UCL-IIOT-Tswb System Nrog Database thiab Node-liab: 7 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Lub hom phiaj ntawm qhov kev tsim no yog qhia txog kev txuas Arduino nrog Node-red thiab cov ntaub ntawv khaws cia, yog li koj tuaj yeem sau cov ntaub ntawv thiab tseem khaws nws rau tom qab siv.
Txog qhov kev tsim no kuv siv cov lus ceeb toom yooj yim arduino uas tso tawm 5 cov ntaub ntawv tus lej, txhua qhov cais nrog tus lej.
Nws tsis tas yuav tsum muaj cov ntaub ntawv qhia tseeb thiab qhov haujlwm tuaj yeem yog dab tsi.
Ib feem tseem ceeb yog tias cov ntaub ntawv tau faib nrog tus lej raws li pom ntawm lub vijtsam no.
Cov zis tuaj yeem ua piv txwv zoo li no: "324, 0, 0, 1, 1"
(ua tiav cov phiaj xwm thiab cov lus qhia rau kev tsim cov arduino tau txuas rau hauv qab ntawm qhov kev qhia no)
Kauj Ruam 1: Pib Nrog Node-liab
Txog qhov kev qhia no peb xav tias koj twb tau teeb tsa Node-red, tab sis muaj qee qhov xim palettes ntxiv uas tau siv rau txoj haujlwm no uas peb xav tau kom nws ua haujlwm
Nrhiav lub pob "Manage Palette" thiab teeb tsa cov palettes hauv qab no.
- ntawm-liab-dashboard
- node-liab-node-mysql
- ntawm-liab-node-arduino
- ntawm-liab-node-serialport
Nws yuav tsum qhia qee qhov tshiab palettes ntawm sab ntawm Node-liab khawm cov ntawv qhia zaub mov.
Kauj Ruam 2: Kev faib cov ntaub ntawv hauv Node-liab
Tam sim no Node-liab tau npaj txhij mus peb yuav tsum pib tawm los ntawm kev faib peb cov ntaub ntawv mus rau hauv daim cais.
Qhov no yog vim li cas peb ua kom ntseeg tau cais lawv nrog tus lej hauv Arduino code.
Ua ntej peb pib los ntawm kev tso Arduino Input node, pom ntawm lub vaj huam sib luag sab laug.
Koj yuav tsum paub tseeb tias nws muaj cov lej raug (Kuv siv COM4) chaw nres nkoj thiab Baud tus nqi (hauv kuv qhov haujlwm kuv siv 9600 baud tus nqi)
Yog tias teeb tsa raug, nws yuav tsum hais tias nws tau txuas nrog.
Tom ntej no peb tsim Javascript muaj nuj nqi thaiv thiab txuas nws tom qab Arduino input node. Qhov thaiv no tso cai rau peb ua haujlwm hauv Javascript, thiab ntawm no peb sau tus lej uas tuaj yeem faib peb cov ntaub ntawv rau txhua tus lej.
Hauv qhov kev ua haujlwm no kuv faib kuv 5 cov ntaub ntawv siv cov cai hauv qab no:
var m1 = {topic: "light1", payload: msg.payload.split (",") [0]}; var m2 = {lub ncauj lus: "light2", payload: msg.payload.split (",") [1]}; var m3 = {topic: "light3", payload: msg.payload.split (",") [2]}; var m4 = {lub ncauj lus: "millis", payload: msg.payload.split (",") [3]}; var m5 = {lub ncauj lus: "onoff", payload: msg.payload.split (",") [4]}; rov qab [m1, m2, m3, m4, m5];
(hloov cov cai raws li tsim nyog)
Nco ntsoov tias lub node tau teeb tsa rau 5 qhov txiaj ntsig (lossis koj qhov sib npaug)
Raws li pom hauv lub vijtsam, peb tam sim no muaj 5 qhov tso tawm uas peb txhua qhov txuas mus rau qhov debug ntawm kab thiab cov ntawv dashboard ntawm. Qhov no yuav muaj txiaj ntsig zoo rau thaum peb xav pom nws ntawm UI.
Kauj Ruam 3: Database Nrog Wampserver
Rau peb cov ntaub ntawv ua haujlwm koj yuav tsum muaj Wampserver teeb tsa. Tom qab nws tau teeb tsa thiab pom zoo li lub cim ntsuab (tom qab koj tau pib ua txhua qhov kev pabcuam), koj yuav tsum qhib "phpMyAdmin" uas yuav tsum coj koj mus rau lub vijtsam nkag. yav dhau los hloov nws, tsuas yog nkag "hauv paus" hauv lub npe siv thiab nkag mus.
Nias lub phpmyadmin khawm hauv qab cov cuab yeej hauv kab sab laug thiab nws yuav tsum qhib cov ntawv qhia zaub mov, uas zoo ib yam li pom hauv daim duab saum toj no.
Tsim cov ntaub ntawv tshiab thiab lub npe nws qee yam cuam tshuam nrog koj txoj haujlwm, kuv lub npe hu ua "alarmsystem" (cov npe no yuav yog cov ntaub ntawv rhiab)
Hauv qab cov ntaub ntawv ntawd, tsim lub rooj tshiab thiab npe nws, kuv lub npe hu ua "alarmdata"
nws yuav nug yog tias koj xav siv "latin1_swedish_ci" thiab peb tsuas yog khaws nws li ntawd.
Tam sim no koj tsim 6 lub rooj (1 ntau dua li cov ntaub ntawv peb muaj)
Thawj lub rooj xav tau siv cov ntaub ntawv hom "longtext"
thiab tas cov ntaub ntawv siv "mediumtext"
Nco ntsoov sau lawv. (thawj cov ntaub ntawv yuav tsum muaj npe "sijhawm"
Kauj ruam 4: Database
Cov ntaub ntawv Wampserver yuav tsum zoo ib yam li qhov no.
(tab sis tsis muaj cov ntaub ntawv tseeb, raws li peb tseem tsis tau mus txog qhov ntawd)
Kauj Ruam 5: Node-liab rau Wampserver
Tam sim no peb xav tau cov ntaub ntawv peb tab tom tso tawm los ntawm peb cov arduino mus rau peb Wampserver.
Pib los ntawm kev tsim lwm qhov Javascript muaj nuj nqi thaiv thiab txuas nws rau peb cov arduino input node.
Hauv tsab ntawv thaiv no, peb tau faib peb cov ntaub ntawv ib zaug ntxiv, tab sis peb ntxig nws rau hauv peb cov database ib yam.
var cov ntaub ntawv = msg.payload.split (","); var Green1 = cov ntaub ntawv [0]; var Green2 = cov ntaub ntawv [1]; var Tswb = cov ntaub ntawv [2]; var Millis = cov ntaub ntawv [3]; var IsActive = cov ntaub ntawv [4]; var tawm = "INSERT INTO alarmsystem.alarmdata (Lub Sijhawm, Green1, Green2, Tswb, Millis, IsActive) VALUES ('"+Hnub Tshiab (). toISOString (). hlais (0, 19).replace (' T ',' ')+"', '"+Green1+"', '"+Green2+"', '"+Tswb+"', '"+Millis+"', '"+IsActive+"')"; msg.topic = tawm; rov qab msg;
Daim ntawv ceeb toom kuv nkag mus "INSERT INTO alarmsystem.alarmdata", qhov no yog lub npe peb muab rau peb cov database thiab cov lus, nco ntsoov tias koj sau lub npe tseeb uas koj muab rau koj li database.
Tam sim no txuas Javascript thaiv mus rau qhov debug node thiab tseem muaj "mysql" node pom nyob hauv qab qhov chaw khaws khoom ntawm sab laug.
hauv qab mysql thaiv koj lub npe nws zoo ib yam li koj lub database "alarmsystem"
hloov cov neeg siv rau "hauv paus" (lub npe peb siv los nkag rau hauv peb lub server)
host, chaw nres nkoj thiab database yuav tsum tau ua tiav nrog:
Tus tswv tsev: 127.0.0.1
Chaw nres nkoj: 3306
Database: tswb system
Yog tias txhua yam ua tiav, nws yuav tsum txuas nrog tom qab koj xa koj cov kev hloov pauv.
Koj yuav tsum muaj peev xwm pom tau tias cov ntaub ntawv tam sim no teev koj cov ntaub ntawv los ntawm Arduino ncaj qha.
Kauj Ruam 6: Siv Cov Ntaub Ntawv Los Ntawm Wampserver rau Node-red
Txog qhov kawg peb xav pom yog tias peb tuaj yeem nqa cov ntaub ntawv peb tau khaws tseg thiab muab rov qab rau hauv peb Node-liab thiab vam tias yuav tso tawm.
Pib tawm los ntawm kev tso "txhaj tshuaj" ntawm
Hauv qab cov ncauj lus hauv qhov ntawm no peb tso tus lej: XAUS*LOS NTAWM alarmsystem.alarmdata
Qhov no yuav tuaj yeem nrhiav peb cov ntaub ntawv database thaum peb nias nws.
Txuas qhov txhaj tshuaj mus rau qhov tshiab "mysql" ntawm qhov teeb tsa zoo ib yam li peb tau ua hauv qib dhau los.
Txuas mysql node mus rau qhov debug node thiab tus qauv ntawm pom hauv qab dashboard.
Tus qauv ntawm tus qauv yuav yog peb lub rooj uas peb tuaj yeem hloov kho los qhia cov ntaub ntawv los ntawm cov ntaub ntawv khaws tseg raws li nws tau tsim.
Nkag mus rau cov cai pom hauv lub vijtsam saum toj no (hloov raws li xav tau) thiab tam sim no nws yuav tsum qhia cov ntaub ntawv rooj hauv peb Node-red UI.
Peb tseem tuaj yeem ntxiv khawm dashboard txhawm rau hloov kho lub rooj los ntawm UI nws tus kheej.
Pib los ntawm kev tsim khawm khawm.
txuas lub pob nyem rau ntawm Javascript muaj nuj nqi thaiv.
hauv txoj haujlwm thaiv peb ntxig cov cai hauv qab no.
msg.topic = "SELECT * FROM alarmdata ORDER BY Green1 DESC LIMIT 20"; xa rov qab msg;
(Green1 yog thawj cov ntaub ntawv sib txawv hauv cov lus)
txoj haujlwm no yuav tsum txuas nrog cov tswv yim ntawm peb mysql node peb tau ua yav dhau los hauv cov kauj ruam no.
Kauj Ruam 7: Ua kom tiav
Tam sim no peb UI yuav tsum suav nrog hloov tshiab ntawm peb cov ntaub ntawv thiab cov lus nrog cov ntaub ntawv los ntawm peb tus neeg rau zaub mov nws tus kheej.
Qhov no txhais tau tias peb tau tsim kev sib txuas ntawm Arduino, UI raws txoj haujlwm thiab cov ntaub ntawv khaws tseg.
Yog tias koj xav paub yuav ua li cas kuv li Arduino Tswb System ua haujlwm, Kuv tau ntxiv ib daim ntawv uas piav qhia tias yuav ua li cas thiab tau teeb tsa.
Ib yam li kev xa tawm tag nrho ntawm cov phiaj xwm liab.
Pom zoo:
Fingerprint thiab RFID Raws Kev Koom Tes Nrog Siv Raspberry Pi thiab MySQL Database: 5 Cov Kauj Ruam
Fingerprint thiab RFID Raws Kev Tuaj Koom Nrog Siv Raspberry Pi thiab MySQL Database: Yees duab ntawm Txoj Haujlwm no
Tsis Siv Neeg Lub Teeb thiab Pump Aquarium System Nrog Arduino thiab RTC Timer: 3 Kauj Ruam
Tsis Siv Neeg Lub Teeb thiab Pump Aquarium System Nrog Arduino thiab RTC Timer: Lub thoob dej yug ntses tuaj yeem ua rau xoom kev cuam tshuam yuav tsum tau txhawb nqa tus kheej nrog rau qee qhov kev saib xyuas thiab thev naus laus zis :) thawj. Kuv siv 2 lub teeb dej nyab 50 W txhua thiab 16 W
Haib Standalone Home Automation System - Pi, Sonoff, ESP8266 thiab Node -Red: 9 Kauj Ruam (nrog Duab)
Lub Hwj Chim Tsis Muaj Tsev Nyob Hauv Tsev Tsis Muaj Peev Xwm - Pi, Sonoff, ESP8266 thiab Node -Red: Phau ntawv qhia no yuav tsum tau coj koj mus rau thawj lub hauv paus uas koj tuaj yeem hloov lub teeb lossis cov cuab yeej siv/tawm ntawm txhua lub cuab yeej uas tuaj yeem txuas rau koj lub network hauv zej zog, thiab nrog zoo customizable web interface. Kev nthuav dav rau kev txuas ntxiv/ ntxiv cov yam ntxwv yog qhov dav, suav nrog
8 Relay Tswj Nrog NodeMCU thiab IR Txais Txais Siv WiFi thiab IR Chaw Taws Teeb thiab Android App: 5 Kauj Ruam (nrog Duab)
8 Relay Tswj Nrog NodeMCU thiab IR Txais Txais Siv WiFi thiab IR Chaw Taws Teeb thiab Android App: Tswj 8 qhov hloov pauv hloov siv nodemcu thiab ir tus txais tshaj wifi thiab ir chaw taws teeb thiab hauv app.the ir tej thaj chaw deb ua haujlwm ywj pheej ntawm wifi txuas. NTUJ
Kub thiab Vaum Zaub thiab Sau Cov Ntaub Ntawv Nrog Arduino thiab Ua: 13 Kauj Ruam (nrog Duab)
Kub thiab Vaum Zaub thiab Sau Cov Ntaub Ntawv Nrog Arduino thiab Ua: Intro: Qhov no yog Txoj Haujlwm uas siv Arduino board, Sensor (DHT11), lub khoos phis tawj Windows thiab Kev Ua Haujlwm (rub tawm dawb) program los tso saib Kub, Cov ntaub ntawv vaum hauv digital thiab bar kab ntawv, tso tawm lub sijhawm thiab hnub tim thiab suav lub sijhawm suav