Cov txheej txheem:

HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!): 3 Cov Kauj Ruam
HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!): 3 Cov Kauj Ruam

Video: HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!): 3 Cov Kauj Ruam

Video: HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!): 3 Cov Kauj Ruam
Video: Zeb Muas - Foom Kom txiv tej lus kub (Nkauj Tawm Tshiab 2021 - 2022) 2024, Kaum ib hlis
Anonim
HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!)
HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!)
HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!)
HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!)
HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!)
HRV Kub rau OpenHAB Via ESP8266 (Tus lej piv txwv!)

HRV - Wireless rau OpenHAB

Cov lus qhia no tshwj xeeb rau cov neeg uas muaj HRV (cua sov rov ua kom lub qhov cua nkag los) - txawm hais tias ib feem ntawm pawg thawj coj saib xyuas, qhib kev teeb tsa lossis Arduino code (xws li nyeem TTL cov ntawv xov xwm) tuaj yeem ua haujlwm rau koj tus kheej lossis ua haujlwm zoo rau kev kawm. Nws xav tias koj muaj kev paub tsim nyog ntawm Arduino IDE thiab ESP8266 nti yog dab tsi.

Taw qhia

Cov hauv qab no piav qhia yuav ua li cas tsim ESP8266 uas txuas nrog rau HRV system thiab xa lub ru tsev thiab tsev sov, tswj vaj huam sib luag kub thiab kiv cua nrawm ntawm MQTT cov lus rau OpenHAB. Qhov no tau tsim los ua haujlwm nrog ESP8266-01 pawg thawj coj (txawm hais tias yuav tsum ua haujlwm nrog ib qho ESP8266 3.3V version) Yog tias koj muaj qhov zoo sib xws HRV hom los ntawm lwm tus neeg muag khoom, koj yuav tsum txiav txim siab seb cov ntaub ntawv raug xa raws li TTL cov lej thiab yog li, dab tsi tus qauv cov ntaub ntawv raug xa raws li.

OpenHAB thiab Mosquitto

ESP8266 tus lej tau sau tshwj xeeb los ua haujlwm nrog OpenHAB (qhib qhov chaw siv tshuab hauv tsev automation) thiab MQTT tus broker xws li Mosquitto (xa ntawv sau npe/tshaj tawm hom kev cai uas yog qhov hnyav thiab zoo rau kev sib txuas lus ntawm cov khoom siv) Tsis txhob cia cov npe lossis cov ntawv luv ua rau koj ntshai, lawv yooj yim heev rau siv thaum koj paub tias lawv ua haujlwm li cas. Kuv siv OpenHAB ntawm NTC C. H. I. P (Asmeskas $ 9 khoos phis tawj) txawm li cas los xij coob leej neeg siv Raspberry Pi lossis zoo sib xws. Cov ntawv qhia no xav tias koj tau siv OpenHAB (yog tias koj xav tau kev pab teeb tsa OpenHAB, ua raws kab lus zoo no los ntawm kev siv lub vev xaib) Koj kuj yuav tsum rub tawm thiab teeb tsa Mosquitto (MQTT broker) thiab cuam tshuam nrog OpenHAB. Koj tuaj yeem teeb tsa qhov no ntawm lwm qhov ntawm koj lub network, txawm li cas los xij cov neeg feem ntau tsuas yog nruab qhov no ntawm tib lub tshuab li OpenHAB kom yooj yim.

Txhawm rau nruab Mosquitto, ua raws kab ntawv txuas no tom qab ntawd xaiv hom khoom siv uas koj siv thiab ua raws cov lus qhia. Vim tias C. H. I. P khiav Debian (Jessie), koj tuaj yeem ua raws li Raspberry Pi cov lus qhia yog tias koj siv C. H. I. P rau koj lub Tsev Automation ntaus ntawv (tseem ceeb, nws yog qhov zoo tshaj los teeb tsa CHIP rau khau raj los ntawm CLI. Muaj cov lus qhia rau ntawm no)

Thaum koj muaj OpenHAB thiab Mosquitto khiav, koj yuav tsum npaj Arduino IDE rau ESP8266 thiab tus lej. Ua ntej, koj yuav tsum ntxiv "PubSubClient" lub tsev qiv ntawv. Hauv Arduino IDE, los ntawm cov ntawv qhia zaub mov mus rau Sketch, suav nrog Lub Tsev Qiv Ntawv, Tswj Cov Tsev Qiv Ntawv Hauv lub thawv tshawb nrhiav, ntaus PubSubClient tom qab ntawd hais qhov kev tshawb fawb thiab nyem rau Nruab (thaum lub sijhawm sau ntawv, qhov hloov tshiab kawg yog 2.6.0) Koj yuav kuj yuav tsum ntxiv ESP8266 pawg thawj coj mus rau Arduino IDE uas tuaj yeem ua tiav los ntawm cov lus qhia hauv qab no

Qhov no muab dab tsi rau kuv?

Raws li tau hais ua ntej, txoj haujlwm no yuav tso cai rau koj saib koj li HRV tswj vaj huam sib luag, lub tsev, tswj vaj huam sib luag kub thiab kiv cua nrawm hauv OpenHAB GUI (lub sijhawm tiag!) yuav tau los ntawm kev nqes mus rau qhov sib txawv kub.

Txhawm rau kom tau txais cov kab ntawv, koj yuav tsum tau teeb tsa thiab teeb tsa RRD4J txoj hlua khi (qhov no ncaj nraim rau tom ntej) Qhov no yuav tso cai rau koj nyem rau ntawm 'Tsev' lossis 'Ru' thiab tau txais keeb kwm ntawm HRV kub rau txhua qhov dhau los teev, ib hnub lossis ib lub lim tiam (lossis ntev dua, yog tias koj hloov kho lub teeb tsa kom haum) Cov duab qhia hauv c Celsius, thiab qhia meej nws lub caij ntuj no nyob rau yav qab teb hemisphere thaum kuv ua qhov no!

Ib qho ntxiv, Kuv tau tsim OpenHAB pom uas qhia qhov sib piv ntawm Sab Nraud Kub (muab los ntawm Huab Cua khi ntxiv rau, hauv kuv qhov xwm txheej siv Wunderground) piv rau lub ru tsev thiab tsev sov los ntawm txhaj rau qhov 'Tswj' xaiv (daim duab qhia kab ntawv nrog lub tsev, lub ru tsev thiab sab nraum qhov kub tau npaj tseg). Kuv npaj siv cov ntaub ntawv no hauv cov cai kom qhib cov khoom siv cua sov raws li xav tau. Cias ntxiv Cov Khoom Huab Cua rau koj Cov Duab URL hauv cov ntaub ntawv sitemap thiab suav nrog qhov no ntawm tib daim duab (piv txwv li:… cov khoom = tsevTemp, ru tsev Temt, huab cuaTemp…)

Kauj Ruam 1: Qhov Yuav Tsum Tau / Ua Ke

Yam Yuav Tsum Tau / Ua Ke
Yam Yuav Tsum Tau / Ua Ke
Yam Yuav Tsum Tau / Ua Ke
Yam Yuav Tsum Tau / Ua Ke
Yam Yuav Tsum Tau / Ua Ke
Yam Yuav Tsum Tau / Ua Ke

Koj yuav xav tau cov hauv qab no

  • RJ11 splitter (qhov no cais cov teeb liab los ntawm tus tswj hwm hauv lub ru tsev, mus rau lub vaj huam sib luag tswj thiab ESP8266)
  • Qee cov hlua txuas thiab RJ11 ntsaws (kom khiav cov xov hlau los ntawm cov xov hluav taws xob mus rau ESP8266)
  • ESP8266-01 (lwm 3.3V version yuav tsum ua haujlwm)
  • TTL logic qib hloov pauv (hloov cov ntaub ntawv los ntawm 5V -> 3.3V)
  • AMS1117 3.3V tus tswj hluav taws xob (lossis zoo sib xws, hloov qhov hluav taws xob los ntawm HRV 5V -> 3.3V rau lub zog ESP8266)
  • 1N5817 schottky diode (vim li cas qhov no tau pab nres HRV tswj vaj huam sib luag rov pib dua ntawm ESP zog rau)
  • 10K ohm resistor (rub tawm ntawm 3.3 Voltage Regulator thiab ESP CH_PD)
  • 10V 10uF capacitor (lossis zoo sib xws, kom du tawm thiab stabelize inbound zog los ntawm HRV)
  • 10V 1uF capacitor (lossis zoo sib xws, kom du tawm thiab stabelize outbound zog rau ESP)
  • Yeem khawm swb rau program ESP (txwv tsis pub, xav tau rub GPIO0 rau GND manually rau program)
  • FTDI adapter (txhawm rau program ESP, hloov USB mus rau ntu)

Sib sau ua ke raws li Schematic

Daim duab daim duab qhia pom tias cov khoom yuav tsum tau sib sau ua ke li cas. Nco tseg tias muaj 6 tus pin uas nqes los ntawm kab xov kab los ntawm HRV lub chaw tswj hauv qab nthab:

Pins 1 thiab 6 yog 5V VCC

Pins 2 thiab 5 yog GND

Pins 3 thiab 4 yog Cov Ntaub Ntawv.

Koj tsuas yog yuav tsum tau siv tus pin 1, 2, 3 thiab 6 (1 thiab 6 VCC lub zog ESP8266 thiab sab siab ntawm TTL cov txheej txheem hloov pauv, 2 yog ib qho hauv av thiab 3 yog rau nyeem TTL cov ntawv xov xwm)

Cov splitter koj xav tau tsuas yog RJ11 splitter, tsuas yog xyuas kom nws yog qhov sib cais qhov twg cov pins ncaj ncaj (piv txwv li: tus pin 1 mus rau tus pin 1, tus pin 2 rau tus pin 2 thiab ntxiv rau) Nco ntsoov tias tus poj niam txuas ntxiv (raws li pom hauv cov duab) yog txhawm rau txuas FTDI rau kev rov tsim dua ESP tom qab, thiab qhov hloov pauv tso nws tso rau hauv "hom phiaj" hom. Cov no yog nyob ntawm yeem, tab sis pom zoo (piv txwv li: yog tias koj hloov koj tus password WiFi li WiFi AP thiab tus password yog qhov program nyuaj rau hauv txoj cai, uas koj yuav tsum tau xa ib zaug thaum koj tau tsim ESP8266)

Kauj Ruam 2: Tso Cai thiab Xeem

Uploading Code thiab Xeem
Uploading Code thiab Xeem
Uploading Code thiab Xeem
Uploading Code thiab Xeem
Uploading Code thiab Xeem
Uploading Code thiab Xeem
Uploading Code thiab Xeem
Uploading Code thiab Xeem

Cov Cai Hloov

Hloov lwm qhov txuas rau Arduino code NTAWM NO

Qhib hauv Arduino IDE, xyuas kom ESP board tau teeb tsa zoo li PubSubClient thiab koj tau xaiv ESP8266 pawg thawj coj (Cov Cuab Yeej, Pawg Thawj Coj, Pawg ESP8266 Pawg Neeg) Hloov kho cov cai thiab hloov WiFi AP npe thiab tus lej thiab IP chaw nyob ntawm koj tus broker MQTT (cov no tsuas yog yam uas koj yuav tsum tau hloov pauv) raws li qhia hauv qab no. Nyem rau 'Txheeb Xyuas' khawm kom ntseeg tau tias nws suav ua tau zoo tom qab ntawv xyuas qhov tseeb COM chaw nres nkoj raug xaiv (Cov Cuab Yeej, Chaw Nres Nkoj) thiab xa cov cai rau koj li ESP8266. Muaj ntau cov ntawv nyob ib puag ncig yuav ua li cas, Kuv yuav tsis rov txhim kho lub log ntawm no.

// Wi -nkaus

const char* ssid = "koj_wifi_ssid_here"; const char* password = "your_wifi_password_here"; // MQTT Broker IPAddress MQTT_SERVER (192, 168, 222, 254);

MQTT Xeem

Txog kev sim koj tuaj yeem tso koj li FTDI adapter txuas thiab qhib Serial Monitor hauv Arduino IDE, koj yuav tsum pom cov lus luam tawm cov ntaub ntawv ntsuas kub hauv lub console. Yog tias koj xav tau teeb meem daws cov lus MQTT los ntawm ESP8266 rau koj tus MQTT broker, tom qab ntawd ntawm Mosquitto server khiav ib qho ntawm cov lus txib hauv qab no txhawm rau sau npe rau cov lus xa tuaj:

mosquitto_sub -d -t openhab/hrv/xwm txheej

Koj yuav tsum pom cov ntawv PUBLISH inbound los ntawm ESP8266 txhua 30 feeb lossis ntau dua nrog tus lej "1" (lub ntsiab lus "kuv tseem muaj sia nyob") Yog tias koj pom "0's" tas li (lossis tsis muaj dab tsi hlo li) ces tsis muaj kev sib txuas lus. Thaum koj pom tus lej 1 los rau hauv, tom qab ntawd nws txhais tau tias ESP8266 tab tom sib txuas lus nrog MQTT tus broker (tshawb "MQTT Lub Siab Xav thiab Phau Testament" kom paub ntau ntxiv txog qhov no ua haujlwm li cas, lossis pom qhov no zoo blog nkag)

Tam sim no koj tuaj yeem taug qab qhov ntsuas kub thiab kiv cua cov ntaub ntawv nrawm, sau npe mus rau ib qho ntawm cov hauv qab no. Txawm li cas los xij, nco ntsoov tias txoj cai tsuas yog xa cov ntaub ntawv ntsuas kub yog tias cov ntaub ntawv tau hloov pauv. Nws taug qab qhov ntsuas kub kawg, kiv cua nrawm thiab lwm yam ntaub ntawv uas tau xa, yog li koj yuav tsis pom cov ntaub ntawv tuaj tam sim.

mosquitto_sub -d -t openhab/hrv/rooftemp

mosquitto_sub -d -t openhab/hrv/housetemp

mosquitto_sub -d -t openhab/hrv/controltemp

mosquitto_sub -d -t openhab/hrv/fanspeed

Hint: sau npe yuav cov tswj vaj huam sib luag kub saum toj no, tom qab ntawd nias lub pob kub ntawm lub vaj huam sib luag tswj nws tus kheej koj yuav tsum pom qhov ntsuas kub tshiab tuaj.

Thaum koj tau txais ib puag ncig los txhuam qhov no, 3cm x 7cm PCB haum zoo hauv lub thawv dej tom qab HRV Tswj Vaj Huam Sib Luag. Kuv yuav pom zoo tsuas yog ua qhov no yog tias nws yog lub thawv yas yaug raws li lub thawv hlau tuaj yeem cuam tshuam nrog Wifi cov cim lossis muaj peev xwm luv luv txuas ntawm PCB pawg thawj coj. Hloov pauv, koj tuaj yeem luam tawm cov ntaub ntawv yas 3D los teeb tsa lub rooj tsavxwm hauv.

Kauj Ruam 3: Hloov pauv OpenHAB

OpenHAB Configuration

OpenHAB hloov pauv xav tau yog raws li hauv qab no:

'cov khoom' file:

/* HRVNumber hrvStatus "HRV Status [MAP (status.map):%d]" (gHRV) {mqtt = "<[mqttbroker: openhab/hrv/status: state: default]"} Number houseTemp "Lub tsev [%.1f C] "(gHRV) {mqtt =" <[mqttbroker: openhab/hrv/housetemp: state: default] "} Number houseTemp_Chart_Period" Chart Period "Number roofTemp" Ru [%.1f C] "(gHRV) {mqtt =" <[mqttbroker: openhab/hrv/rooftemp: state: default] "} Number roofTemp_Chart_Period" Sijhawm Teev Npe "Tus lej tswjTemp" Tswj [%.1f C] "(gHRV) {mqtt =" <[mqttbroker: openhab/hrv/controltemp: state: default] "} String fanSpeed" Fan Speed [%s] "(gHRV) {mqtt =" <[mqttbroker: openhab/hrv/fanspeed: state: default] "}*/

'sitemap' cov ntaub ntawv:

Ncej daim ntawv lo = "HRV Kub" {Text item = roofTemp {Frame {Switch item = roofTemp_Chart_Period label = "Period" mappings = [0 = "Hour", 1 = "Day", 2 = "Week"] Image url = "https:// localhost: 8080/rrdchart-p.webp

Cov cim ntxiv rau OpenHAB suav nrog (nyem txoj cai thiab khaws cov duab)

Txuag cov ntaub ntawv no mus rau.. / OpenHAB Tsev / webapps / duab nplaub tshev ntawm koj li OpenHAB server

Pom zoo: