Cov txheej txheem:

Interface DHT11 Siv Arduino: 4 Kauj Ruam
Interface DHT11 Siv Arduino: 4 Kauj Ruam

Video: Interface DHT11 Siv Arduino: 4 Kauj Ruam

Video: Interface DHT11 Siv Arduino: 4 Kauj Ruam
Video: Basic IoT Ecosystem Security 2024, Kaum ib hlis
Anonim
Interface DHT11 Siv Arduino
Interface DHT11 Siv Arduino

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
Cov Cheeb Tsam Yuav Tsum Tau
Cov Cheeb Tsam Yuav Tsum Tau
Cov Cheeb Tsam Yuav Tsum Tau
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:

  1. Arduino UNO Yuav Los Ntawm Flipkart
  2. DHT11 Vaum thiab Kub Sensor Yuav Los Ntawm Flipkart
  3. Breadboard (Tsis teb los tau)
  4. Jumper Hlau
  5. USB Cable

Cheeb Tsam Software:

Arduino IDE Cov

Kauj ruam 2: Txuas lub Circuit Court

Kev tiv thaiv kab mob
Kev tiv thaiv kab mob
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

Programming Arduino
Programming Arduino

Rub tawm Zip file

Luam tawm DHT Lub Tsev Qiv Ntawv thiab cov cai.

Txoj Cai:

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

Cov kab saum toj no yog qhov pib rau dht tsev qiv ntawv

Txhais cov ntaub ntawv tus pin ntawm dht

thiab tsim kev txhawb siab raws li DHT

void teeb tsa () {

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 saum toj no yog cov teeb tsa

Pib kev sib txuas lus hauv xov tooj cua ntawm 9600 baud tus nqi

luam 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: Qhov tshwm sim

Qhov tshwm sim
Qhov tshwm sim

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.

Pom zoo: