Cov txheej txheem:

Khaws thiab Duab EC/pH/ORP Cov Ntaub Ntawv Nrog TICK Stack thiab NoCAN Platform: 8 Kauj Ruam
Khaws thiab Duab EC/pH/ORP Cov Ntaub Ntawv Nrog TICK Stack thiab NoCAN Platform: 8 Kauj Ruam

Video: Khaws thiab Duab EC/pH/ORP Cov Ntaub Ntawv Nrog TICK Stack thiab NoCAN Platform: 8 Kauj Ruam

Video: Khaws thiab Duab EC/pH/ORP Cov Ntaub Ntawv Nrog TICK Stack thiab NoCAN Platform: 8 Kauj Ruam
Video: Khaws wb tej duab tau qhiav me nyuam 5/11/2018 2024, Kaum ib hlis
Anonim
Khaws thiab Duab EC/pH/ORP Cov Ntaub Ntawv Nrog TICK Stack thiab NoCAN Platform
Khaws thiab Duab EC/pH/ORP Cov Ntaub Ntawv Nrog TICK Stack thiab NoCAN Platform

Qhov no yuav mus dhau yuav siv NoCAN Platform los ntawm Omzlo thiab uFire cov ntsuas ntsuas EC, pH thiab ORP. Raws li lawv lub vev xaib hais tias, qee zaum nws yooj yim dua tsuas yog siv qee lub cable rau koj lub cim sensor. CAN muaj qhov zoo ntawm kev sib txuas lus thiab lub zog hauv ib kab ntawv yog li cov teeb liab thiab roj teeb tsis muaj teeb meem. Lub khoos phis tawj ntawm cov nodes tuaj yeem yooj yim dua; tsis muaj teeb meem nrog kev pw tsaug zog lossis teeb tsa WiFi, piv txwv. NoCAN platform kuj muaj qee qhov zoo xws li kev teeb tsa lub nodes hla CAN npav.

NoCAN platform siv Raspberry Pi, yog li txhua yam uas tuaj yeem ua tau yuav muaj. Peb yuav ua kom zoo dua los ntawm kev txhim kho TICK pawg. Qhov ntawd yuav cia peb siv InfluxDB los khaws cov ntsuas. Nws yog lub sijhawm teev raws cov ntaub ntawv lub hom phiaj-ua rau cov khoom no. Nws kuj tseem los nrog Chronograf los ua dashboards thiab tso tawm txhua yam ntawm cov ntaub ntawv no peb yuav mus. T thiab K sawv rau Telegraf thiab Kapacitor. Telegraf tso rau hauv nruab nrab ntawm cov ntaub ntawv koj xa thiab Influx database. Kapacitor yog lub cav tshwm sim. Thaum muaj qee yam tshwm sim, nws tuaj yeem xa ntawv ceeb toom rau koj los ntawm ntau txoj hauv kev. Thiab, tsuas yog vim tias kuv nyiam nws zoo dua Chronograf, Kuv yuav teeb tsa Grafana rau cov ntawv xov xwm.

Kauj Ruam 1: Npaj Raspberry Pi Npaj

Lub taub hau mus rau nplooj ntawv Rasbian Download thiab rub daim duab nrog lub desktop thiab pom zoo software, tom qab ntawd nyem nws mus rau SD daim npav.

Tom qab cov duab nyob ntawm koj daim npav SD, koj yuav tsum muaj ob ntu, hauv paus thiab khau raj. Qhib lub davhlau ya nyob twg hauv khau raj thiab ntaus:

kov ssh

Qhov ntawd yuav pab kom SSH.

Ces ntaus:

nano wpa_supplicant.conf

Thiab luam/muab tshuaj txhuam hauv qab no tom qab koj tau hloov kho nws rau koj lub nroog thiab WiFi chaw:

teb chaws = US

ctrl_interface = DIR =/var/run/wpa_supplicant GROUP = netdev update_config = 1 network = {ssid = "NETWORK-NAME" psk = "NETWORK-PASSWORD"}

Lub teb chaws cov cai tuaj ntawm no.

Pab kom SPI:

ncha "dtparam = spi = on" >> config.txt

Muab daim npav SD tso rau hauv koj li Raspberry Pi, tos me ntsis thiab ntaus:

ssh [email protected]

Koj yuav tsum nyob ntawm tus ID nkag mus sai. Tus password yog raspberry.

Kauj Ruam 2: Teeb NoCAN

Omzlo muab cov lus qhia ntxaws txog kev teeb tsa. Tab sis kuv txiav txim siab ua kom yooj yim rau kuv tus kheej thiab kawm me ntsis txog Bash sau ntawv. Yog li tau txais koj li Raspberry Pi pib thiab SSH lossis cov davhlau ya nyob twg rau hauv nws.

Kuv kawm paub tias tsuas yog ntau lub sijhawm txhim kho tuaj yeem nkag mus rau tsim tsab ntawv Bash zoo li txawm nws yog koj tab tom sim ua kom nruab. Muaj 1000 txoj hauv kev kom ua qee yam ua tiav, qee qhov yooj yim dua los tuav lossis ua dua lwm qhov. Thaum kawg, kuv tsis tau ua ntau. Yog tias koj ua:

wget https://ufire.co/nocan.sh && chmod +x nocan.sh && sudo./nocan.sh

Hauv koj li Raspberry Pi lub davhlau ya nyob twg, nws yuav rub tawm thiab ua raws tsab ntawv.

Tom qab ntawd nws:

  1. Rub tawm Omzlo NoCAN daemon thiab teeb nws hauv/usr/bin kom nkag tau yooj yim, ua rau ~/.nocand nplaub tshev thiab sau cov ntaub ntawv teeb tsa yooj yim heev nrog tus password teeb rau 'password'. Koj yuav tsum hloov pauv mus rau lwm yam, nws nyob ntawm ~/.nocand/teeb tsa.
  2. Rub tawm Omzlo NoCAN tus neeg siv khoom thiab luam nws hauv /usr /bin thiab tsim cov ntaub ntawv teeb tsa yooj yim nrog tib lo lus zais teeb tsa. Nws nyob ntawm ~/.nocanc.conf.
  3. Teeb tsa qhov Systemd cov kev pabcuam uas ua rau NoCAN daemon khiav.
  4. Sau cov ntaub ntawv nab nab mus rau ~/.nocand, nocan_ufire.py. Nws yuav tham nrog NoCAN ntawm lub khoos phis tawj thiab ntsuas EC, pH, thiab ORP ntsuas, txheeb xyuas cov txiaj ntsig thiab ntxiv lawv rau hauv InfluxDB database.
  5. Ntxiv InfluxData repo rau apt thiab teeb tsa TICK pawg. Thiab txij li kuv nyiam nws dhau Chronograf, nws teeb tsa Grafana ib yam.
  6. Tsim qhov khoob Influx database

Qee qhov gotchas koj tuaj yeem nkag mus rau:

  • Koj qhov chaw yuav tsis teeb tsa, yog li khiav dpkg-reconfigure locales
  • Kev teeb tsa Grafana yuav dai, yog li cia li sim dua.
  • Kev da dej da dej tuaj yeem tsis pib nyob rau lub sijhawm kom muaj tsab ntawv ntxiv cov ntaub ntawv khaws cia, hom

    curl -i -XPOST https:// localhost: 8086/query --data -urlencode "q = CREATE DATABASE nocan"

  • Tsab ntawv no tsuas ua haujlwm raws li tus neeg siv pi pib. Koj yuav tsum hloov pauv pi rau koj lub npe siv uas tsim nyog yog tias koj nyob hauv tus neeg siv sib txawv.

Qhov kawg yog ntxiv txoj haujlwm cron. Kuv nrhiav tsis tau txoj hauv kev zoo los sau tsab ntawv no, yog li ntaus 'crontab -e' los kho tus kheej thiab ntxiv ' * * * * * * nab hab sej /home/pi/.nocand/nocan_ufire.py'.

Thaum qhov no ua tiav, koj tuaj yeem txheeb xyuas txhua yam yog teeb tsa thiab ua haujlwm zoo li nws yuav tsum yog. Grafana nyob ntawm https:// [Raspberry Pi Chaw Nyob]: 3000/. Koj yuav tsum pom nplooj ntawv nkag mus, admin/admin yog lub neej ntawd.

Chronograf tuaj yeem pom ntawm https:// [Raspberry Pi Chaw Nyob]: 8888/

Kauj Ruam 3: Muab UFire Hardware Ua Ke

Muab UFire Hardware Ua Ke
Muab UFire Hardware Ua Ke

Ua ntej peb tuaj yeem sib sau ua ke kho vajtse, muaj ib yam yuav tsum hais. UFire ISE pawg thawj coj tuaj yeem siv los ntsuas ob qho pH thiab ORP. Kho vajtse zoo ib yam, tab sis software txawv. Vim tias kho vajtse zoo ib yam, qhov ntawd txhais tau tias I2C chaw nyob yog, los ntawm lub neej ntawd, zoo ib yam nkaus. Thiab cov ntsuas sib txuas lus los ntawm I2C yog li ib tus yuav xav tau hloov pauv. Txog qhov haujlwm no, peb yuav xaiv ib qho ntawm ISE cov laug cam thiab siv nws los ntsuas ORP. Ua raws cov theem ntawm no, hloov chaw nyob mus rau 0x3e.

Tam sim no qhov chaw nyob tau hloov pauv, muab kho vajtse ua ke tau yooj yim. Qhov teeb tsa no yog ua los ntawm kev ua haujlwm yav dhau los ua qhov zoo ib yam tab sis siv BLE ntau dua li tuaj yeem xa cov ntaub ntawv. Koj tuaj yeem nyeem txog nws ntawm Arduino Project Hub. Txhua lub cuab yeej ntsuas siv Qwiic txuas qhov txuas yog li tsuas yog txuas txhua yam ua ke hauv cov saw, tsuas muaj ib txoj hauv kev los ntxig Qwiic rau Qwiic xov hlau. Koj yuav xav tau ib Qwiic rau Txiv neej xaim txhawm rau txuas ib qho ntawm lub ntsuas cua mus rau CANZERO node. Cov xov hlau zoo ib yam thiab xim xim. Txuas dub rau ntawm qhov GND, liab rau ib qho +3.3V lossis +5V tus pin, xiav rau SDA tus pin uas yog D11, thiab daj rau SCL tus pin ntawm D12.

Txog qhov haujlwm no, nws yuav cia siab tias cov ntaub ntawv ntsuas kub los ntawm EC sensor, yog li nco ntsoov xa lub ntsuas kub mus rau EC board. Txhua lub rooj tsavxwm muaj peev xwm ntsuas qhov kub thiab txias txawm hais tias. Tsis txhob hnov qab xa EC, pH thiab ORP sojntsuam mus rau qhov ntsuas tsim nyog. Lawv tau yooj yim txuas nrog BNC txuas. Yog tias koj muaj lub thaiv, muab txhua yam tso rau hauv no yuav yog lub tswv yim zoo, tshwj xeeb tshaj yog xav tias dej yuav koom nrog.

Kauj Ruam 4: NoCAN Kho Vajtse

NoCAN Kho vajtse
NoCAN Kho vajtse

Sib dhos cov cuab yeej NoCAN kuj yooj yim. Txuas PiMaster rau Raspberry Pi thiab nrhiav lub zog tsim nyog rau nws.

Ua raws li Omzlo cov lus qhia ntawm kev ua cable rau koj qhov project.

Muab koj lub node thiab nrhiav chaw rau PiMaster.

Kauj Ruam 5: Program CANZERO Node

Program CANZERO Node
Program CANZERO Node

Ib qho zoo tshaj plaws txog kev teeb tsa no yog koj tuaj yeem nkag mus rau cov ntshav txawm tias tom qab lawv raug xa mus. Lawv tau programmed hla CAN xaim, yog li koj tuaj yeem rov tsim kho lawv txhua lub sijhawm koj xav tau.

Txog qhov ntawd, koj yuav xav tau Arduino IDE teeb tsa, PiMaster ntawm koj lub network, thiab koj lub node txuas nrog CAN npav. Koj tseem yuav xav tau ib txoj haujlwm hu ua nocanc teeb tsa ntawm koj lub khoos phis tawj txhim kho. Txhua yam uas tau piav qhia ntawm Omzlo's nplooj ntawv teeb tsa.

Mus ntsib GitHub thiab luam cov cai rau hauv daim duab tshiab Arduino IDE. Hloov lub Rooj Tswjhwm Saib rau Omzlo CANZERO thiab xaiv qhov nyob hauv 'Chaw nres nkoj' ntawv qhia zaub mov. Tom qab ntawd tsuas yog nyem upload zoo li qub. Yog tias txhua yam mus raws li phiaj xwm, koj yuav tsum muaj lub program program node npaj los ntsuas qee yam.

Kauj Ruam 6: Txhua Qhov No Tie Ua Ke Li Cas?

Txhua Qhov No Tie Ua Ke Li Cas?
Txhua Qhov No Tie Ua Ke Li Cas?

Tam sim no txhua qhov software thiab kho vajtse tau teeb tsa, cia siv sijhawm los tham txog yuav ua li cas txhua yam nws yuav ua haujlwm tiag tiag thiab qhia tawm kuv qhov kev txawj GIMP …

Hauv kev xaus:

  1. CANZERO node txuas nrog PiMaster thiab xa mus rau qhov chaw
  2. Txhua feeb Cron txoj haujlwm tau ua haujlwm ntawm PiMaster. Nws yuav ua ib tsab ntawv nab hab sej.
  3. Python tsab ntawv yuav xa cov lus txib rau ntawm qhov qhia nws kom ntsuas lossis qee yam ua.
  4. Lub node yuav ua raws li cov lus txib yog thiab rov ua tiav hauv JSON hom.
  5. Python tsab ntawv yuav tau txais qhov txiaj ntsig ntawd, cais nws, thiab hloov kho InfluxDB nrog nws.

Kauj ruam kawg yog saib cov ntaub ntawv sau hauv qee cov duab zoo saib.

Kauj Ruam 7: Teeb Sijhawm Chronograf lossis Grafana

Teem Sijhawm Chronograf lossis Grafana
Teem Sijhawm Chronograf lossis Grafana

Qhov kawg uas yuav tsum tau ua yog teeb tsa cov kab kos hauv Chronograf lossis Grafana.

Koj yuav tsum teeb tsa cov ntaub ntawv qhov chaw. Qhov ua tsis tiav rau InfluxDB zoo. Qhov chaw nyob rau nws yog 'https:// localhost: 8086' thiab tsis muaj tus username lossis password.

Ob qho tib si zoo sib xws uas lawv tau teeb tsa rau hauv Dashboards uas muaj cov lej hauv kab hauv lawv. Ob leeg muaj Kev Tshawb Fawb thaj chaw uas tso cai rau koj pom cov kev ntsuas thiab sib cuam tshuam tsim cov kab kos. Nco ntsoov lub npe database yog 'nocan' thiab teeb tsa rau hauv ntau qhov kev ntsuas nrog ib tus nqi.

Zoo li kuv tau hais, Kuv nyiam Grafana vim tias nws tau teeb tsa ntau dua li Chronograf. Nws tseem yog txawb-phooj ywg, qhov twg Chronograf tsis yog. Cov kab kos tau yooj yim kos thiab sib qhia

Kauj Ruam 8: Qee Qhov Kev Txhim Kho

  • Koj tuaj yeem teeb tsa tus tswv tsev lub npe ntawm koj tus Raspberry Pi kom nkag tau yooj yim dua ntawm koj lub network. Koj tuaj yeem ua qhov ntawd hauv raspi-config. Kuv hloov kuv li nocan, yog li kuv tuaj yeem mus rau nocan.local kom nkag tau nws (tsis ua haujlwm ntawm Android).
  • Koj tuaj yeem nruab ib qhov program zoo li ngrok txhawm rau nkag mus rau koj li Raspberry Pi sab nraum koj lub network.
  • Siv ib txoj hauv kev Kapacitor muab los muab kev ceeb toom.
  • Ntxiv ntau cov sensors, tau kawg.

Pom zoo: