Cov txheej txheem:

Docker Pi Series ntawm Sensor Hub Board Hais txog IOT: 13 Cov Kauj Ruam
Docker Pi Series ntawm Sensor Hub Board Hais txog IOT: 13 Cov Kauj Ruam

Video: Docker Pi Series ntawm Sensor Hub Board Hais txog IOT: 13 Cov Kauj Ruam

Video: Docker Pi Series ntawm Sensor Hub Board Hais txog IOT: 13 Cov Kauj Ruam
Video: Why Girls are Touching Samay Raina ? 😂 2024, Kaum ib hlis
Anonim
Docker Pi Series ntawm Sensor Hub Board Hais txog IOT
Docker Pi Series ntawm Sensor Hub Board Hais txog IOT
Docker Pi Series ntawm Sensor Hub Board Hais txog IOT
Docker Pi Series ntawm Sensor Hub Board Hais txog IOT

Nyob zoo, txhua tus hais mav. Tam sim no, yuav luag txhua yam cuam tshuam nrog IOT. No tsis ntseeg nrog qhov ntawd, peb pawg DockerPi series tseem txhawb nqa IOT. Today, kuv xav qhia DockerPi series ntawm SensorHub yuav thov li cas rau IOT rau koj.

Kuv khiav cov khoom no uas yog ua raws Azure IOT HUB. Azure IOT HUB tuaj yeem siv los tsim IOT cov kev daws teeb meem nrog kev ntseeg tau thiab ruaj ntseg kev sib txuas lus ntawm ntau lab ntawm IOT cov cuab yeej thiab huab daws daws teeb meem backend.

Piv txwv li, koj tuaj yeem paub qhov kub ntawm koj chav thiab seb puas muaj leej twg tuaj txog koj lub tsev hauv internet los ntawm kev siv peb SensorHub.

Khoom siv

  • 1 x Sensor Hub Board
  • 1 x RaspberryPi 3B/3B+/4B
  • 1 x 8GB/16GB TF Card
  • 1 x 5V/2.5A fais fab mov lossis 5v/3A fais fab mov rau RPi 4B

Kauj Ruam 1: Yuav Ua Li Cas Txhim Kho DockerPi Series ntawm SensorHub Nrog RaspberryPi

Yuav Ua Li Cas Txhim Kho DockerPi Series ntawm SensorHub Nrog RaspberryPi
Yuav Ua Li Cas Txhim Kho DockerPi Series ntawm SensorHub Nrog RaspberryPi

Cia peb xub saib yuav ua li cas rau nruab DockerPi series ntawm SensorHub nrog Raspberry Pi

Koj tsuas yog yuav tsum ntxig lawv 40 tus pin rau hauv.

Ceev faj. Please tua lub hwj chim thaum koj txhim kho lawv

Kauj Ruam 2: Qhib RaspberryPi's I2C (1)

Qhib RaspberryPi's I2C (1)
Qhib RaspberryPi's I2C (1)

Ua cov lus txib ntawm daim duab: sudo raspi-config

Kauj Ruam 3: Qhib RaspberryPi's I2C (2)

Qhib RaspberryPi's I2C (2)
Qhib RaspberryPi's I2C (2)

Kauj Ruam 4: Qhib RaspberryPi's I2C (3)

Qhib RaspberryPi's I2C (3)
Qhib RaspberryPi's I2C (3)

Kauj Ruam 5: Software Ib puag ncig (1)

Software ib puag ncig (1)
Software ib puag ncig (1)

Ua ntej koj yuav tsum txheeb xyuas koj li sej 3 version.

Kauj Ruam 6: Software Ib puag ncig (2)

Software ib puag ncig (2)
Software ib puag ncig (2)

Tom qab ntawd koj yuav tsum teeb tsa Azure cov khoom cuam tshuam nrog. Ua ntej, koj yuav tsum siv cov lus txib uas suav nrog "python3":

Kauj Ruam 7: Software Ib puag ncig (3)

Software ib puag ncig (3)
Software ib puag ncig (3)

Tom ntej no koj yuav tsum txheeb xyuas seb koj puas tau teeb tsa lub cuab yeej ntawm git, yog tias koj tau teeb tsa git, thov ua raws cov lus txib hauv qab no:

Kauj Ruam 8: Cov Cai (1)

Cov lej (1)
Cov lej (1)
  1. Mus rau cov npe hauv qab no: azure-iot-sdk-python/tree/master/azure-iot-device/kuaj/advanced-hub-scenarios
  2. Qhib cov ntawv hauv qab no: update_twin_reported_properties.py
  3. Koj yuav pom cov ntaub ntawv cov cai hauv qab no ntawm daim duab:
  4. hloov mus rau cov lej hauv qab no ntawm daim duab: HostName… uas koj tuaj yeem tau txais los ntawm Azure webiste.

  5. Qhib cov ntawv: get_twin.py thiab ua tib yam:

Kauj Ruam 9: Cov Cai (2)

Cov lej (2)
Cov lej (2)

Koj kuj xav tau ntshuam qee cov tsev qiv ntawv sej 3 hauv cov ntaub ntawv hloov tshiab_twin_reported_properties.py:

Kauj Ruam 10: Cov Cai (3)

Cov lej (3)
Cov lej (3)

Tom qab ntawd koom nrog cov lej hauv qab no ntawm daim duab, koj tseem tuaj yeem luam thiab muab tso rau hauv koj cov ntaub ntawv:

npav = smbus. SMBus (1) tos device_client.connect () aReceiveBuf = aReceiveBuf.append (0x00) # 符 符 rau kuv hauv ntau (0x01, 0x0D + 1): aReceiveBuf.append (bus.read_byte_data (0X17, i)) yog aReceiveBuf [0X01] & 0x01: state0 = "Tawm-nti ntsuas kub ntsuas ntau dhau!" elif aReceiveBuf [0X01] & 0x02: state0 = "Tsis muaj qhov ntsuas kub sab nraud!" lwm: state0 = "Tam sim no tawm-nti ntsuas kub = % d Celsius" % aReceiveBuf [0x01]

lub teeb = (bus.read_byte_data (0x17, 0x03) << 8) | (bus.read_byte_data (0x17, 0x02)) temp = bus.read_byte_data (0x17, 0x05) humidity = bus.read_byte_data (0x17, 0x06) temp1 = bus.read_byte_data (0x17, 0x08) siab = (bus.read_byte_data (0x17, 0x0, 0x08)) << 16) | ((bus.read_byte_data (0x17, 0x0A) << 8)) | ((bus.read_byte_data (0x17, 0x09))) xeev = bus.read_byte_data (0x17, 0x0C) yog (xeev == 0): xeev = "lub sensor ntawm BMP280 yog ok" lwm: xeev = "lub sensor ntawm BMP280 yog phem"

tib neeg = bus.read_byte_data (0x17, 0x0D)

yog (tib neeg == 1): tib neeg = "lub cev muaj sia tau raug kuaj pom" lwm tus: tib neeg = "tsis muaj lub cev nyob"

Kauj Ruam 11: Cov Cai (4)

Cov lej (4)
Cov lej (4)

Tom qab ntawv khiav cov ntaub ntawv update_twin_reported_properties.py thiab koj yuav pom qhov tshwm sim:

Kauj Ruam 12: Cov Cai (5)

Cov lej (5)
Cov lej (5)

Tom qab ntawd qhib cov ntawv: get_twin.py thiab nkag mus rau cov lej hauv qab no, koj tseem tuaj yeem luam cov lej thiab muab tso rau hauv koj cov ntaub ntawv:

print ("{}". format (ntxaib ["qhia"] ["state0"])) print ("Tshaj qhia lub teeb yog: {}". format (ntxaib ["qhia"] ["lub teeb"]), "Lux ") luam tawm (" Qhov ntsuas kub ntawm pawg thawj coj yog: {} ". hom ntawv (ntxaib [" tshaj tawm "] [" kub "])," degC ") luam tawm (" Tshaj tawm cov av noo yog: {} ". hom ntawv (ntxaib [" tshaj tawm "] [" av noo "]),"%") luam tawm (" Tshaj tawm qhov ntsuas kub ntawm qhov ntsuas yog: {} ". hom ntawv (ntxaib [" tshaj tawm "] [" kub 1 "])," degC ") luam tawm (" Tshaj Qhia " siab ntawm huab cua yog: {} ". hom ntawv (ntxaib [" qhia "] [" siab "])," Pa ") luam tawm (" Tshaj tawm {} ". format (ntxaib [" qhia "] [" xeev "])) print ("Tshaj qhia seb puas pom lub cev nyob yog: {}". hom ntawv (ntxaib ["qhia"] ["tib neeg"]))

Kauj Ruam 13: Cov Cai (6)

Cov lej (6)
Cov lej (6)

Tom qab ntawv khiav cov ntaub ntawv get_twin.py thiab koj yuav pom qhov tshwm sim uas tau hloov kho los ntawm cov ntaub ntawv hloov tshiab_twin_reported_properties.py:

Pom zoo: