Cov txheej txheem:

Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk: 3 Kauj Ruam
Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk: 3 Kauj Ruam

Video: Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk: 3 Kauj Ruam

Video: Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk: 3 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk
Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk
Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk
Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk
Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk
Saib Xyuas Kub thiab Vaum Nrog AM2301 ntawm NodeMCU & Blynk

Nws yog qhov paub zoo heev tias feem ntau ntawm kev lag luam ntsug, qhov kub, av noo, siab, huab cua zoo, dej zoo, thiab lwm yam, ua si yam tseem ceeb yuav tsum tau saib xyuas tas li thiab tsim nyog ceeb toom tshuab yuav tsum tau nyob hauv qhov chaw thaum qhov txiaj ntsig mus deb ntawm qhov pib teeb tsa.

Cov qauv no yuav pab peb nkag siab cov txheej txheem los tshuaj xyuas qhov ntsuas kub thiab av noo siv "AM2301 Capacitive Digital Temperature & Humidity Sensor".

Tsim cov qauv no yog qhov yooj yim heev thiab yooj yim. Kuv vam tias cov lus qhia hauv "Kev Qhia Paub" no yuav pab cov nyeem nyeem kom pom meej ntawm nws qhov kev coj ua.

Khoom siv

  1. AM2301 Capacitive Digital Kub & Vaum Sensor
  2. D1 Mini V2 NodeMcu 4M Bytes Lua WIFI Internet Ntawm Yam Kev Txhim Kho Pawg Thawj Coj Raws ESP8266
  3. 170 pts Mini Breadboard SYB-170 Dawb
  4. Txiv neej Rau Poj Niam Jumper Hluav Taws Xob 40 Pcs 10cm

Kauj Ruam 1: Daim Duab Duab & Kev Sib Txuas

Daim duab kos duab & Kev Sib Txuas
Daim duab kos duab & Kev Sib Txuas
Daim duab kos duab & Kev Sib Txuas
Daim duab kos duab & Kev Sib Txuas
Daim Duab Duab & Kev Sib Txuas
Daim Duab Duab & Kev Sib Txuas

Cov kev sib txuas yog yooj yim heev thiab muaj raws li hauv qab no:

  1. 3V ntawm AM2301 txog 3V ntawm WeMos D1 Mini
  2. GND ntawm AM2301 txog GND ntawm WeMos D1 Mini
  3. Teeb liab Hlau (Daj) ntawm AM2301 txog D4 (GPIO 2) ntawm WeMos D1 Mini

Nco tseg: Txhawm rau tsim cov qauv no, peb yuav tsis xav tau daim ntawv qhia zaub mov vim peb tsuas muaj peb lub xov hlau los txuas. Kuv tso qhov kev xaiv rau tus nyeem ntawv ntawm daim ntawv no, seb puas yuav siv lub khob cij (lossis) tsuas yog txuas WeMos D1 mini nrog AM2301 ncaj qha nrog Jumper xov hlau.

Kauj Ruam 2: Kho Blynk los Saib Xyuas Kub thiab Vaum

Kev teeb tsa Blynk los Saib Xyuas Kub thiab Vaum
Kev teeb tsa Blynk los Saib Xyuas Kub thiab Vaum
Kev teeb tsa Blynk los Saib Xyuas Kub thiab Vaum
Kev teeb tsa Blynk los Saib Xyuas Kub thiab Vaum
Kev teeb tsa Blynk los Saib Xyuas Kub thiab Vaum
Kev teeb tsa Blynk los Saib Xyuas Kub thiab Vaum

Cov ntawv tshuaj ntsuam ib-qib-qib tau muab rau kev nkag siab zoo ntawm cov txheej txheem los teeb tsa Blynk. Cov neeg nyeem tau thov kom hla cov ntawv tshuaj ntsuam thiab muaj daim ntawv thov teeb tsa nrog ob ntu "Gauge", ib qho los sawv cev rau Cov Vaum thiab lwm qhov Kub.

Kauj ruam 3:

Duab
Duab
Duab
Duab
Duab
Duab

Pib ntawm Code >>>>>

#define BLYNK_PRINT Serial

#suav nrog SPI.h

#suav nrog ESP8266WiFi.h

#suav nrog BlynkSimpleEsp8266.h

#suav nrog DHT.h

char auth = "hQqK5jvA0h5JqubLnnpxV94eEltFbw1Y"; // Sau tus lej Auth uas tau xa los ntawm Blink

char ssid = "Smaragd25"; // Sau koj lub npe WIFI

char pass = "Smaragdine@2017"; // Sau koj li WIFI Password

#define DHTPIN 2 // Tus lej lej 4

// #define DHTTYPE DHT11 // DHT 11

// #define DHTTYPE DHT22 // DHT 22, AM2302, AM2321

#define DHTTYPE DHT21 // DHT 21, AM2301

DHT dht (DHTPIN, DHTTYPE);

BlynkTimer timer;

void sendSensor ()

{

ntab h = dht.readHumidity ();

ntab t = dht.readTemperature (); // lossis dht.readTemperature (muaj tseeb) rau Fahrenheit

yog (isnan (h) || isnan (t)) {

Serial.println ("Ua tsis tau zoo nyeem los ntawm DHT sensor!");

rov qab; }

Blynk.virtualWrite (V5, h); // V5 yog rau Vaum

Blynk.virtualWrite (V6, t); // V6 yog rau Kub

}

void teeb tsa ()

{

Serial.begin (9600); // Saib cov xwm txheej txuas hauv Serial Monitor

Blynk.begin (auth, ssid, dhau);

dht.begin ();

timer.setInterval (1000L, sendSensor);

}

void lub voj ()

{

Blynk.run ();

timer.run ();

}

Qhov kawg ntawm Txoj Cai >>>>>

Hauv cov cai saum toj no, tshwj xeeb tshaj yog nyob rau hauv #suav nrog nqe lus, thov suav nrog txhua cov ntaub ntawv header (uas xaus nrog.h txuas ntxiv) hauv "", lwm qhov chaws yuav cuam tshuam tsis raug.

Nco tseg: Yog tias koj tau xaiv Qhov Tsis Txaus Siab Kub thiab Vaum Cov Lus Qhia hauv cov cai, qhov txiaj ntsig koj tau txais yog qhov tsis raug (piv txwv piv txwv txuas nrog), txawm tias lub ntsuas cua ua haujlwm. Thov tawm tswv yim/tsis pom zoo cov kab hauv qab no kom tau raws li koj xav tau. Tsuas yog ib ntawm kab hauv qab no tsis txaus siab, so yuav tsum tau tawm tswv yim.

  1. #define DHTTYPE DHT11 // DHT 11
  2. #define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
  3. #define DHTTYPE DHT21 // DHT 21, AM2301

Hauv kuv qhov xwm txheej, kuv tsis suav nrog kab kawg, piv txwv li: "#define DHTTYPE DHT21 // DHT 21, AM2301", thiab tau tawm tswv yim txog cov kab so.

Kom pom zoo dua, Kuv tau ntim ob qho tib si WeMos D1 Mini thiab AM2301 sensor hauv Styrofoam. Kuv tab tom npaj kom muaj cov ntaub ntawv acrylic txhawm rau ua kom zoo ua tiav cov cuab yeej ua tiav thiab ua rau nws saib zoo dua.

Yog tias muaj lus nug, thov sau rov qab rau [email protected] (lossis) ping kuv ntawm WhatsApp ntawm +91 9398472594. Kuv yuav zoo siab heev tau txais cov lus pom thiab txhim kho kuv cov ntawv.

Pom zoo: