Cov txheej txheem:

MySQL thiab Node-RED Nrog Raspberry Pi: 6 Kauj Ruam
MySQL thiab Node-RED Nrog Raspberry Pi: 6 Kauj Ruam

Video: MySQL thiab Node-RED Nrog Raspberry Pi: 6 Kauj Ruam

Video: MySQL thiab Node-RED Nrog Raspberry Pi: 6 Kauj Ruam
Video: Qhia website bootstrap4 table part5 2024, Kaum ib hlis
Anonim
MySQL thiab Node-RED Nrog Raspberry Pi
MySQL thiab Node-RED Nrog Raspberry Pi

Nyob zoo phooj ywg. Hauv cov lus qhia no, kuv yuav qhia koj yuav siv Node-RED mysql ntawm qhov twg los ua qhov yooj yim CPU ntsuas kub. Cia peb pib.

Qhov no tseem yuav yog tus pib qhia rau kev kawm:

Node-RED, nws muaj peev xwm, thiab cov ntsiab lus tseem ceeb.

Kev teeb tsa PHPMyAdmin thiab MySQL.

Javascript Function Node hauv Node-RED.

Thov txim rau daim duab plooj.

Kauj Ruam 1: Yam Yuav Tsum Tau

Yam Uas Xav Tau
Yam Uas Xav Tau
Yam Uas Xav Tau
Yam Uas Xav Tau
Yam Uas Xav Tau
Yam Uas Xav Tau

Txog qhov haujlwm no kuv tab tom siv Raspberry Pi Zero vim tias nws me me thiab pheej yig Nws tuaj yeem yooj yim haum rau hauv koj lub hnab ris. Yog li koj lub software taug kev nrog koj. Tab sis koj tuaj yeem siv txhua lub khoos phis tawj uas koj xaiv, tsuav nws yog Debian Linux raws.

Koj tseem yuav xav tau Kev Sib Txuas Hauv Is Taws Nem thiab nkag mus hauv koj lub computer ntawm lub davhlau ya nyob twg (lossis ssh).

Yog tias koj siv Mac lossis Linux:-

$ ssh pi@your_pi's_ip_address

Yog tias koj siv Windows, rub tawm thiab teeb tsa Putty:-

www.chiark.greenend.org.uk/~sgtatham/putty…

Kauj ruam 2: ID nkag mus

ID nkag mus
ID nkag mus
ID nkag mus
ID nkag mus
ID nkag mus
ID nkag mus

Default Raspbian ID nkag mus:-

pi thiab raspberry.

Tom ntej no, khiav cov lus txib no.

sudo apt-tau hloov tshiab

sudo apt-tau hloov tshiab

sudo apt-tau nruab nodejs npm nodered.

Nco ntsoov tias koj yuav tsis tau txais nodered nkag tau yooj yim yog tias koj siv cov laus version ntawm Raspbian, lossis Ubuntu 18.04 LTS lossis Debian 9

Hauv cov xwm txheej no koj yuav tsum ua haujlwm ntawm Node-RED Install script:-

bash <(curl -sL

Kauj Ruam 3: Tsawg Ntau Cov Lus txib

Ob peb Ntxiv Cov Lus txib
Ob peb Ntxiv Cov Lus txib
Ob peb Ntxiv Cov Lus txib
Ob peb Ntxiv Cov Lus txib
Ob peb Ntxiv Cov Lus txib
Ob peb Ntxiv Cov Lus txib
Ob peb Ntxiv Cov Lus txib
Ob peb Ntxiv Cov Lus txib

Tom qab koj muaj txhua yam teeb tsa khiav

sudo apt-tau nruab -y mysql-server php-mysql phpmyadmin apache2

Online koj tseem tuaj yeem pom cov lus qhia yuav ua li cas rau nruab phpmyadmin thiab mysql.

sudo nano /etc/apache2/apache2.conf

Mus rau hauv qab thiab ntxiv

Xws li /etc/phpmyadmin/apache.conf

Txuag siv Ctrl + O, Nkag mus. Tawm nrog CTrl + x

sudo /etc/init.d/apache2 rov pib dua

Yog tias phpmyadmin tau teeb tsa tiav koj yuav tsum tuaj yeem nkag mus rau localhost/phpmyadmin

Hloov localhost nrog koj tus IP tus IP.

Nkag mus raws li lub hauv paus thiab tus password koj tau teeb tsa ua ntej thaum lub sijhawm phpmyadmin teeb tsa.

Kauj Ruam 4: Node-RED thiab PHPMyAdmin

Node-RED thiab PHPMyAdmin
Node-RED thiab PHPMyAdmin
Node-RED thiab PHPMyAdmin
Node-RED thiab PHPMyAdmin
Node-RED thiab PHPMyAdmin
Node-RED thiab PHPMyAdmin

Node-RED tso cai rau koj tsim cov duab txuas nrog cov haujlwm lossis ntws. Kawm paub ntau ntxiv txog Node-RED ntawm

Txog tam sim no, kuv yuav qhia koj yuav ua li cas los tsim lub logger yooj yim.

Mus rau https://raspberrypi.local: 1880

Ua raws li cov duab.

Nov yog JSON txoj hlua

[{"id": "7c27ad7b.907564", "type": "tab", "label": "MySQL Test", "Disabled": cuav, "info": "Qhov no yog ntws los qhia tawm MySQL node hauv Node-Red. / NPeb ntsuas qhov ntsuas kub ntawm Raspberry Pi CPU thiab nkag mus rau hauv lub database. "}, {" Id ":" abb00580.da71b8 "," type ":" inject "," z ":" 7c27ad7b. 907564 "," name ":" Trigger "," topic ":" "," payload ":" "," payloadType ":" date "," repeat ":" 2 "," crontab ":" "," ib zaug ": tsis tseeb," onceDelay ": 0.1," x ": 120," y ": 120," xov hlau ":

Luam thiab muab cov hlua no zoo li nws nyob hauv qhov chaw pom hauv daim duab.

Kuv kuj tau tshaj tawm cov duab uas qhia cov nkag hauv PHPMyAdmin.

Kauj Ruam 5: Nco Ntsoov Yam

Nco Ntsoov Yam
Nco Ntsoov Yam
Nco Ntsoov Yam
Nco Ntsoov Yam

Ob peb yam tseem ceeb kom nco ntsoov yog tus IP chaw nyob. Nws yuav txawv. Tsis tas li, koj yuav tsum xub tsim cov ntaub ntawv npe Node-RED-test, lub rooj npe hu ua xeem thiab npe lub npe "Field". Koj tuaj yeem ua tiav txhua qhov no nrog kev pab ntawm PHPMyAdmin lub vev xaib cov cuab yeej. Nws ua rau muab cov ntaub ntawv khaws cov ncuav mog qab zib. Muaj ntau qhov peev txheej hauv online los pab koj. Koj yuav tsum nruab vcgencmd ntawm koj lub computer. Nws yog lub cuab tam tseem ceeb uas tso cai rau koj los saib koj cov ntaub ntawv xov xwm. Nws los ua ntej teeb tsa ntawm Raspbian Stretch.

Txhawm rau khiav Node-RED:-

1) ncaj qha-

$ node-liab-pib

2) Hauv txhua qhov khau raj-

$ sudo systemctl pab kom nodered.service

Kauj Ruam 6: Koj Tus Kheej CPU_Temp_Logger

Koj Tus Kheej CPU_Temp_Logger!
Koj Tus Kheej CPU_Temp_Logger!

Tam sim no yog tias koj tshawb cov ntaub ntawv hauv phpmyadmin raws li qhia hauv daim duab, koj yuav pom cov ntawv nkag rau hauv koj lub rooj nrog qhov kub ntawm koj li CPU.

Txoj haujlwm Node yog dab tsi tseem ceeb ntawm no. Nws tso cai rau koj los lim cov lus thiab xa cov lus nug nrog rau qhov ntsuas sib txawv. Kuv tau piav qhia nws hauv cov haujlwm muaj nuj nqi. Txheeb nws tawm. Cov ntawv nkag tau ua txhua txhua ob lub vib nas this, tab sis koj tuaj yeem hloov qhov ncua hauv kev txhaj tshuaj.

Muaj Kev lom zem:)

Thov nyiam qhov haujlwm no thiab tshaj tawm cov lus pom, ua rau lawv pab tau tiag tiag. Tsis tas li, nco ntsoov taw qhia ib qho kev ua yuam kev uas kuv tau ua, thiab xav nug cov lus nug.

Ua Tsaug Rau Saib Kab Lus No.

Nyob zoo !!!

Pom zoo: