Cov txheej txheem:

IoT Kev Saib Xyuas Cog Ntoo (Nrog IBM IoT Platform): 11 Kauj Ruam (nrog Duab)
IoT Kev Saib Xyuas Cog Ntoo (Nrog IBM IoT Platform): 11 Kauj Ruam (nrog Duab)

Video: IoT Kev Saib Xyuas Cog Ntoo (Nrog IBM IoT Platform): 11 Kauj Ruam (nrog Duab)

Video: IoT Kev Saib Xyuas Cog Ntoo (Nrog IBM IoT Platform): 11 Kauj Ruam (nrog Duab)
Video: Технический разговор TUDev с профессором Борой Озкан - Финтех и будущее финансов 2024, Kaum ib hlis
Anonim
IoT Plant Monitoring System (Nrog IBM IoT Platform)
IoT Plant Monitoring System (Nrog IBM IoT Platform)

Txheej txheem cej luam

Cov Txheej Txheem Saib Xyuas Kev Tsob Ntoo (PMS) yog daim ntawv thov tsim nrog cov tib neeg uas nyob hauv chav kawm ua haujlwm nrog tus ntiv tes xoo ntsuab hauv siab.

Niaj hnub no, cov tib neeg ua haujlwm ntau dua li yav tas los; txhim kho lawv txoj haujlwm thiab tswj hwm lawv cov nyiaj txiag. Cov sijhawm ua haujlwm tau ntev dua, ua rau cov neeg no muaj sijhawm tsawg dua los ua tej yam uas lawv nyiam.

Qhov no tsim teeb meem rau cov tib neeg uas muaj tus ntiv tes xoo ntsuab, ua haujlwm ntev ntxiv thiab tsis muaj tus pab cuam nyob hauv tsev zoo li lawv cov nroj tsuag.

Yog li, PMS tau tsim los pab cov tib neeg no hauv kev muab kev saib xyuas zoo dua, tab sis tseem ua kom ntseeg tau tias muaj kev loj hlob zoo rau lawv cov nroj tsuag tom tsev thaum lawv ua haujlwm.

Cov ntsiab lus ntawm cov kauj ruam

Nram qab no yog cov ntsiab lus ntawm cov kauj ruam uas yuav ua tiav

  1. Txuas ntawm kho vajtse
  2. Teeb tsa IBM Bluemix IoT Platform
  3. Sau npe rau twilio
  4. Teeb raspberry pi (Cuab Yeej Saib Xyuas Cuab Yeej) ntawm liab
  5. Teeb bluemix ntawm redSetup Webserver

Kauj ruam 1: Txuas Kho Vajtse

Txuas Kho Vajtse
Txuas Kho Vajtse
Txuas Kho Vajtse
Txuas Kho Vajtse

Yuav tsum tau kho vajtse

  • 2 Raspberry Pis
  • 1 Cov qhob cij
  • 1 GPIO Ribbon Cable
  • 1 GPIO Extension Board (T-Cobbler Kit)
  • 1 MCP3008 ADC (Analog Digital Converter)
  • 1 DHT_11 Sensor
  • 2 10k Ohm Resistors
  • 1 Lub Teeb Ntsuas Tus Kws Tiv Thaiv
  • 1 Cov av noo Sensor (YL-69)
  • 1 Dej Qib Sensor
  • 26 Cables (16 Txiv neej rau Txiv neej, 10 Txiv neej rau Poj Niam)

Txuas cov ntu

Xa mus rau daim duab thib ob ntawm cov kauj ruam no rau daim duab fritzing thiab txuas cov ntu kom haum

Kauj Ruam 2: Tsim IoT Platform Resources

Tsim IoT Platform Resources
Tsim IoT Platform Resources
  1. Nkag mus rau hauv koj tus lej Bluemix thiab txuas mus rau ntu IoT BoilerPlates Starter Page nplooj ntawv tshiab
  2. Nkag mus rau koj lub npe app thiab lub npe tos Tos rau Bluemix teeb tsa koj lub app thiab cov xwm txheej qhia tias "Koj lub app tab tom khiav" Yog tias nws tseem tsis tau khiav tom qab 10 feeb, koj yuav tsum rov pib dua koj lub app los ntawm txhaj khawm rov pib dua nyob rau saum toj txoj cai ces kaum
  3. Los ntawm ib sab bar, nyem rau ntawm "Kev Sib Txuas" Nyem rau ntawm iotf cov kev pabcuam txuas los ntawm cov npe sib txuas Koj yuav raug xa mus rau IOT cov kev pabcuam teeb tsa Nyem rau ntawm "Launch" khawm kom raug xa rov mus rau iotf console
  4. Nco ntsoov ntawm qhov txuas uas koj tau xa rov mus rau piv txwv: https://suwdek.internetofthings.ibmcloud.com/dashboard/ 6 tus ntawv sau ua ntej ntawm ".internetofthings.ibmcloud.com/dashboard/" yog koj lub koom haum ID. Nco ntsoov nws.

Kauj Ruam 3: Tsim Hom Ntaus Ntawv thiab Ntaus Ntawv

Tsim Hom Ntaus thiab Ntaus Ntawv
Tsim Hom Ntaus thiab Ntaus Ntawv
Tsim Hom Ntaus thiab Ntaus Ntawv
Tsim Hom Ntaus thiab Ntaus Ntawv
  1. Koj yuav tsum yog koj li IOT Platform console.
  2. Los ntawm sab laug sab laug, nyem rau ntawm lub cuab yeej icon
  3. Nyem rau ntawm "Ntaus Ntaus" los ntawm sab saum toj
  4. Nyem rau ntawm "Add Device Type" los ntawm lub kaum sab xis saum toj
  5. Sau cov ntaub ntawv hauv qab no:

    1. Hom: Ntaus
    2. Lub npe: raspberrypi
    3. Nqe lus piav qhia: Raspberry Pi
  6. Nyem rau Next, tom qab ntawd nyem rau Done
  7. Nyem rau "Xauj" los ntawm sab saum toj
  8. Nyem rau ntawm "Ntxiv Device"
  9. Sau cov ntaub ntawv hauv qab no:

    1. Xaiv hom ntaus ntawv uas twb muaj lawm: raspberrypi
    2. Tus nab npawb ID: pms1
  10. Nyem txuas ntxiv mus kom txog thaum cov ntsiab lus
  11. Nyem rau ua
  12. Koj yuav raug xa mus rau nplooj ntawv Cov Ntawv Pov Thawj Ntaus Ntawv. Thov nco ntsoov koj cov ntsiab lus ntaus ntawv. Qhov no tseem ceeb heev vim tias daim ntawv pov thawj kev lees paub tsis tuaj yeem rov qab tau

Kauj Ruam 4: Tsim Cov Ntawv Pov Thawj Ua Haujlwm rau Cloudant

  1. Rov qab mus rau koj lub bluemix console (https://console.bluemix.net/dashboard/apps)
  2. Nyem rau ntawm cloudantNoSQLDB cov kev pabcuam hauv qab Kev Pabcuam Huab Cua
  3. Ntawm sab, nyem rau Daim Ntawv Pov Thawj Ua Haujlwm
  4. Nyem rau ntawm Daim Ntawv Credential Tshiab
  5. Nyem Ntxiv
  6. Nyem Saib Cov Ntawv Pov Thawj hauv kab ntawv Kev ua ntawm koj li kev tsim tshiab kev pabcuam pov thawj
  7. Nco tseg cov ntawv pov thawj no. Koj yuav xav tau lawv tom qab rau kev hloov kho ntawm app.py code

Kauj Ruam 5: Sau npe rau Twilio

  1. Sau npe rau tus account twilio tshiab ntawm
  2. Thaum sau npe, koj yuav raug ceeb toom rau npe ib qhov haujlwm. Hauv kuv qhov xwm txheej, kuv lub npe hu ua Plant Monitoring system.
  3. Los ntawm lub sidebar, nyem rau ntawm txhua yam khoom thiab kev pabcuam thiab nyem rau ntawm SMS programmable.
  4. Nyem rau ntawm "Pib Pib" Raws li koj tsis muaj tus lej twilio, nyem rau "Tau txais tus lej"
  5. Ib qho pop nrog tus lej yuav qhia. Nyem rau "siv tus lej no"
  6. Nco tseg tus lej twilio no, koj yuav xav tau tom qab.
  7. Mus rau lub console dashboard
  8. Nco tseg ntawm koj tus lej SID thiab Tus Thawj Coj Token

Kauj Ruam 6: Txhim Kho Cov Pob Yuav Tsum Tau Ua ntawm Cov Khoom Saib Xyuas Cog

  1. Nruab Node redsudo npm nruab -g --unsafe-perm node-red
  2. Nruab pahosudo pip nruab paho-mqtt
  3. Nruab Watson IoT node rau node redsudo npm i -g node-red-contrib-ibm-watson-iot
  4. Nruab BCM2835

    1. wget
    2. tar zxvf bcm2835-1.52.tar.gz
    3. cd bcm2835-1.48
    4. ./configure
    5. ua
    6. sudo ua daim tshev
    7. sudo ua kom nruab Nruab
  5. Node DHT-Sensorsudo npm nruab node-dht-sensor
  6. Nruab Node Pab Txhawb DHT Sensorsudo npm nruab-tsis muaj kev nyab xeeb-perm -g node-red-contrib-dht-sensor
  7. Pib dua koj lub pisudo reboot tam sim no

Kauj Ruam 7: Teeb Node Red Application for Plant Monitoring Device

Teeb Node Red Daim Ntawv Thov rau Kev Saib Xyuas Cov Khoom
Teeb Node Red Daim Ntawv Thov rau Kev Saib Xyuas Cov Khoom
Teeb Node Red Daim Ntawv Thov rau Kev Saib Xyuas Cov Khoom
Teeb Node Red Daim Ntawv Thov rau Kev Saib Xyuas Cov Khoom

Pib koj qhov liab los ntawm qhib Terminal thiab ntaus ntawv

pib-liab pib

Txais tos rau Node-RED ===================

20 Lub Ob Hlis 07:07:34 - [info] Node -RED version: v0.16.2

20 Lub Ob Hlis 07:07:34 - [info] Node.js version: v7.8.0 20 Feb 07:07:34 - [info] Linux 4.4.50 -v7+ arm LE 20 Feb 07:07:36 - [info] Loading palette nodes {MODE: {MODE_0: 0, MODE_1: 1, MODE_2: 2, MODE_3: 3}, CS: {tsis muaj: 64, siab: 4, qis: 0}, ORDER: {msb: tsis tseeb, lsb: muaj tseeb), Spi: [Muaj nuj nqi: Spi]} 20 Lub Ob Hlis 07:07:42 - [cov ntaub ntawv] Cov chaw teeb tsa: /home/pi/.node-red/settings.js 20 Lub Ob Hlis 07:07:42 - [cov ntaub ntawv] Cov neeg siv npe: /home/pi/.node-red 20 Lub Ob Hlis 07:07:42 - [cov ntaub ntawv] Cov ntaub ntawv ntws: /home/pi/.node-red/start 20 Lub Ob Hlis 07:07:42 - [info] Tam sim no neeg rau zaub mov khiav ntawm https://127.0.0.1: 1880/20 Feb 07:07:42 - [info] Pib ntws 20 Feb 07:07:43 - [info] Pib ntws

Qhib koj tus browser thiab txuas rau daim ntawv thov liab

Nyem rau ntawm lub cim hamburger, yuj dua "ntshuam" thiab nyem rau ntawm "ntawv los teev cia" tom qab ntawv muab cov kab ntawv muab hauv qab no tso rau hauv

[{"id": "d9ac3f49.78dc1", "type": "tab", "label": "Flow 1"}, {"id": "9b23dde8.8ae15", "type": "pimcp3008", " z ":" d9ac3f49.78dc1 "," npe ":" MCP3008 "," tus pin ": 0," dnum ": 0," x ": 636.996208190918," y ": 148.48046493530273," xov hlau ":

Nco ntsoov hloov "cov ntaub ntawv" thiab "RecordValues" IoT watson nodes xws li nws tuaj yeem txuas rau koj daim ntawv thov.

Kauj Ruam 8: Teeb Node Red Application for Server

Teeb Node Red Application rau Server
Teeb Node Red Application rau Server
Teeb Node Red Application rau Server
Teeb Node Red Application rau Server
  1. Nkag mus rau hauv koj tus account bluemix thiab mus rau ntawm lub dashboard (https://console.bluemix.net/dashboard/apps)
  2. Nyem rau kab ntawv txuas rau koj daim ntawv thov uas tau pom nyob hauv "Txoj Kev" Kab ntawm cov npe ntawm koj li Cloud Foundry Apps
  3. Koj yuav raug xa rov mus rau lwm nplooj ntawv, nyem rau "mus rau koj lub node liab editor"

Zoo ib yam li cov kauj ruam yav dhau los, nyem rau ntawm lub cim hamburger, yuj dua "ntshuam" thiab nyem rau ntawm "ntawv los teev cia" tom qab ntawv muab cov cai tso rau hauv qab no

[{"id": "5ef69739.4622e8", "type": "tab", "label": "Flow 4", "disabled": tsis tseeb, "info": ""}, {"id": "ff6a8be6.47bb08 "," type ":" ibmiot in "," z ":" 5ef69739.4622e8 "," authentication ":" boundService "," apiKey ":" "," inputType ":" evt "," logicalInterfaceId ": "", "ruleId": "", "deviceId": "", "applicationId": "", "deviceType": "", "eventType": "+", "commandType": "", "format": "json", "npe": "Kuv RaspberryPi Gateway", "kev pabcuam": "sau npe", "allDevices": muaj tseeb, "txhua daim ntawv thov": "", "allDeviceTypes": muaj tseeb, "tag nrho cov xwm txheej": muaj tseeb, "tag nrho cov lus": "", "allFormats": "", "qos": 0, "x": 150, "y": 60, "xov hlau":

Nco ntsoov hloov twilio node kom koj twilio ntawv pov thawj thiab twilio tus lej tau teeb tsa hauv lub node

Kauj Ruam 9: Teeb Pi Web Server

Teeb Pi Web Server
Teeb Pi Web Server

Hauv koj ob RASPBERRY PI…

Nruab cov pob khoom xav tau

Qhib lub davhlau ya nyob twg thiab ntaus cov lus txib hauv qab no:

sudo pip nruab gpiozero

sudo pip nruab flask

sudo pip nruab gevent

sudo pip nruab cloudant

Cov Qauv Ntaub Ntawv

Xa mus rau daim duab ntawm theem no rau cov qauv ntaub ntawv

Rub tawm thiab ntxiv cov ntsiab lus zoo li qub

Txhawm rau kom ntseeg tau tias peb daim ntawv thov web zoo li thiab ua haujlwm raws li tau piav qhia, peb yuav tsum rub tawm thiab ntxiv qee cov ntsiab lus zoo li qub ntxiv rau nws kom ua haujlwm.

  • Bootstrap v3.3.7
  • FontAwesome v5.0.1
  • jQuery v3.1.0https://blog.jquery.com/2016/07/07/jquery-3-1-0-released-no-more-silent-errors/
  • Morrisjs v0.5.0https://github.com/morrisjs/morris.js/archive/0.5.0.zip
  • Raphael v2.2.0

Bootstrap

  1. Qhib rub tawm zip file (bootstrap-3.3.7-dist.zip)
  2. Qhib bootstrap-3.3.7-dist nplaub tshev
  3. Tshem tawm txhua cov ntsiab lus rau Daim Ntawv Thov/zoo li qub/bootstrap

FontAwesome

  1. Qhib rub tawm zip file (fontawesome-free-5.0.1.zip)
  2. Qhib fontawesome-free-5.0.2 nplaub tshev
  3. Qhib lub vev xaib-fonts-nrog-css
  4. Tshem tawm txhua cov ntsiab lus rau Daim Ntawv Thov/zoo li qub/font-txaus

jQuery

  1. Rub tawm jquery-3.1.0.js thiab jquery-3.1.0.min.js
  2. Muab ob daim ntawv javascript tso rau hauv Daim Ntawv Thov/zoo li qub/jquery

Morrisjs

  1. Qhib cov ntawv rub tawm zip (morris.js-0.5.0.zip)
  2. Qhib daim ntawv morris.js-0.5.0
  3. Tshem tawm txhua cov ntsiab lus rau Daim Ntawv Thov/zoo li qub/morrisjs

Raphael

  1. Qhib cov ntawv rub tawm zip (raphael-2.2.0.zip)
  2. Qhib raphael-2.2.0 nplaub tshev
  3. Tshem tawm txhua cov ntsiab lus rau Daim Ntawv Thov/zoo li qub/raphael

Kauj ruam 10: Ntxiv Code rau Cov Ntaub Ntawv hauv Web Server

Rub tawm cov ntawv hauv qab no thiab ntxiv lawv rau lawv cov npe sib xws hauv pi web server

Nco ntsoov hloov cov ntaub ntawv pov thawj kev pabcuam hauv app.py fileto rau koj li kev lees paub kev pabcuam huab

NCO TSEG: Vim muaj teeb meem nrog kev xa cov ntaub ntawv index.html, Kuv tau muab nws tso ua ntaub ntawv.txt. Thov hloov nws mus rau index.html tom qab rub tawm nws

Kauj ruam 11: Pib Nws

Pib Nws!
Pib Nws!
Pib Nws!
Pib Nws!

Hauv koj lub web server pi, khiav cov lus txib hauv qab no:

Daim ntawv thov cd

sudo nab hab sej app.py

Pom zoo: