Cov txheej txheem:

Kev cuam tshuam DHT11 Siv Arduino los ntawm Sujay: 5 Kauj Ruam
Kev cuam tshuam DHT11 Siv Arduino los ntawm Sujay: 5 Kauj Ruam

Video: Kev cuam tshuam DHT11 Siv Arduino los ntawm Sujay: 5 Kauj Ruam

Video: Kev cuam tshuam DHT11 Siv Arduino los ntawm Sujay: 5 Kauj Ruam
Video: how to repair a dead computer 2018 2024, Hlis ntuj nqeg
Anonim
Kev cuam tshuam DHT11 Siv Arduino los ntawm Sujay
Kev cuam tshuam DHT11 Siv Arduino los ntawm Sujay

Hauv Cov Lus Qhia no koj yuav kawm paub teeb tsa DHT11 Vaum thiab Qhov ntsuas kub ntawm koj li Arduino UNO. Thiab kawm paub tias Humidity sensor ua haujlwm li cas, thiab yuav txheeb xyuas qhov nyeem tawm los ntawm Serial monitor li cas

Nqe lus piav qhia:

DHT11 kuaj pom cov pa dej los ntawm kev ntsuas qhov hluav taws xob tsis kam ntawm ob qho hluav taws xob. Qhov ntsuas qhov ntsuas cua noo yog cov dej noo tuav nrog cov electrodes siv rau saum npoo. Thaum cov dej ua pa tau nqus los ntawm cov substrate, ions raug tso tawm los ntawm cov substrate uas ua rau kom muaj kev sib txuas ntawm cov hluav taws xob. Kev hloov pauv hauv kev tiv thaiv ntawm ob lub tshuab hluav taws xob yog sib piv rau cov txheeb ze cov av noo. Cov av noo ntau dua ua rau cov tshuaj tiv thaiv qis dua, thaum cov txheeb ze qis dua ua rau muaj kev tiv thaiv nruab nrab ntawm cov hluav taws xob.

Kauj Ruam 1: Cov Cheeb Tsam Yuav Tsum Tau

Cov Cheeb Tsam Yuav Tsum Tau
Cov Cheeb Tsam Yuav Tsum Tau

Nov yog cov npe ntawm cov khoom siv xav tau kom pib nrog Cov Lus Qhia,

Kho vajtse Cheebtsam:

  • Arduino UNO Yuav Los Ntawm Flipkart
  • DHT11 Vaum thiab Kub Sensor Yuav Los Ntawm Flipkart
  • Breadboard (Tsis teb los tau)
  • Jumper Hlau
  • USB Programmable Cable

Software Cheeb Tsam

Arduino IDE Cov

Kauj ruam 2: Txuas lub Circuit Court

Kev tiv thaiv kab mob
Kev tiv thaiv kab mob

Txuas DHT11 rau Arduino UNO yog qhov yooj yim heev.

Kev sib txuas xov hluav taws xob tau ua raws li hauv qab no:

VCC tus pin ntawm DHT11 nkag mus rau +3v ntawm Arduino.

DATA tus pin ntawm DHT11 nkag mus rau Analog Pin A0 ntawm UNO.

GND Pin ntawm DHT11 nkag mus rau Pin Pin (GND) ntawm UNO.

Kauj ruam 3: Programming Arduino

Rub tawm Zip file ntawm no

Luam tawm DHT Lub Tsev Qiv Ntawv thiab cov cai.

#include "dht.h" #define dht_apin D1 // Analog Pin sensor txuas nrog dht DHT;

Cov kab Saum toj no yog qhov pib rau dht lub tsev qiv ntawv Txhais cov ntaub ntawv tus pin ntawm dht thiab tsim kev xav li DHT

teeb tsa tsis muaj dab tsi () {Serial.begin (9600); ncua (500); // Ncua sijhawm kom cia lub kaw lus khau raj Serial.println ("DHT11 Vaum & ntsuas kub / n / n"); ncua (1000); // Tos ua ntej nkag mus rau Sensor}

Cov kab ntawv saum toj no yog teeb tsa tus lej Pib kev sib txuas lus ntawm 9600 baud tus nqi sau lub npe ntawm txoj haujlwm nrog ncua ntawm 1 sec

lub voj void () {DHT.read11 (dht_apin); Serial.print ("Cov av noo tam sim no ="); Serial.print (DHT.humidity); Serial.print ("%"); Serial.print ("kub ="); Serial.print (DHT.temperature); Serial.println ("C"); ncua (5000); // Tos 5 vib nas this ua ntej nkag mus rau lub sensor dua. }

Nws nyeem cov ntaub ntawv los ntawm DHT11 ntau zaus txhua 5 Sec

Kauj Ruam 4: Tso Tawm

Qhib Serial Monitor

teeb tus nqi baud rau 9600 Saib qhov tshwm sim ntawm Serial Monitor….

Ua ntej tshaj plaws, Kuv xav ua tsaug rau koj tau nyeem phau ntawv qhia no! Kuv vam tias nws yuav pab koj. Yog tias koj muaj lus nug Kuv ib txwm zoo siab los pab koj….. Tso Tawm Lus. Koj cov lus tawm tswv yim muaj nuj nqis rau kuv.

Kauj ruam 5: Yuam kev

Tsis qhia tawm:

Txheeb xyuas koj qhov kev sib txuas thiab lub zog ntawm cov khoom siv hluav taws xob

Txheeb tus nqi baud. Nws yuav tsum yog 9600

Tsis qhia qhov raug qhov tseeb

Ua siab zoo xyuas qhov ua yuam kev thaum rub tawm. Sim xa cov cai ntxiv.

lossis sim cov cai nrog lwm DHT.

Yog tias koj muaj lwm yam teeb meem thov qhia rau kuv paub. Kuv yuav twv yuav raug hu ua qhov zoo tshaj los daws nws.

Pom zoo: