Cov txheej txheem:

Txuas Koj Cov Tsob Ntoo rau Huab: 10 Kauj Ruam
Txuas Koj Cov Tsob Ntoo rau Huab: 10 Kauj Ruam

Video: Txuas Koj Cov Tsob Ntoo rau Huab: 10 Kauj Ruam

Video: Txuas Koj Cov Tsob Ntoo rau Huab: 10 Kauj Ruam
Video: Tus Neeg Ruam - R-Lin Thoj | New Song [ Official MV ] Nkauj Tawm Tshiab 2023 Hmong Song 2023 2024, Hlis ntuj nqeg
Anonim
Txuas Koj Cov Tsob Ntoo rau Huab
Txuas Koj Cov Tsob Ntoo rau Huab
Txuas Koj Cov Tsob Ntoo rau Huab
Txuas Koj Cov Tsob Ntoo rau Huab
Txuas Koj Cov Tsob Ntoo rau Huab
Txuas Koj Cov Tsob Ntoo rau Huab

Hauv peb lub chaw haujlwm muaj cactus uas tsis tau txais kev saib xyuas nws tsim nyog. Txij li thaum kuv ua haujlwm ntawm lub tuam txhab IT thiab xav sim nrog LoRa, cov kev daws teeb meem uas tsis muaj server thiab AWS, Kuv tau hu peb cov cactus Steeve thiab txuas nws mus rau huab. Tam sim no koj tuaj yeem saib xyuas Steeve los ntawm txhua qhov chaw hauv ntiaj teb siv lub vev xaib Kuv tau ua rau nws: Steeve lub vev xaib interface.

Khoom siv

1 cactus / koj nyiam tsob ntoo

1 Arduino MKR WAN 1300 (Arduino khw)

1 868mHz/914mHz (nyob ntawm koj qhov chaw nyob) kav hlau txais xov (Amazon)

1 LoRa Gateway thaum tsis nyob ntawm ib ntawm (Amazon)

2 AA roj teeb

1 TMP102 sensor (Amazon)

1 av noo noo sensor (Amazon)

Cov kab hluav taws xob (Amazon)

cam khwb cia hlau

Lub roj teeb tuav (Amazon)

rooj plaub

xaiv tau: 3D tshuab luam ntawv (yog tias koj tuaj yeem siv lub tshuab luam ntawv 3d ces koj tsis xav tau lub roj teeb tuav lossis rooj plaub)

Kauj Ruam 1: Luam Ntawv Case (Yeem Xaiv)

Luam Ntawv Case (Yeem Xaiv)
Luam Ntawv Case (Yeem Xaiv)
Luam Ntawv Case (Yeem Xaiv)
Luam Ntawv Case (Yeem Xaiv)

Rub tawm cov ntawv zip no, unzip nws thiab luam cov ntawv. Cov ntaub ntawv raug cim nrog qhov xav tau ntawm cov khoom.

Xav tias dawb ntxiv qee yam rau lub hau zoo li kuv tau ua.

Kuv luam tawm cov no siv txheej txheej siab ntawm 0.2mm thiab 15% ntxiv.

Lub thawv ntawv tuaj yeem txuas nrog siv m3 cov ntsia hlau.

Thaum lub thawv luam tawm koj tuaj yeem siv qee qhov xaim los ua qhov xav tau sib txuas ntawm tus tuav lub roj teeb. Koj tuaj yeem siv daim duab muab los ua kev siv.

Kauj ruam 2: Kev thaiv kab

Thaiv
Thaiv
  • Ua ntej tso lub zog rau ntawm arduino kom ntseeg tau tias lub kav hlau txais xov txuas nrog, ua kom lub zog arduino tsis muaj lub kav hlau txais xov tuaj yeem ua rau puas tsuaj.
  • Txuas txhua yam raws li daim duab qhia kab.
  • Yog tias koj tab tom siv cov xov hlau no, xyuas kom tseeb tias koj tsis txuas tus pin rau ntawm cov ntsuas lossis cov arduino!

Kauj Ruam 3: Tsim App ntawm Yam Network

  • Mus rau https://www.thethingsnetwork.org/ thiab yog tias koj tseem tsis muaj tus lej account, ua ib qho.
  • Thaum koj muaj tus as khauj thiab nkag rau hauv koj tuaj yeem mus rau lub console (kaum sab xis saum toj, nyem koj lub npe siv thiab tom qab ntawd ntawm console).
  • Nyem rau daim ntawv thov.
  • Thaum nplooj ntawv thauj khoom koj yuav tsum tuaj yeem nyem rau "ntxiv daim ntawv thov".
  • Sau rau hauv daim ntawv thiab xaiv thaj tsam raug nyob hauv qab. Nyem rau ntawm "ntxiv daim ntawv thov".
  • Nrog koj zoo siab, koj nyuam qhuav tsim daim ntawv thov ntawm yam khoom network. = D

Kauj Ruam 4: Txuas Arduino rau Cov Khoom Network

Txhawm rau ua haujlwm rau arduino Kuv qhia koj kom siv lub tswv yim online arduino, qhov no ua rau thauj khoom hauv lub tsev qiv ntawv xav tau yooj yim heev.

  • Qhib koj daim ntawv thov ntawm yam khoom network.
  • Yuav tsum muaj daim teb uas muaj cov khoom siv, nyem rau ntawm lub npe ntaus ntawv.
  • koj yuav pom daim teb hu ua Device ID. Nov yog lub npe koj xav muab koj lub sensor. Yuav tsum muaj lwm qhov cim npe Ntaus EUI, qhov no yog qhov tseem ceeb tshwj xeeb uas koj arduino siv los txheeb xyuas nws tus kheej.
  • Txhawm rau kom tau tus yuam sij no peb yuav tsum nyem lub arduino nrog cov duab tshwj xeeb. Daim duab kos tuaj yeem pom nyob ntawm no. Cov duab kos no yuav tsum khiav thiab hla tus saib xyuas lub luag haujlwm yuav tsum xa eui. Luam cov eui los ntawm cov saib hauv xov tooj mus rau Ntaus EUI ntawm cov khoom siv network.
  • Nyem rau npe
  • Tam sim no peb tau sau npe peb cov arduino rau huab. Nws yog lub sijhawm los pib xa xov.
  • Koj yuav tsum tau xa rov mus rau nplooj ntawv hu ua ntaus ntawv saib ua ntej. Ntawm no koj tuaj yeem pom koj lub cuab yeej eui, app eui thiab tus yuam sij app.
  • Txhawm rau txuas ntxiv peb xav tau nyem qhov kos duab zaum kawg rau arduino. Daim duab kos tuaj yeem pom ntawm no.
  • Thaum koj qhib qhov txuas no koj yuav pom muaj ntau lub tab. Qhib cov lus zais. Muaj 2 tus yuam sij koj xav tau los ntawm cov khoom sib txuas mus rau cov ntaub ntawv zais cia.
  • Thaum cov yuam sij no tau sau rau hauv koj tuaj yeem nyem lub arduino. Nws yuav pib xa cov ntaub ntawv mus rau cov khoom network ib zaug txhua txhua teev.
  • Yog tias txhua yam mus tau zoo koj yuav tsum tuaj yeem pom cov lus sib tham hauv Cov Ntaub Ntawv tab ntawm cov khoom siv network thaum rov kho lub arduino (tsuas yog khawm ntawm lub rooj tsavxwm).

    • Yog tias tsis muaj cov ntaub ntawv tshwm sim nyob ib puag ncig, qhov no yuav txhais tau tias koj tsis nyob hauv thaj tsam ntawm LoRa qhov rooj raug. Koj tuaj yeem tshawb xyuas daim ntawv qhia chaw nrog txhua lub rooj nkag muaj nyob ntawm https://thethingsnetworkwork.org. Ib txoj hauv kev LoRa cov rooj vag yuav tsis ua haujlwm nrog cov lus pom zoo arduino.
    • Yog tias koj tsis nyob ntawm thaj chaw ntawm lub qhov rooj ces koj tuaj yeem sib koom koj tus kheej lub qhov rooj mus rau yam khoom network. Cov rooj vag no feem ntau muaj cov lus qhia zoo txog yuav ua li cas txuas lawv. Saib hauv cov npe khoom rau lub qhov rooj pom zoo.

Kauj Ruam 5: Txhais Cov Ntaub Ntawv ntawm Cov Khoom Network

  • Txhawm rau kom tau txais cov ntaub ntawv siv tau los ntawm cov lus ntawm cov khoom network peb xav tau los txiav txim siab bytestream.
  • Ntawm cov khoom network mus rau koj daim ntawv thov.
  • Yuav tsum muaj ib daim ntawv sau hais tias "Payload formats", nyem rau ntawm no tab.
  • Muaj 4 cov nyees khawm nyob ib sab ntawm ib leeg: "decoder", "converter", "validator", "encoder".
  • Nyem rau decoder.
  • Muab tshuaj txhuam cov cai hauv qab no.

muaj nuj nqi Decoder (bytes, chaw nres nkoj) {// Decode an uplink message from a buffer // (array) of bytes to a object of fields. var stringToDecode = bin2String (bytes); var res = stringToDecode.split (""); var temp = res [1]; var ntub = res [3]; var bat = res [5]; var decoded = {"kub": temp, "ya raws": ntub, "roj teeb": puav}; rov qab txiav txim siab; } muaj nuj nqi bin2String (array) {var tshwm sim = ""; rau (var i = 0; kuv <array.length; ++ i) {qhov tshwm sim+= (String.fromCharCode (array ))); } xa rov qab;}

  • Nyem tseg.
  • Thaum koj rov pib dua arduino thiab saib koj cov ntaub ntawv tab, koj yuav tsum pom cov khoom zoo json uas koj tuaj yeem nyeem tau yooj yim.

Kauj Ruam 6: Txuas Koj App rau AWS

Peb yuav siv AWS los khaws thiab siv cov ntaub ntawv los ntawm cov khoom siv network. Txhua qhov peev txheej uas peb yuav siv yog tau them nyob rau hauv qib dawb ntawm AWS.

  • AWS
  • Nkag mus lossis tsim tus account.
  • Txhawm rau txuas koj daim ntawv thov ntawm cov khoom network rau AWS Kuv pom zoo ua raws cov lus qhia no:
  • Thaum koj tau ua tiav qhov kev qhia no, taug kev hauv aws console rau IoT-Core ntu.
  • Hauv kab ntawv sab laug muaj daim ntawv lo "Tswj", nyem qhov no.
  • Tam sim no koj yuav tsum pom daim npav nrog lub npe ntawm koj lub sensor hauv nws.
  • Ib zaug ntxiv hauv kab ntawv sab laug nyem "Act"
  • Yog tias muaj daim npav sau npe Khw, koj zoo mus.
  • Yog tsis yog, nyem rau ntawm "Tsim".
  • Sau lub npe "Khw".
  • Koj tuaj yeem ntxiv cov lus piav qhia yog tias koj xav tau.
  • Raws li cov lus nug sau hauv kab lus hauv qab no: SELECT dev_id, metadata.time, payload_fields.temperature, payload_fields.moisture, payload_fields.battery LOS NTAWM 'cactus_network/devices/+/up'.
  • Hauv qab "Teeb ib lossis ntau qhov kev ua" nyem ntxiv ua.
  • Xaiv "Sib cais cov lus rau ntau kab ntawm DynamoDb rooj (DynamoDBv2)".
  • Nyem teeb tsa kev nqis tes ua
  • Nyem tsim cov peev txheej tshiab.
  • Nyem tsim lub rooj thiab muab koj lub npe lub npe.
  • Hauv qab qhov tseem ceeb sau hauv "dev_id".
  • Nyem ntxiv qhov tseem ceeb
  • Sau "sijhawm".
  • Nyem tsim.
  • Yog tias txhua yam mus tau zoo, koj yuav tsum rov qab los ntawm kev teeb tsa nplooj ntawv ua.
  • Muaj thaj tsam me ntsis greyed hauv qab "Xaiv lossis tsim lub luag haujlwm los pab AWS IoT nkag mus ua qhov haujlwm no."
  • Nyem tsim lub luag haujlwm thiab muab lub luag haujlwm no lub npe.
  • Nyem tsim lub luag haujlwm.
  • Nyem ntxiv ua.
  • Nyem tsim txoj cai.
  • Tam sim no koj yuav tsum muaj txoj cai uas khaws cia txhua cov lus nkag los ntawm cov khoom sib txuas hauv DynamoDb.
  • Koj tuaj yeem tshawb xyuas yog tias qhov no ua haujlwm los ntawm kev rov pib dua arduino thiab mus saib rau hauv DynamoDb rooj koj nyuam qhuav tsim.
  • Yuav tsum muaj cov ntaub ntawv kaw nrog cov lus.

Kauj Ruam 7: Tsim Lambda

Txhawm rau nyeem cov ntaub ntawv los ntawm DynamoDB peb tab tom yuav sau AWS lambda.

  • Hauv AWS kev tswj hwm kev tswj hwm hauv qab cov kev pabcuam muaj qhov txuas uas sau tias "Lambda", nyem qhov no.
  • Nyem tsim muaj nuj nqi.
  • Xaiv ib lub npe.
  • Teeb runtime rau nab hab sej 3.7.
  • Nyem tsim muaj nuj nqi.
  • Muab qhov chaws no tso rau hauv IDE ua ke.

ntshuam json

ntshuam boto3 ntshuam lub sijhawm los ntawm lub sijhawm ntshuam lub sijhawm siv sijhawm, timedelta los ntawm boto3.dynamodb.conditions ntshuam Ntsiab, Attr def lambda_handler (xwm txheej, ntsiab lus): rov retreive_data () def retreive_data (): # Tau txais cov kev pabcuam. dynamodb = boto3.resource ('dynamodb') table = dynamodb. Table ('TABLE NAME HERE') tam sim no = datetime.now () nag hmo = tam sim no -timedelta (teev = 24) fe = Key ('sijhawm'). nruab nrab ntawm (nag hmo.isoformat (), tam sim no.isoformat ()) pub = Key ('sijhawm'). lt (nag hmo.isoformat ()) teb = table.scan (FilterExpression = fe) recordsToDelete = table.scan (FilterExpression = pub) rau f hauv cov ntaub ntawvToDelete ['Cov khoom']: #print (f) table.delete_item (Qhov tseem ceeb = {'dev_id': f ['dev_id'], 'sijhawm': f ['sijhawm']}) cov ntaub ntawv = teb ['Cov khoom '] xa cov ntaub ntawv

  • Hloov lub npe lub npe rau qhov koj xaiv.
  • Txav mus rau lub luag haujlwm ua tiav.
  • Nyem tsim lub luag haujlwm tshiab los ntawm aws txoj cai qauv.
  • Xaiv ib lub npe.
  • Nyob hauv txoj cai tswj hwm tus qauv xaiv "Test sam xauv nees tso cai" thiab "Kev tso cai microservice yooj yim".
  • Nyem tseg.
  • Nyem xeem
  • Ib qho popup tuaj yeem tshwm sim, tsuas yog xaiv lub npe thiab txuag.
  • Nyem kuaj dua.
  • Nyob rau sab saum toj yuav tsum muaj daim chij ntsuab uas hais tias "Kev ua tiav: ua tiav".
  • Thaum koj nyem qhov chij no koj yuav tsum pom cov txiaj ntsig ntawm txoj haujlwm no, qhov no yuav tsum yog cov npe af sensordata.
  • Thov nco ntsoov tias tsab ntawv no tshem tawm txhua cov ntaub ntawv uas laus dua 24 teev.
  • Yog tias koj daim ntawv chij tsis ntsuab tab sis liab, koj tau plam qee yam thiab nyem qhov chij no yuav ua rau koj yuam kev tag nrho. Hauv qhov no google yog koj tus phooj ywg zoo tshaj.

Kauj Ruam 8: Tsim API Endpoint

  • Hauv AWS kev tswj hwm kev tswj hwm hauv qab cov kev pabcuam muaj qhov txuas uas hais tias "api-gateway", nyem qhov no.
  • Nyem tsim API.
  • Nco ntsoov "REST" thiab "API tshiab" ob qho tib si raug xaiv.
  • Xaiv lub npe rau koj tus api.
  • Nyem tsim API.
  • Yuav tsum muaj lub pob ntawv sau ua haujlwm ntawm lub vijtsam tam sim no, nyem rau nws.
  • Tom qab ntawd nyem tsim Cov peev txheej.
  • Raws li lub npe peev txheej koj yuav tsum tke qee yam yooj yim xws li "cog" lossis "cog-cov ntaub ntawv".
  • Nyem tsim Kev Pabcuam.
  • Ntawm sab laug tam sim no yuav tsum yog lub npe koj nyuam qhuav nkag mus. nyem lub npe no.
  • Tam sim no nyem qhov ua dua thiab tam sim no nyem ntxiv txoj hauv kev.
  • Xaiv GET.
  • Nyem qhov kos.
  • Yuav tsum muaj lub thawv ntawv sau ua Lambda Function.
  • Sau lub npe koj muab rau koj lambda ua haujlwm ntawm no.
  • Nyem tseg.
  • Tej zaum yuav muaj qhov tshwm sim ceeb toom rau koj tias nws tab tom tsim kev tso cai ntxiv.
  • Txais qhov popup no.
  • Tam sim no nyob rau hauv kev ua nyem pab kom cors.
  • Nyem "pab CORS thiab hloov CORS headers uas twb muaj lawm".
  • Nyem "yog, …".
  • Nyem ua dua thiab nyem Deploy API.
  • Hauv qab theem xa tawm xaiv [Theem Tshiab].
  • Xaiv ib lub npe.
  • Nyem deploy.
  • Tam sim no koj tau tshaj tawm koj li api online rau ntiaj teb.
  • Ntawm qhov screen uas koj tau tuaj txog tam sim no nyem qhov "GET" thiab cov peev txheej uas koj nyuam qhuav tsim.
  • Yuav tsum muaj qhov txuas saum toj sau tias "thov URL".
  • Luam qhov txuas no.
  • Muab tshuaj txhuam rau hauv qhov browser thiab ntaus nkag.
  • Koj yuav tsum pom cov ntaub ntawv uas nyob hauv lub database.

Kauj Ruam 9: Txuas Koj Cov Tsob Ntoo rau Social Plant Network

  • Mus rau
  • Nyem "ID nkag mus".
  • Nyem tsim tus account.
  • Sau rau hauv daim ntawv los tsim koj tus account.
  • Thov nco ntsoov tias lub npe siv kuj yuav tsum yog koj li email.
  • Nyem tsim tus account.
  • Koj yuav tsum tau txheeb xyuas koj li email ua ntej koj tuaj yeem txuas ntxiv.
  • Nco ntsoov tias koj tau nkag rau hauv.
  • Ga rov qab mus rau qhov home page (nyem lub logo nyob rau sab saum toj sab laug).
  • Nyem qhov chaw teeb tsa.
  • Ua daim ntawv, koj yuav tsum ua txhua daim teb.
  • Qhov txuas rau api yog qhov txuas uas koj tau txais kev cawmdim tom qab koj tsim API qhov kawg.
  • Thaum txhua yam tau sau rau hauv nyem qhov txuag tsob ntoo khawm. lub kaw lus yuav tam sim no txheeb xyuas qhov txuas api koj tau nkag mus thiab yog tias qhov no raug nws yuav txuag koj cov nroj tsuag hauv network.
  • Rov qab mus rau qhov homepage.
  • Tam sim no koj tuaj yeem nyem rau ntawm txhua tsob ntoo, koj yuav tsum muaj peev xwm pom tag nrho cov npe cog. koj cov nroj tsuag yuav tsum nyob rau ntawd. nyem rau ntawm daim npav thiab koj yuav raug coj mus rau nplooj ntawv saib xyuas ntawm koj cov nroj tsuag, nws tseem yuav tso tawm cov lus qhia raws li tus nqi uas koj tau teeb tsa.

Kauj ruam 10: Lean Back and Pat Yourself on the Back

Koj nyuam qhuav txuas ib tsob ntoo rau hauv internet. Zoo nkauj heev, puas yog?

Pom zoo: