Mundarija:

ESP8266 va OLED yordamida jonli Covid19 kuzatuvchisi - Haqiqiy vaqtda Covid19 asboblar paneli: 4 qadam
ESP8266 va OLED yordamida jonli Covid19 kuzatuvchisi - Haqiqiy vaqtda Covid19 asboblar paneli: 4 qadam

Video: ESP8266 va OLED yordamida jonli Covid19 kuzatuvchisi - Haqiqiy vaqtda Covid19 asboblar paneli: 4 qadam

Video: ESP8266 va OLED yordamida jonli Covid19 kuzatuvchisi - Haqiqiy vaqtda Covid19 asboblar paneli: 4 qadam
Video: Как использовать SSD1306 128x32 OLED-дисплей I2C с кодом Arduino 2024, Dekabr
Anonim
Image
Image

Techtronic Harsh veb -saytiga tashrif buyuring:

Hamma joyda yangi turdagi koronavirus (COVID19) avj olgan. Dunyoda COVID-19ning hozirgi ssenariysini kuzatib turish zarur bo'ldi.

Shunday qilib, men uyda bo'lganimda, bu "Dunyoning jonli Covid19 asboblar paneli" haqida o'ylagan loyiham edi-bu dunyoning COVID-19 holati to'g'risida real vaqt rejimida yangilanishlarni ta'minlaydigan asboblar paneli. Endi televizorni yoqish yoki turli veb -saytlarni tomosha qilishning hojati yo'q.

Loyihaning dizayni muhim qism emas edi. Lekin foydali narsalarni yaratish, qulay komponentlardan foydalanish qiyin edi. Ushbu loyiha, albatta, sizni yangilab turish uchun oddiy boshqaruv paneli interfeysini yaratishga yordam beradi.

Ta'minotlar

  • ESP8266
  • OLED displey
  • Jumper kabellari

1 -qadam: sxemalar:

O'rnatish
O'rnatish

2 -qadam: sozlash:

O'rnatish
O'rnatish
O'rnatish
O'rnatish
  1. Realtime Covid19 boshqaruv paneli veb -saytiga tashrif buyuring. Bu erda men https://trackcorona.live dan foydalanmoqdaman.
  2. Https://thingspeak.com saytiga kiring/ro'yxatdan o'ting. Ilovaga o'ting va yangi ThingHttp harakatini yarating.

    • Tanlagan ismingizni, URL manzilini (https://trackcorona.live), GET usuli va Parse String -da bering, siz ko'rsatishingiz kerak bo'lgan maydonni trackcorna.live veb -saytidan XPath -ni joylashtirishingiz kerak.
    • Yuqoridagi misolda (rasm), men tasdiqlangan holatlar uchun satrni ajratib ko'rsataman, buning uchun nima qilish kerak

      • Tasdiqlangan holatlar soni> Tekshirish -ni o'ng tugmasini bosing.
      • Yana Kod> Nusxa ko'chirish> CopyXPath -ni o'ng tugmasini bosing
      • Buni ThinkHttp harakatining Parse String maydoniga joylashtiring va saqlang.
      • Xuddi shunday, buni hamma tiklangan, o'lim, o'lim darajasi va o'lim darajasi uchun qiling.
      • Manba kodiga tashrif buyuring va SSID -ni Wi -Fi nomi bilan almashtiring, parolni Wi -Fi va API kalitini ThingHttp API bilan almashtiring.
  3. Kodni yuklash. Bo'ldi shu!!

3 -qadam: Manba kodi:

/* © Techtronic Harsh

Youtube:

Ko'rsatmalar: https://www.instructables.com/member/… Instagram: https://instagram.com/techtronicharsh veb -sayti: https://techtronicharsh.com Telegram:

*/

#qo'shish // ESP8266 funktsiyalaridan foydalanish #qo'shish #qo'shish #qo'shish #qo'shish #qo'shish

Adafruit_SSD1306 displeyi = Adafruit_SSD1306 (128, 32, & Wire);

const char*ssid = "*******"; // Sizning yo'riqnoma SSID, ya'ni WiFi nomi const char*password = "*******"; // Sizning WiFi parolingiz char char* host = "api.thingspeak.com"; // Biz bu hostdan ma'lumotlarni o'qiymiz const int httpPortRead = 80; /* API kalitini API yordamida ThingHttp orqali o'zgartiring*/const char* url1 = "/apps/thinghttp/send_request? Api_key = TGC4KNQ98REOA4JH"; // Tasdiqlangan const char* url2 = "/apps/thinghttp/send_request? Api_key = Y0ALN1QGDTNLLNNM"; // tiklangan char char* url3 = "/apps/thinghttp/send_request? Api_key = 0J24MB3W9F9Q0E7M"; // Death const char* url4 = "/apps/thinghttp/send_request? Api_key = R2BKR1DRVS5YT2PH"; // Qutqarish tezligi const char* url5 = "/apps/thinghttp/send_request? Api_key = VYMVMGK9S8W21EXQ"; // O'lim darajasi

Tarmoqli holatlar, o'lim, tiklanish, tiklanish darajasi, o'lim darajasi;

WiFiClient mijozi; // WiFi mijozi va http mijozini yarating

HTTPClient

bo'sh o'rnatish () {

Serial.begin (9600); // WiFi.disconnect () ketma -ket aloqasini ishga tushiring; // Wi -Fi tarmog'ini uzing va qayta ulang (1000); WiFi.begin (ssid, parol); Serial.println ("Wi -Fi tarmog'iga ulangan"); // Serial.println (WiFi.localIP ()) ketma -ket monitorida fikr -mulohazalarni ko'rsatish; display.begin (); display.display (); kechikish (1000);

display.clearDisplay ();

display.display ();

display.setTextSize (1);

display.setTextColor (oq);

}

bo'sh halqa ()

{// 1 -o'qish: Tasdiqlangan holatlarni o'qish

if (http.begin (host, httpPortRead, url1)) // Xost va urlga ulaning

{int httpCode = http. GET (); // Agar javob bo'lsa, fikrni tekshiring (httpCode> 0) {if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {Cases = http.getString (); Serial.print ("Tasdiqlangan holatlar:"); Serial.println (holatlar); display.setCursor (0, 0); display.println ("COVID19 LIVE"); display.println (""); display.println ("Tasdiqlangan holatlar:"); display.println (holatlar); display.display (); kechikish (4000); display.clearDisplay (); }} boshqa // Agar biz ma'lumotlarni ololmasak {Serial.printf ("[HTTP] GET… bajarilmadi, xato: %s / n", http.errorToString (httpCode).c_str ()); } http.end (); } else // Agar biz HTTPga ulana olmasak {Serial.printf ("[HTTP} ulanib bo'lmadi / n"); }

// 2 -o'qish: Qayta tiklanganlarni o'qish

agar (http.begin (host, httpPortRead, url2))

{int httpCode = http. GET (); if (httpCode> 0) {if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {Recover = http.getString (); Serial.print ("Qayta tiklandi:"); Serial.println (qutqarish); display.setCursor (0, 0); display.println ("COVID19 LIVE"); display.println (""); display.println ("Qayta tiklandi:"); display.println (Qayta tiklash); display.display (); kechikish (4000); display.clearDisplay (); }} boshqa {Serial.printf ("[HTTP] GET… bo'lmadi, xato: %s / n", http.errorToString (httpCode).c_str ()); } http.end (); } boshqa {Serial.printf ("[HTTP} ulanmadi / n"); }

// 3 -o'qish: O'limlarni o'qish

agar (http.begin (host, httpPortRead, url3))

{int httpCode = http. GET (); if (httpCode> 0) {if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {O'lim = http.getString (); Serial.print ("O'limlar:"); Serial.println (O'lim); display.setCursor (0, 0); display.println ("COVID19 LIVE"); display.println (""); display.println ("O'limlar:"); display.println (O'lim); display.display (); kechikish (4000); display.clearDisplay (); }} boshqa {Serial.printf ("[HTTP] GET… bo'lmadi, xato: %s / n", http.errorToString (httpCode).c_str ()); } http.end (); } else {Serial.printf ("[HTTP} ulanmadi / n"); }

// 4 -o'qish: Qayta tiklash tezligini o'qish

agar (http.begin (xost, httpPortRead, url4))

{int httpCode = http. GET (); if (httpCode> 0) {if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {Recoveryrate = http.getString (); Serial.print ("Qayta tiklash tezligi:"); Serial.println (Qayta tiklash tezligi); display.setCursor (0, 0); display.println ("COVID19 LIVE"); display.println (""); display.println ("Qayta tiklash tezligi:"); display.print (qutqarish tezligi); display.println (" %"); display.display (); kechikish (4000); display.clearDisplay (); }} boshqa {Serial.printf ("[HTTP] GET… bo'lmadi, xato: %s / n", http.errorToString (httpCode).c_str ()); } http.end (); } else {Serial.printf ("[HTTP} ulanmadi / n"); }

// 5 -o'qish: O'lim ko'rsatkichini o'qish

agar (http.begin (xost, httpPortRead, url5))

{int httpCode = http. GET (); if (httpCode> 0) {if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {O'lim darajasi = http.getString (); Serial.print ("O'lim darajasi:"); Serial.println (O'lim darajasi); display.setCursor (0, 0); display.println ("COVID19 LIVE"); display.println (""); display.println ("O'lim darajasi:"); display.print (O'lim darajasi); display.println (" %"); display.display (); kechikish (4000); display.clearDisplay (); display.display (); }} boshqa {Serial.printf ("[HTTP] GET… bo'lmadi, xato: %s / n", http.errorToString (httpCode).c_str ()); } http.end (); } else {Serial.printf ("[HTTP} ulanmadi / n"); } while (WiFi.status ()! = WL_CONNECTED) // Wifi aloqasi uzilgan taqdirda {WiFi.disconnect (); kechikish (1000); WiFi.begin (ssid, parol); Serial.println ("Wi -Fi tarmog'iga qayta ulanmoqda.."); display.setCursor (0, 0); display.println ("Techtronic Harsh"); display.println (""); display.println ("Ulanmoqda…."); display.display (); kechikish (10000); display.clearDisplay (); display.display (); }

}

/* © Techtronic Harsh

Youtube:

Ko'rsatmalar: https://www.instructables.com/member/… Instagram: https://instagram.com/techtronicharsh veb -sayti: https://techtronicharsh.com Telegram:

*/

4 -qadam: Ishlash:

Tarmoq sxemasiga muvofiq ulanishlarni amalga oshiring va tegishli kartani va COM portini tanlagandan so'ng kodni yuklang. Agar u xato ko'rsatsa, kutubxonani yuqoridagi ko'rsatmalarga muvofiq qo'shganingizga ishonch hosil qiling.

Agar OLED -ni ishga tushirish uchun ko'p vaqt kerak bo'lsa, Internet xizmatlariga to'g'ri ulanganligingizga ishonch hosil qiling, ya'ni WiFi yoki Hotspot.

Tavsiya: