Cov txheej txheem:

Universal MQTT Chaw Taws Teeb: 5 Kauj Ruam (nrog Duab)
Universal MQTT Chaw Taws Teeb: 5 Kauj Ruam (nrog Duab)

Video: Universal MQTT Chaw Taws Teeb: 5 Kauj Ruam (nrog Duab)

Video: Universal MQTT Chaw Taws Teeb: 5 Kauj Ruam (nrog Duab)
Video: New SDV Projects: Eclipse Zenoh: Unifying Car Communication from the MCU to the Cloud 2024, Hlis ntuj nqeg
Anonim
Universal MQTT Chaw Taws Teeb
Universal MQTT Chaw Taws Teeb

Nyob zoo sawv daws, Ua ntej tshaj plaws, Kuv yog neeg Fab Kis, yog li ua tau tias qee cov kab lus tsis nkag siab, Kuv thov txim, Kuv ua haujlwm hnyav los txhim kho.

Tam sim no kuv ua haujlwm ntawm kev siv tshuab hauv tsev hauv kuv lub tsev. Kuv siv OpenHab2 thiab mosquitto ua software. Kuv tsis yog tus kws tshaj lij hauv ob lub software no tab sis kuv paub tias lawv ua haujlwm li cas. OpenHab yog tus neeg siv sab, nrog cov duab nraaj tsim los tswj lub tsev. Mosquitto yog software tsim los ua tej yam tham ua ke. Piv txwv li, OpenHab tuaj yeem tham nrog kuv cov cuab yeej yooj yim.

Rau cov tib neeg uas tsis tshua paub MQTT raws tu qauv, ntawm no yog lub vev xaib uas piav qhia qhov yooj yim.

Kuv qhov teeb meem yog tias kuv xav tswj hwm kuv lub khoos phis tawj (4 ntse phab ntsa ntsaws) nrog cov hloov pauv tiag tiag, tsis yog nrog OpenHab lub vev xaib sib txuas. Kuv tsim, tsim kho thiab tsim cov chaw taws teeb uas tuaj yeem xa MQTT thov rau cov cuab yeej uas kuv xaiv. Qhov zoo tshaj plaws hauv kuv cov chaw taws teeb yog tias kuv muaj 4 lub nyees khawm, rau cov ntawv qhia zaub mov, thiab kuv tuaj yeem ntxiv tus lej ntawm cov cuab yeej uas kuv xav tau.

Nov yog qhov kuv tau ua.

Kauj Ruam 1: Qhov Chaw

Qhov
Qhov
Qhov
Qhov
Qhov
Qhov

Ib 8266. Kuv siv NodeMCU. Banggood

-Mini breadBoard. Kuv siv qhov ntawd vim tias kuv xav kom rov siv tau kuv cov khoom siv thaum kuv yuav ua V2 ntawm cov chaw taws teeb nrog lub pcb. Banggood

- LCD npo. Kuv siv 16x2 LCD tab sis 20x4 ua haujlwm ib yam nkaus. Tseem ceeb kom muaj i2c module ntawm koj lub LCD. Banggood

-Button Kuv siv 4 khawm, nce, nqis, nkag thiab tawm. Bangood

-Resistors. 4.7K resistor rau rub qhov hloov pauv

- M3 ntsia hlau.

- Kub kua nplaum.

-PIB. tsis tsim nyog tab sis kuv muab kuv cov nyees khawm thiab tus tiv thaiv rau nws.

Kauj Ruam 2: Daim Kab Xev

Daim duab thaiv
Daim duab thaiv

Ua raws li shematic rau cov nyees khawm.

Nyees khawm:

UP ---------- D5 lossis GPIO 1

Nqis ------- D6 lossis GPIO 12

Nkag mus ------- D7 lossis GPIO 13

Tawm --------- D4 lossis GPIO 2

LCD:

SDA -------- D2 lossis GPIO 4

SCL -------- D1 lossis GPIO 5

5V ---------- Vin

GND ------- NCO

Kauj Ruam 3: Arduino Code

Arduino Txoj Cai
Arduino Txoj Cai
Arduino Txoj Cai
Arduino Txoj Cai

Koj yuav tsum hloov qee cov ntaub ntawv hauv kab kos.

MQTT_SERVER tsuas yog IP chaw nyob ntawm qhov uas koj MQTT server ua haujlwm.

SSID thiab tus password ntawm koj lub Wifi.

Qhov kawg hloov pauv yog koj cov ncauj lus. Koj cov ntsiab lus yog dab tsi? Zoo, koj xaiv qhov koj xav tau. Kuv muaj plaub lub ncauj lus tab sis koj tuaj yeem ntxiv ntau ntxiv yog tias koj xav tau. Ib yam nkaus yuav tsum nco ntsoov yog tias koj yuav tsum hloov kho tus lej ntawm cov ncauj lus (int NombreTopic = 4;) hauv cov cai. Nws yuav tsum phim nrog tus lej ntawm cov ncauj lus koj sau.

Kauj Ruam 4: Kev tsim kho

Kev tsim kho
Kev tsim kho
Kev tsim kho
Kev tsim kho
Kev tsim kho
Kev tsim kho
Kev tsim kho
Kev tsim kho

Kuv tsim cov ntawv luam tawm 3D rau kuv cov chaw taws teeb. Kuv luam tawm nws ntawm 1.015 nplai, 20% ntxiv nrog dawb PLA thiab qhov txiaj ntsig tau zoo heev.

Yog tias koj tsis muaj lub tshuab luam ntawv 3D, koj tuaj yeem ua cov ntaub ntawv yooj yim nrog cov ntoo nyias lossis plexiglass.

Thaum cov ntaub ntawv tau ua tiav, Kuv pib los ntawm glued cov nyees khawm. Kuv thawb nyuaj rau sab nraub qaum kom paub tseeb tias peb tuaj yeem siv nws kom raug. Kuv glued lub vijtsam nrog kua nplaum kub. Ua ntej muab lub khob cij tso rau hauv lub thawv ntawv, Kuv tau kaw cov xaim kom paub tseeb tias lawv tsis txav mus.

Ua kom tiav nrog ob lub ntsia hlau thiab lub phaj tom qab.

nco tseg: Koj tuaj yeem sau nrog tus xaum ntawm lub npov zoo li: UP, DOWN, ENTER thiab EXIT.

Kauj ruam 5: Txaus siab rau

Hauv cov vis dis aus, koj tuaj yeem pom 4 lub qhov rais rau kuv plaub lub ncauj lus. Hauv cov qhov rais koj tuaj yeem pom MQTT cov lus uas cov chaw taws teeb xa mus rau lub ncauj lus.

Tam sim no koj cov chaw taws teeb tau ua tiav, koj yuav tsum tau kho koj lub cuab yeej ntse kom mloog koj lub ncauj lus thiab koj tuaj yeem siv koj lub chaw taws teeb los tswj koj lub tsev!

Yog tias koj muaj lus nug txog qhov chaw nyob deb no, Kuv yuav nyob ntawm no los teb koj.

Yog tias koj txaus siab rau txoj haujlwm me me no, zoo siab nyiam thiab pov npav rau kuv hauv Kev Sib Tw Hauv Qhov Chaw!

Ua tsaug

Pom zoo: