Cov txheej txheem:

Txuas Mug: 5 Kauj Ruam (nrog Duab)
Txuas Mug: 5 Kauj Ruam (nrog Duab)

Video: Txuas Mug: 5 Kauj Ruam (nrog Duab)

Video: Txuas Mug: 5 Kauj Ruam (nrog Duab)
Video: Nco Ntsoov Kuv Mog - Qab Zib [ Nkauj Tawm Tshiab 7/6/2023 ] Official MV 2024, Kaum ib hlis
Anonim
Txuas Mug
Txuas Mug

Qee lub sij hawm thaum sawv ntxov thaum sipping kuv kas fes ua ntej mus rau tom chaw ua haujlwm, Kuv xav kom muaj qhov pom ntawm qhov nws xav kom kuv hauv kuv tus email inbox. piv txwv li tus lej thiab lub suab ntawm email tau txais…. nrog rau qhov haujlwm kuv tsuas yog ua tiav hnub ua ntej ua haujlwm lossis tsis yog thiab yog tias muaj cov lus pom zoo lossis tsis zoo hais txog nws. Ntawm qhov tod tes kuv tsis mob siab qhib daim ntawv thov email nrog kuv lub xov tooj thiab pib nyeem email thaum noj tshais.

Los ntawm cov kev xav no los txog lub tswv yim ntawm txoj haujlwm no; nws siv lub khob kas fes txhim kho nrog teeb ci LED uas hloov lawv cov xim raws li qhov tshwm sim ntawm kev txheeb xyuas kev xav tau ua tiav ntawm qhov tsis tau nyeem email tau txais hauv kuv tus email account. Tsuas yog ntsaws lub khob thiab LED teeb yuav tig mus rau xim ntsuab yog tias tau txais email zaum kawg muaj cov lus zoo, xim liab rau qhov tsis sib xws.

Kev tsom xam kev xav ntawm email tsis tau nyeem yog ua los ntawm IBM Watson IoT cov kev pabcuam. Ib pawg Arduino MKR1000 tau siv los tswj cov kab hluav taws xob LED thiab txuas nrog IBM Watson IoT cov kev pabcuam hla WiFi siv MQTT raws tu qauv.

Kauj Ruam 1: Cov Khoom Kho Vajtse

Kho vajtse Cheebtsam
Kho vajtse Cheebtsam
Kho vajtse Cheebtsam
Kho vajtse Cheebtsam

Pawg tsim kho vajtse:

Arduino MKX 1000

Kho vajtse BOM

  • 3 x 100 ohm resistors
  • 3x TIP122 NPN transistors
  • 1x zog jack
  • 1x RGB LED Teeb Sawb (AglaiaLT-S2)
  • Spare cables

Kev thaiv kom tswj cov hlua LED nrog Arduino MKR1000 yog ua raws cov lus qhia no:

Kauj Ruam 2: Tsim Tus Kheej ntawm IBM Watson IoT thiab Sau Koj Lub Npe

Txhawm rau tsim daim ntawv thov huab uas tuaj yeem ua qhov kev txheeb xyuas kev xav ntawm email tsis tau nyeem nrog IBM Watson IoT, nws yog qhov tsim nyog ua ntej yuav kos npe rau tus lej sim dawb (https://www.ibm.com/internet-of-things/trial/). Kauj ruam thib ob yog los tsim daim ntawv thov rau Watson IoT platform thiab sau npe koj Arduino MKR1000 pawg thawj coj; qhov no yog tam sim no tus txheej txheem txheej txheem los txuas Cov Khoos phis tawj platform nrog IBM Watson IoT, thiab nws tau sau tseg zoo hauv IBM cov txheej txheem pib sai:

console.ng.bluemix.net/docs/services/IoT/i…

IBM tseem muab cov ntawv pov thawj rau IoT uas ua kom nrawm dua cov kauj ruam no los ntawm kev txwv cov kev pabcuam thiab sijhawm xav tau los pib koj li IoT daim ntawv thov. IoT rau Cov Hluav Taws Xob Hluav Taws Xob Hluav Taws Xob Boilerplate yog qhov siv rau txoj haujlwm no.

Kauj ruam los ntawm kauj ruam cov cuab yeej sau npe qhia yog muab ntawm no:

console.ng.bluemix.net/docs/services/IoT/i…

Nco tseg koj li org-id, ntawv pov thawj, ntaus ntawv-id, thiab ntaus ntawv-hom, ib zaug ua tiav cov txheej txheem sau npe ntaus ntawv, txij li cov no yuav xav tau los teeb tsa Arduino kos duab thiab NodeRED daim ntawv thov.

Kauj Ruam 3: Tsim Node-RED Application rau Kev Ntsuam Xyuas Kev Xav

Tsim Node-RED Application rau Kev Ntsuam Xyuas Kev Xav
Tsim Node-RED Application rau Kev Ntsuam Xyuas Kev Xav

NodeRED yog lub cuab yeej pom kev uas tuaj yeem siv tau hauv IBM Watson IoT platform los tsim daim ntawv thov cov cuab yeej txuas thiab Cloud cov kev pabcuam (nodered.org).

Daim ntawv thov NodeRED tsim tau yooj yim heev thiab tsim los ntawm ob qhov ntws, ib qho rau kev txheeb xyuas kev xav ntawm email, thiab lwm qhov rau kev nkag mus rau qhov xwm txheej ntawm Arduino MKR1000 (kev xav tau txais los ntawm lub cuab yeej thiab RGB ua ke rau LED tau tshwm sim).

Thawj qhov kev sib txuas mus rau email tus lej ib ntus thiab nqa cov email tsis tau nyeem zaum kawg; teeb tsa nyob ntawm koj tus lej email. Txhua qhov email tau txais yog xa mus rau lub thawv tsom xam kev xav, uas rov qab tau qhab nia (tsawg dua lossis siab dua 0) raws li qhov tsis zoo/cov ntsiab lus zoo ntawm cov ntawv txheeb xyuas (saib cov ntaub ntawv https://github.com/thisandagain/sentiment/blob/mas… rau xav paub ntau ntxiv). Cov txiaj ntsig kev xav tau xa mus rau lub thawv ua haujlwm yooj yim uas suav qhov nruab nrab ntawm cov ntaub ntawv kawg tau txais thiab thawb qhov txiaj ntsig mus rau qhov tom ntej. Thaum kawg qhov thaiv kawg xa cov lus uas muaj tus nqi ntawm qhov kev xav tau mus rau lub cuab yeej txuas nrog siv MQTT raws tu qauv; qhov thaiv no yuav tsum tau teeb tsa nrog cov ntaub ntawv pov thawj tsim tawm thaum txheej txheem sau npe ntaus ntawv.

Qhov ntws thib ob yog siv rau kev ntsuas lub hom phiaj kom pom qhov xwm txheej ntawm Arduino board; nws txuas cov ntaub ntawv IoT rau koj Arduino pawg thawj coj mus rau IBM nrawm lub vev xaib rau cov ntaub ntawv pom (https://quickstart.internetofthings.ibmcloud.com/). Cov tswv yim IoT node tau teeb tsa raws li saum toj no kom tau txais cov xwm txheej los ntawm Arduino Board siv MQTT cov txheej txheem. Cov xwm txheej cov lus muaj cov qhab nia kev xav thiab RGB ua ke rau LED tam sim no siv hauv Arduino.

Node-RED daim ntawv thov raug xa tawm mus rau clipbord thiab txuas ntawm no ua.txt cov ntaub ntawv.

Kauj ruam 4: Arduino Sketch

Arduino kos duab yog ua raws MQTT cov tsev qiv ntawv los ntawm Gilberto Conti (https://github.com/256dpi/arduino-mqtt) uas tau hloov kho txuas nrog IBM Watson IoT. Txoj cai yog tsim los ntawm peb ntu:

  • teeb tsa (): txuas nrog WiFi AP thiab IBM MQTT broker; sau npe rov qab rau cov lus tau txais los ntawm IBM Watson IoT
  • voj (): teeb RGB tus pin los tswj LED teeb; xa mus rau IBM Watson IoT cov xwm txheej ntawm lub cuab yeej (RGB thiab cov qhab nia kev xav)
  • messageReceived (…): hu rov qab thaum tau txais cov lus nrog cov qhab nias siab los ntawm Watson IoT daim ntawv thov. Cov qhab nia tau teeb tsa rau RGB tus nqi (tsis zoo: liab; zoo: ntsuab).

Kho cov cai raws li hauv qab no, raws li daim ntawv pov thawj tsim thaum lub sijhawm txheej txheem sau npe ntaus ntawv (org-id, ntaus ntawv-hom, ntaus-id):

  • MQTT_MODE = IBM_API_KEY
  • char *client_id = "d: your-org-id: your-device-type: your-device-id";
  • char *user_id = "siv-token-auth";
  • char *pwd = "your-pwd";
  • char *ibm_hostname = "your-org-id.messaging.internetofthings.ibmcloud.com";

Daim ntawv thov sau npe mus rau lub ncauj lus iot-2/cmd/+/fmt/hlua thiab messageReceived callback parses lus rau hom kev xav

Cov xwm txheej tau tshaj tawm rau lub ncauj lus: iot-2/evt/xwm txheej/fmt/json

Nco tseg: nco ntsoov hloov daim ntawv pov thawj SSL rau MKR1000; ua raws cov lus qhia ntawm no: https://github.com/arduino-libraries/WiFi101-Firm… thiab ntxig koj ibm_hostname kom rub tawm thiab teeb tsa hauv MKR1000 lub hauv paus daim ntawv pov thawj.

Arduino kos duab txuas nrog.

Kauj Ruam 5: Txuas Koj Lub Mug

Txuas Koj Mug
Txuas Koj Mug
Txuas Koj Mug
Txuas Koj Mug

Nws yuav yog qhov zoo los ua qee qhov kev koom ua ke ntawm cov khoom siv hluav taws xob thiab LEDs hauv lub khob, tab sis rau qhov haujlwm no kuv tsuas yog txuas cov adesive LED sawb ib puag ncig lub khob iav raws li qhia hauv daim duab.

Tom qab ntawd kuv txuas cov kab hluav taws xob LED mus rau lub rooj sib tham ntawm lub khob cij, ua lub zog LED thiab Arduino MKR1000 thiab tos kom tau txais cov lus nrog kev xav tau qhab nia los ntawm NodeRED daim ntawv thov. Hauv daim duab piv txwv kuv tau sim los ntawm kev xa mus rau kuv tus as -qhauj email uas muaj cov ntawv zoo li "Ua haujlwm tau zoo!, Koj txoj haujlwm zoo heev!" lwm yam.

Nws tseem tuaj yeem tshawb xyuas hauv zej tsoom IBM Quickstart lub vev xaib (https://quickstart.internetofthings.ibmcloud.com) cov xwm txheej hauv lub sijhawm tiag tiag ntawm Arduino daim ntawv thov (RGB tus lej tau tshwm thiab qhov kev xav tau txais); tsuas yog xav tau nkag ntaus ntawv id.

Tam sim no kuv tuaj yeem txaus siab rau kuv lub kas fes hauv lub khob txuas.

Pom zoo: