Cov txheej txheem:

ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 - Saib Xyuas Qhov Kub Kub & Qhov Kub Kub ntawm M5stick-C Nrog DHT11: 6 Cov Kauj Ruam
ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 - Saib Xyuas Qhov Kub Kub & Qhov Kub Kub ntawm M5stick-C Nrog DHT11: 6 Cov Kauj Ruam

Video: ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 - Saib Xyuas Qhov Kub Kub & Qhov Kub Kub ntawm M5stick-C Nrog DHT11: 6 Cov Kauj Ruam

Video: ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 - Saib Xyuas Qhov Kub Kub & Qhov Kub Kub ntawm M5stick-C Nrog DHT11: 6 Cov Kauj Ruam
Video: ИК-пульт дистанционного управления в Arduino с помощью M5Stack 2024, Kaum ib hlis
Anonim
Image
Image
Yam Koj Xav Tau
Yam Koj Xav Tau

Nyob zoo cov neeg, hauv cov lus qhia no peb yuav kawm paub yuav ua li cas cuam tshuam DHT11 qhov ntsuas kub nrog m5stick-C (pawg tswj hwm kev txhim kho los ntawm m5stack) thiab muab tso rau ntawm cov zaub ntawm m5stick-C. So hauv qhov kev qhia no peb yuav nyeem qhov ntsuas kub, av noo & cua sov ntsuas los ntawm DHT11 thiab luam tawm ntawm m5stack m5stick-C siv Arduino IDE. Yog li ntawd peb yuav ua qhov ntsuas kub ntsuas nrog m5stick C thiab DHT11.

Kauj Ruam 1: Yam Koj Xav Tau

Yam Koj Xav Tau
Yam Koj Xav Tau

Rau txoj haujlwm no koj yuav xav tau cov khoom hauv qab no: 1-m5stick-C pawg thawj coj txhim kho 2- DHT11 Kub sensor3-Ob peb jumper xov hlau 4-Hom C usb cable rau Programming

Kauj Ruam 2: Teeb UP Arduino IDE rau ESP32 Boards

Teeb UP Arduino IDE rau ESP32 Boards
Teeb UP Arduino IDE rau ESP32 Boards

Nco ntsoov tias koj tau teeb tsa ESP32 cov laug cam hauv koj Arduino IDE thiab yog tias nws tsis yog li ntawd, thov ua raws li cov lus qhia hauv qab no kom ua li ntawd: ESP32 BOARDS INSTALL:

Kauj Ruam 3: Txhim Kho Tsev Qiv Ntawv

Txhim Kho Tsev Qiv Ntawv
Txhim Kho Tsev Qiv Ntawv
Txhim Kho Tsev Qiv Ntawv
Txhim Kho Tsev Qiv Ntawv

mus rau koj Arduino IDE tom qab ntawd mus rau Sketch> suav nrog Tsev Qiv Ntawv> Tswj Tsev Qiv. Tom qab txhim kho cov tsev qiv ntawv DHT no, ntaus "Adafruit Unified Sensor" hauv lub npov tshawb nrhiav thiab nqes mus. lub tsev qiv ntawv thiab teeb tsa nws thiab koj npaj txhij rau code.

Kauj Ruam 4: Kev Sib Txuas

Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas

Cov kev sib txuas tau yooj yim heev DHT11 tus pin 1 (tus lej cim tus pin): yuav txuas nrog G26 ntawm m5stick-CDHT11 tus pin 2 (VCC): yuav mus rau 3v3 tus pin ntawm m5stick-CDHT11 tus pin 3 (GND): yuav mus rau GND tus pin m5stick -C

Kauj ruam 5: Code

Code
Code

Luam cov cai hauv qab no los ntawm kev piav qhia thiab xa nws mus rau koj lub m5stick-C pawg tswj hwm kev txhim kho: // Piv txwv ntsuas kos rau ntau yam DHT cov av noo/ntsuas kub#suav nrog "M5stickC.h" #include "DHT.h" #define DHTPIN 26 // dab tsi tus pin peb txuas nrog rau#txhais TFT_GREY 0x5AEB // Tsis hais yam twg koj tab tom siv! #define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT22 // DHT 22 (AM2302) //#define DHTTYPE DHT21 // DHT 21 (AM2301) // Pib DHT sensor rau ib txwm 16mhz ArduinoDHT dht (DHTPIN, DHTTYPE); tsis muaj teeb tsa teeb tsa () {M5.begin (); M5. Lcd.setRotation (3); Serial.begin (9600); Serial.println ("DHTxx xeem!"); dht.begin ();} void loop () {// Tos ob peb feeb ntawm kev ntsuas. ncua (2000); M5. Lcd.fillScreen (TFT_GREY); // Nyeem qhov ntsuas kub lossis av noo siv li 250 milliseconds! // Sensor nyeem ntawv kuj tseem tuaj yeem ntev txog 2 vib nas this 'qub' (nws lub sensor qeeb heev) ntab h = dht.readHumidity (); // Nyeem kub li Celsius ntab t = dht.readTemperature (); // Nyeem kub li Fahrenheit ntab f = dht.readTemperature (tseeb); // Txheeb xyuas yog tias ib qho twg nyeem tsis tau zoo thiab tawm ntxov (sim dua). yog (isnan (h) || isnan (t) || isnan (f)) {Serial.println ("Ua tsis tau tejyam nyeem los ntawm DHT sensor!"); rov qab; } M5. Lcd.setCursor (0, 0, 2); M5. Lcd.setTextColor (TFT_WHITE, TFT_BLACK); M5. Lcd.setTextSize (1); // Ntsuas qhov ntsuas cua sov // Yuav tsum xa cov ntsuas hauv Fahrenheit! ntab hi = dht.computeHeatIndex (f, h); M5. Lcd.println (""); M5. Lcd.print ("Vaum:"); M5. Lcd.println (h); Serial.print ("Vaum:"); Serial.print (h); Serial.print (" %\ t"); M5. Lcd.setTextColor (TFT_YELLOW, TFT_BLACK); M5. Lcd.setTextFont (2); M5. Lcd.print ("Kub:"); M5. Lcd.println (t); Serial.print ("Kub:"); Serial.print (t); Serial.print (" *C"); Serial.print (f); Serial.print (" *F / t"); M5. Lcd.setTextColor (TFT_GREEN, TFT_BLACK); M5. Lcd.setTextFont (2); M5. Lcd.print ("ntsuas cua sov:"); M5. Lcd.println (nyob zoo); Serial.print ("Cov ntsuas cua sov:"); Serial.print (nyob zoo); Serial.println (" *F");}

Kauj Ruam 6: Tso Tawm

Image
Image
Tso zis
Tso zis

Tom qab xa cov cai koj tuaj yeem pom qhov ntsuas kub, av noo & ntsuas cua sov ntawm cov zaub raws li qhov tso tawm.

Pom zoo: