Mundarija:

Yana bir Arduino ob-havo stantsiyasi (ESP-01 va BMP280, DHT11 va OneWire): 4 qadam
Yana bir Arduino ob-havo stantsiyasi (ESP-01 va BMP280, DHT11 va OneWire): 4 qadam

Video: Yana bir Arduino ob-havo stantsiyasi (ESP-01 va BMP280, DHT11 va OneWire): 4 qadam

Video: Yana bir Arduino ob-havo stantsiyasi (ESP-01 va BMP280, DHT11 va OneWire): 4 qadam
Video: Бу аёл Кулга тушди уйига келган уста билан хар куни 2024, Dekabr
Anonim
Yana bir Arduino ob-havo stantsiyasi (ESP-01 va BMP280, DHT11 va OneWire)
Yana bir Arduino ob-havo stantsiyasi (ESP-01 va BMP280, DHT11 va OneWire)

Bu erda siz ESP-01-ning juda kam pinlari bilan OneWire-dan foydalanishning bitta iteratsiyasini topishingiz mumkin. Ushbu yo'riqnomada yaratilgan qurilma siz tanlagan Wifi tarmog'iga ulanadi (hisobga olish ma'lumotlari bo'lishi kerak …) BMP280 va DHT11 va to'plangan ma'lumotlarni ThingSpeak kanaliga yuboradi, men sizning eskizingizni ESP-01ga qanday yuklashni bilasiz deb o'ylayman, shuning uchun men bu tafsilotlarga kirmayman. Maksimal 3,3V DC bilan. Ko'p matn qo'shilmaganligi sababli, darslik shu nuqtadan boshlab tushunarli bo'lishi kerak.

1 -qadam: 1 -qadam: BOM

1 -qadam: BOM
1 -qadam: BOM
1 -qadam: BOM
1 -qadam: BOM
1 -qadam: BOM
1 -qadam: BOM
1 -qadam: BOM
1 -qadam: BOM

Uskuna:

1 x Wi-Fi moduli: ESP-01 (men 1024 KB versiyasini ishlataman)

1 x Bosim va harorat sensori: BMP280

1 x Namlik va harorat sensori: DHT11

1 x AMS1117 kuchlanish regulyatori (to'g'ridan -to'g'ri quvvatlantirish uchun ixtiyoriy, yoki siz kirish voltajingizni sobit 3.3Vgacha boshqaradigan boshqa har qanday qurilmadan foydalanishingiz mumkin)

2 -qadam: 2 -qadam: simlarni ulash

2 -qadam: simlarni ulash
2 -qadam: simlarni ulash

ESP-01 VCC dan 3.3VESP-01 GND gacha GNDESP-01 TX dan DHT11 DATAESP-01 GPIO0 gacha BMP280 SDAESP-01 GPIO2 dan BMP280 SCLDHT11 VCC gacha 3.3VDHT11 GND dan GNDBMP280 gacha VCC dan 3.3VBMP280 gacha

3 -qadam: 3 -qadam: Kod

#include #include #include // CHECK #define BMP280_ADDRESS mina (0x76) bilan ishlaydi #include #define DHTPIN 1 // GPIO1 (Tx) #define DHTTYPE DHT11 #define ONE_WIRE_BUS 3 // GPIO3 = Rx const char* ssid = " "; // SIZNING WIFI SSID const char* password = "asd"; // SIZNING WIFIPASS const char* host = "api.thingspeak.com"; const char* writeAPIKey = "asd"; // SIZNING APIKEY // DHT11 narsalar float temperature_buiten; suzuvchi harorat_buiten2; DHT dht (DHTPIN, DHTTYPE, 15); // BMP280 Adafruit_BMP280 bmp; void setup () {// I2C stuff Wire.pins (0, 2); Wire.begin (0, 2); // DHT1 dht.begin (); // BMP280 if (! Bmp.begin ()) {// Serial.println ("BMP280 yo'q"); // while (1) {}} // WiFi tarmog'iga ulanish WiFi.begin (ssid, parol); while (WiFi.status ()! = WL_CONNECTED) {kechiktirish (500); }} void loop () {// DHT11 float namlik = dht.readHumidity (); float harorati = dht.readTemperature (); agar (isnan (namlik) || isnan (harorat)) {qaytish; } // BMP280 String t = String (bmp.readTemperature ()); String p = String (bmp.readPressure ()); // TCP CONNECTION WiFiClient mijozi; const int httpPort = 80; if (! client.connect (host, httpPort)) {return; } String url = "/update? Key ="; url += yozishAPIKey; url += "& maydon1 ="; url += String (harorat); // DHT11 CELSIUS url += "& field2 ="; url += String (namlik); // DHT11 nisbiy namlik url += "& field3 ="; url += String (bmp.readTemperature ()); // BMP280 CELSIUS url += "& field4 ="; url += String (bmp.readPressure ()/100); // BMP280 MILLIBAR url += "& field5 ="; url += String (bmp.readAltitude (1013.25)); // BMP280 METER url += "& field6 ="; url += String ((harorat +bmp.readTemperature ())/2); // DHT11 + BMP280 O'rtacha CELSIUS url + = "\ r / n"; // Client.print serveriga so'rov yuboring (String ("Get") + url + "HTTP/1.1 / r / n" + "Xost:" + host + "\ r / n" + "Ulanish: yopish / r / n / r / n "); kechikish (1000); }

Tavsiya: