Nechekare mune chinyorwa chakapfuura tinopa iyo DHT11, imwe yetembiricha uye hunyoro sensors yauinayo iwe. Asi mune ino chinyorwa chitsva isu tichakuudza zvese zvaunoda kuti uzive nezve DHT22. Kazhinji, pekutarisa kwekutanga mutsauko chete pakati peiyo DHT11 neiyo DHT22 ndeyekuti iyo yekutanga inouya mune yebhuruu casing uye yekupedzisira iri chena. Muchokwadi, vese ihama dzemhuri imwechete yemasaenzi.
El DHT11 ndiye mukomandiko kuti, ine zvimwe zvikanganiso kana mabhenefiti ezvishoma zvichienzaniswa neiyo DHT22, uye nekudaro mutengo wakakwira. Iyo DHT11 inogona kushandiswa kune mapurojekiti iwe ausingade yakakwira kuyerwa chaiyo, nepo kana iwe uchida chimwe chinhu chakanyatsojeka iwe unofanirwa kusarudza iyo DHT22. Iwo makumi maviri neshanu haanyatsokwana kunyatsoitawo, asi ane zvinopfuura zvinogamuchirwa mashandiro emazhinji mapurojekiti e DIY.
Chii chinonzi DHT22?
El DHT22 tembiricha uye hunyoro sensor ine maficha ari padhuze nekukwirisa kwepamusoro. Unogona kuiwana zviri nyore muzvitoro zvine hunyanzvi kana zvitoro zvemadhipatimendi, kupi Hapana zvigadzirwa zvakawanikwa.. Izvo zvinokutendera kuti usafanirwe kutsamira pane yekushisa sensor uye humidity sensor zvakasiyana, asi kuve nezvose zvakabatanidzwa mune imwecheteyo kifaa.
Unogona kuiwana yakasununguka kana mune ma module akanyatsogadzirirwa Arduinokureva iyo DHT22 yakaiswa pane yakagadzirira-kushandisa-pcb board, pasina kuwedzera kudhonza-kumusoro zvinodzivisa, nezvimwe. Parizvino zvese zvinotaridzika senge DHT11. Uye iwe zvakare uchave nekuvimbika kwakanyanya uye kugadzikana mune zviyero nekuda kwechiyero chakatemwa chedigital chiratidzo chainoshandisa.
Pinout, maficha uye dhatasheet
Mumufananidzo uri pamusoro unogona kuona kuenzaniswa kweiyo DHT22 uye DHT11 pinout, uye sezvauri kuona ivo vakafanana maererano neparutivi. Naizvozvo, gungano rayo rinenge rakafanana chaizvo, uye chinhu chakanakisa, unogona kutsiva iyo DHT11 neDHT22 chero nguva, uye zvinopesana, muchirongwa chako pasina kuita shanduko dzakawandisa.
Rangarira kuti vane mapini matatu aunofanirwa kushandisa: GND, Vcc uye Data. Pini # 3 haina kushandiswa uye mumamojuru yakapfuura, ndiko kuti, iwe unongoona matatu matatu. Kana iwe uchida kuona rumwe ruzivo nezve icho chigadzirwa chawatenga, unogona kutsvaga madhatabheti eiyo chaiyo modhi uye mugadziri kuti uwane ruzivo rwakazara. Kunyangwe huwandu hwakawanda hunogona kutaridzika zvakafanana kwauri, panogona kuve nemusiyano mushoma kubva kune mumwe uchienda kune mumwe. Unyanzvi hwayo hwakakosha hunosanganisira:
- 3,3v kusvika ku6v magetsi
- 2,5mA yazvino kudyiwa
- Dhijitari yekubuda chiratidzo
- Kupisa kunotangira kubva -40ºC kusvika 125ºC
- Kururamisa kuyera tembiricha pa25ºC ye 0.5ºC mutsauko
- Iyo resolution yekuyera tembiricha i8-bit, 0,1ºC
- Humidity inogona kuyera kubva pa0% RH kusvika 100% RH
- Unyoro hwakaringana 2-5% RH yetembiricha iri pakati pe0-50ºC
- Iyo resolution ndeye 0,1% RH, haigone kutora misiyano pazasi peiyo
- Sampling chiyero chemasampuli maviri pasekondi: 2Hz
- Sparkfun Datasheet
Kana iwe waverenga bhuku redu reDHT11 iwe uchazviziva izvo inotumira mudigital yeData pini yayo, saka, imwe mukana kune ma sensors aya. Pachave pasina chikonzero chekugadzira kodhi muArduino IDE kuenda kubva kuanalogog kuenda kune anonzwisisika hunhu, asi siginari yedhijitari inogona kugadziriswa zvakananga kuti ipfuure kune madhigirii kana muzana yehumwe hunyoro.
Muchidimbu, ichi zvakare chikonzero nei chiri chokwadi, nekuti ne 40-bit furemu kutakura, iko iko iko iko iko kwakakwirira. Iyo inosanganisira mashoma parity bits kuona kukundikana kwechiratidzo. Iwe hauna icho chine chiratidzo cheanalogog, kunze kwekuti chiratidzo cheanalogog chakanyanya kutarisana nemagetsi ...
Kubatanidzwa naArduino
Sezvo neDHT11, kuisa iyo DHT22 neArduino zviri nyore. Rangarira kuti kana iwe ukaishandisa uri wega, isina kuisirwa pane module uye sensor iri kure (kana kana iwe ukashandisa voltage yakaderera kuisimbisa), uchafanirwa kushandisa yekudhonza-kumusoro iyo resistor iyo inoita zambuko pakati Vcc pini uye iyo data pini. Asi kana iwe ukashandisa module, unogona kuichengeta uye kuibatanidza zvakananga sezvazvinoonekwa mumufananidzo uri pamusoro… Zvakare, yeuka kuti mune module module pini reNC risingashandiswe rinenge risipo, saka zvichave nyore kwauri kwete kuti uvhiringidzike.
Iwe unongoda kubatanidza GND uye Vcc ku kubatana kwakakodzera kweako Arduino bhodhi, ndiko kuti, kune avo vakaratidzirwa seGND uye 5v mune ino kesi. Uye yeiyo pini yeData, unogona kuibatanidza kune chero yeinowanikwa yeArduino yedhijitari, kwatiri isu takazviita muna 7. Kana iwe ukashandisa imwe, yeuka kugadzirisa kodhi kuti ishande nenzira yako yekubatanidza izvo zvikamu ( zvinoita sezviri pachena asi iko kukanganisa kwakajairika kana uchiteedzera nekunamatira makodhi muArduino IDE).
Code muArduino IDE
Iye zvino zvauinazvo zvakabatana, ngatione muenzaniso wakapusa kodhi yeArduino IDE. . Rangarira kuti isu tine yekutanga mutungamiriri inotanga naArduino muPDF iwe yaunogona download mahara kubva pano uye zvinogona kukubatsira. Zvakare, kana iwe waverenga chinyorwa chedu paDHT11, rangarira izvozvo paive raibhurari yekushandisa iyo DHTxx sensorsNaizvozvo, iyo imwechete iyo yaishandiswa DHT11 inogona kushandiswa kune DHT22.
Paunenge uine yakaisa raibhurari uye zvese zvagadzirwa, ikozvino ndipo paunofanirwa kuisa kodhi kuronga iyo Arduino microcontroller kuti yako projekiti ishande. Muenzaniso wekutanga ungave:
#include "DHT.h" // Ejemplo sencillo de uso para el DHT22 const int DHTPin = 7; DHT dht(DHTPin, DHTTYPE); void setup() { Serial.begin(9600); Serial.println("Test DHT22"); dht.begin(); } void loop() { // Tiempo de espera entre tomas de mediciones de 2 segundos. delay(2000); // Lee temperatura y humedad durante unos 250ms float h = dht.readHumidity(); float t = dht.readTemperature(); if (isnan(h) || isnan(t)) { Serial.println("Fallo en la lectura"); return; } Serial.print("Humedad relativa: "); Serial.print(h); Serial.print(" %\t"); Serial.print("Temperatura: "); Serial.print(t); Serial.print(" *C "); }
ndinovimba kuti vatungamiriri vedu paDHTxx vakashanda seyako gwara, kunyangwe kazhinji mapurojekiti anowanzoitwa akaomesesa, asi aya macode kuti uone mashandiro anoita sensor anoratidza uye wozoshandura kodhi uye wedzera chero chaunoda ...
ruzivo rwakanaka rwakatumirwa. Ruzivo rumwe chete runogona kusanganisira zuva rekuburitsa. dzimwe nguva tinochida sereferenzi yemabasa akanyorwa nematanho. Ndatenda.