Cov txheej txheem:

Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22: 11 Cov Kauj Ruam
Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22: 11 Cov Kauj Ruam

Video: Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22: 11 Cov Kauj Ruam

Video: Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22: 11 Cov Kauj Ruam
Video: Обзор умного дома на базе Apple HomeKit от Aqara! 2024, Kaum ib hlis
Anonim
Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22
Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22
Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22
Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22
Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22
Tsim Apple HomeKit Kub Sensor (DHT22) Ntaus Siv RaspberryPI thiab DHT22

Kuv tab tom nrhiav tus nqi qis / qhov ntsuas cua sov uas kuv tuaj yeem siv los saib xyuas qhov tshwm sim hauv kuv qhov chaw nkag, raws li kuv pom tias lub caij nplooj ntoo hlav no nws ntub heev, thiab muaj qhov ntub ntau. Yog li kuv tau nrhiav qhov ntsuas tus nqi tsim nyog uas kuv tuaj yeem tso rau ntawd, thiab saib xyuas nyob deb. Tom qab ua qee qhov khawb ntawm qhov nqa rau yam uas muaj hauv zos thiab qhia ua haujlwm nrog RaspBerry PI thiab NodeMCU (ntau ntxiv txog qhov no tom qab). Kuv txiav txim siab ntawm DHT22 Sensor. Nws pheej yig, muaj ob qhov kub thiab txias thiab muaj nyob hauv zos.

Hloov Kho Plaub Hlis 2019 - Tom qab ntau xyoo siv lub tsev qiv ntawv pigpiod, Kuv tau hloov mus rau lub tsev qiv ntawv bcm2835 thiab tau tshaj tawm cov lus qhia tshiab ntawm no.

Hloov Kho Lub Kaum Ob Hlis 2016 - Tom qab siv cov no tau ob peb hlis, Kuv tau pom tias qhov tseeb ntawm qhov ntsuas qhov ntsuas qhov sib txawv ntau lub sijhawm thiab tau tso tseg kev ntseeg cov no rau cov ntaub ntawv muaj tseeb. Thiab kuv hloov tag nrho kuv cov cuab yeej mus rau Bosch BME280 Kub/Vaum/Barometric Siab sensor. Yog li kuv tau tsim cov lus qhia tshiab qhia yuav ua li cas txuas lub ntsuas cua no mus rau RaspberryPI (Txuas Koj Lub RaspberryPI mus rau BME280 Kub thiab NodeMCU/ESP8266 (Homebridge-MCUIOT).

Kauj Ruam 1: Daim Ntawv Teev Npe

Yog li kuv tau mus rau kuv lub khw qhov chaw hauv cheeb tsam, thiab yuav

1 - DHT22 / AM2303 Kub / Vaum Sensor

1 - 4.7K Resistor

4 Tus Pin Poj Niam header (Sensor sab)

5 Tus Pin Poj Niam header (RPI Sab)

Heatshrink tubing nqaim, thiab dav

Qub serial nas

Txhawm rau xaim lub ntsuas hluav taws xob rau PI, Kuv tau siv lub xov tooj los ntawm tus lej qub qub uas kuv tau dag ib ncig. Txhua txoj hlua siv tuaj yeem siv tau, tsuav yog nws muaj 3 xov hlau. Qhov kuv tau siv muaj ob peb txoj xov hlau, tab sis kuv siv Liab, Daj thiab Dub los ua kom yooj yim.

Kauj Ruam 2: Npaj RPI Qhov kawg ntawm Cable

Npaj RPI Qhov kawg ntawm Cable
Npaj RPI Qhov kawg ntawm Cable

Tom qab ntawd kuv tau siv cov pins rau kuv xaim. Cov pins kuv tau yog crimp, tab sis kuv tsis tuaj yeem coj lawv mus rau crimp kom raug, yog li kuv tau mus nrog cov khoom siv dua.

Tom qab siv cov koob, kuv mam li tso lawv rau hauv 5 Tus Poj Niam lub taub hau, nrog Liab hauv 1, Daj hauv 4, thiab Dub hauv 5.

RPI Kev Sib Txuas yog xaim zoo li no

RPI -> 5 Tus Pin Header -> Nqe lus piav qhia -> Hlau Xim

1 -> 1 -> 3.3 VDC Fais fab -> Liab

7 -> 4 -> GPIO4 -> Daj

9 -> 5 -> Hauv av -> Dub

Kauj Ruam 3: Sensor Kawg ntawm Cable

Sensor kawg ntawm Kab
Sensor kawg ntawm Kab
Sensor kawg ntawm Kab
Sensor kawg ntawm Kab
Sensor kawg ntawm Kab
Sensor kawg ntawm Kab
Sensor kawg ntawm Kab
Sensor kawg ntawm Kab

Qhov kawg no peb siv 4 Pin poj niam lub taub hau, tus tiv thaiv thiab cov cua sov ua kom sov tubing.

Muab cov xov hlau liab thiab daj txhuam rau tus pin, thiab muab tus tiv thaiv nruab nrab ntawm lawv ib yam. Kuj npog cov no nrog cov cua sov kom koj thiaj li tsis tau txais luv. Tom qab ntawd muab cov xaim dub txuas rau tus pin ib yam. Ntxig cov pins rau hauv 4 Pin header raws li hauv qab no

1 - Liab

2 - Daj

3 - Npliag

4 - Dub

Tom qab ntawd npog cov xov hlau nrog cov cua sov loj dua ntsws tubing.

Kauj Ruam 4: Txuas Cov Cables

Txuas Cov Cables
Txuas Cov Cables
Txuas Cov Cables
Txuas Cov Cables

Nrog koj RPI tawm, ua tib zoo txuas 5 tus pin poj niam mus rau GPIO kev txuas, nrog Liab hlau hauv tus pin 1 kab txuas nrog tus pin 1 ntawm GPIO txuas. Lub taub hau yuav tsum tsuas yog npog thawj 5 tus lej suav tus lej GPU pins.

Rau sab sensor, teeb tsa tus pin ntawm lub sensor nrog lub taub hau, thiab xyuas kom meej tias tus pin 1 ntawm lub sensor (ntawm sab laug), txuas nrog tus pin 1 ntawm lub header (nrog xaim liab).

Tom qab muab cov cua sov ntswj rau, kuv tsis tuaj yeem pom cov xaim xim ntxiv lawm, yog li kuv cim nws nrog cov ntse.

Kauj Ruam 5: Txhim Kho Homebridge Software

Raws li lawv muaj ntau lwm cov lus qhia rau teeb tsa raspberry pi, Kuv yuav tsis rov hais qhov no ntawm no, tab sis kuv xav tias koj muaj koj li RPI teeb tsa nrog Raspbian Jessie, nrog Node. JS teeb tsa thiab homebridge khiav. Lawv yog tus naj npawb ntawm homebridge tau pib cov lus qhia ib puag ncig npog qhov no lawm.

Kauj Ruam 6: Nruab Homebridge-dht

1. Nruab homebridge-dht nrog cov lus txib

sudo npm nruab -g homebridge -dht

2. Hloov kho koj cov ntaub ntawv config.json hauv ~/.homebridge nrog cov hauv qab no

"name": "Penny", "username": "CC: 22: 3D: E3: CD: 33", "port": 51826, "pin": "031-45-154"}, "piav qhia": " HomeBridge "," platforms ": ," accessories ": [{" accessory ":" Dht "," name ":" dht22 "," name_temperature ":" Temperature "," name_humidity ":" Humidity "," service ":" dht22 "}]}}

Kauj Ruam 7: Txhim Kho PIGPIO

1. Nruab lub tsev qiv ntawv pigpiod ntawm cov lus txib no

sudo apt-tau hloov tshiab

sudo apt-tau nruab pigpio sej-pigpio python3-pigpio

2. Luam dht22 rau/usr/local/bin/dht22, thiab ua kom tiav.

Nrog kev teeb tsa ntawm kuv RPI, nws nyob hauv/usr/lib/node_modules/homebridge-dht. Koj qhov kev teeb tsa yuav tso nws rau lwm qhov chaw. Thov nrog nrog

ls -l/usr/lib/node_modules/homebridge -dht/dh22

sudo cp/usr/lib/node_modules/homebridge-dht/dht22/usr/local/bin/dht22

sudo chmod a+x/usr/local/bin/dht22

3. Txij ntawm no koj yuav tsum tuaj yeem kuaj koj lub DHT22 sensor nrog cov lus txib

txh 22

Thiab nws yuav tsum teb nrog

0 18.4 C 51.0 % Cov

Kauj Ruam 8: Raspberry PI CPU Kev Ntsuas Kub - Yeem Tau

Nov yog cov kauj ruam xaiv tau, uas tso cai rau koj los saib xyuas qhov kub ntawm koj lub raspberry PI CPU ib yam nkaus.

1. Tsim cov ntawv hauv/usr/local/bin/cputemp uas muaj

#!/bin/bashcpuTemp0 = $ (miv/sys/class/thermal/thermal_zone0/temp) cpuTemp1 = $ (($ cpuTemp0/1000)) cpuTemp2 = $ (($ cpuTemp0/100)) cpuTempM = $ (($ cpuTemp2 % $ cpuTemp1)) ncha $ cpuTemp1 "C"

2. Ua cov ntaub ntawv executable

chmod a+x/usr/local/bin/cputemp

3. Hloov kho koj cov ntaub ntawv config.json hauv ~/.homebridge thiab hloov cov khoom siv ntxiv nrog cov hauv qab no:

"accessories": [Cov.

Kauj Ruam 9: Pib Homebridge

Pib homebridge, thiab koj daim ntawv teev npe yuav tsum zoo li qhov no

[6/21/2016, 9:37:31 PM] Loaded plugin: homebridge-dht [6/21/2016, 9:37:31 PM] Sau npe cov khoom siv ntxiv 'homebridge-dht. Dht'

[6/21/2016, 9:37:31 PM] ---

[6/21/2016, 9:37:31 PM] Loaded config.json nrog 2 cov khoom siv ntxiv thiab 0 lub platform.

[6/21/2016, 9:37:31 PM] ---

[6/21/2016, 9:37:32 PM] Thauj 0 platform…

[6/21/2016, 9:37:32 PM] Thauj 2 cov khoom siv ntxiv…

[6/21/2016, 9:37:32 PM] [cputemp] Pib Dht khoom siv…

[6/21/2016, 9:37:32 PM] [cputemp] INIT: cputemp

[6/21/2016, 9:37:32 PM] [Temp/Humidity Sensor] Pib Dht khoom siv…

[6/21/2016, 9:37:32 PM] [Temp/Humidity Sensor] INIT: Temp/Vaum Sensor

Luam theej duab cov cai no nrog koj HomeKit App ntawm koj lub cuab yeej iOS los ua ke nrog Homebridge:

┌────────────┐

│ 031-45-154 │

└────────────┘

[6/21/2016, 9:37:32 PM] Homebridge tab tom khiav ntawm chaw nres nkoj 51826.

Kauj Ruam 10: Xeem Nrog Cov Khoom Siv Hauv Tsev

Xeem Nrog Cov Khoom Siv Hauv Tsev
Xeem Nrog Cov Khoom Siv Hauv Tsev

Tua tawm koj tus neeg nyiam homekit, thiab ua ke nrog koj cov khoom siv tshiab. Tom qab ntawd koj yuav tsum pom qhov ntsuas Kub/Vaum Sensor tshiab.

Yog tias koj muaj teeb meem lossis teeb meem, thov tsa qhov teeb meem ntawm GitHub

Kauj Ruam 11: Tshooj Ntxiv - Dual Sensors

Tshooj Lawm - Dual Sensors
Tshooj Lawm - Dual Sensors

Tom qab tau nug los ntawm ntau tus neeg Kuv xav tias kuv yuav suav nrog cov ntawv sau xav tau ntxiv lub cim thib ob.

Txog qhov thaiv, ua tibzoo saib ntawm daim duab txuas, qhov no yog qhov uas kuv tau qhia nrog Hector305 txhawm rau txuas lub ntsuas thib ob.

Thiab rau cov ntaub ntawv kho tshiab, qhov no yog config.json rau qhov ntawd.

Pom zoo: