Mundarija:

OLED displey yordamida harorat va namlik o'lchagichi: 5 qadam
OLED displey yordamida harorat va namlik o'lchagichi: 5 qadam

Video: OLED displey yordamida harorat va namlik o'lchagichi: 5 qadam

Video: OLED displey yordamida harorat va namlik o'lchagichi: 5 qadam
Video: Arduino Nano, BME280 va SSD1306 OLED ob-havo stantsiyasi 2024, Noyabr
Anonim
OLED -displey yordamida harorat va namlik o'lchagichi
OLED -displey yordamida harorat va namlik o'lchagichi
OLED -displey yordamida harorat va namlik o'lchagichi
OLED -displey yordamida harorat va namlik o'lchagichi
OLED -displey yordamida harorat va namlik o'lchagichi
OLED -displey yordamida harorat va namlik o'lchagichi

Komponentlar talab qilinadi-

1. Arduino NANO:

2. DHT11 sensori:

3. OLED displeyi:

4. Non paneli:

5. Jumper simlari:

Xarid qilish havolalari faqat Hindiston uchun.

1 -qadam: O'chirish diagrammasi

O'chirish diagrammasi
O'chirish diagrammasi

Barcha kerakli komponentlar yig'ilgandan so'ng. Yaxshi tushunish uchun ushbu sxemani yuklab oling.

2 -qadam: Ulanishni boshlang

Ulanishni boshlang
Ulanishni boshlang

Elektr sxemasini oldingizga qo'ying va simlarni ulashni boshlang.

3 -qadam: Arduino IDE sozlamalarini sozlang

Arduino IDE sozlamalarini sozlash
Arduino IDE sozlamalarini sozlash

Endi, ulanish tugagandan so'ng, ochiq arduino IDE -ni tanlang va karta turini va COM -ni tanlang. Shuningdek, kutubxonalarni yuklab oling va kiriting.

4 -qadam: Kodni yuklash

Kodni yuklash
Kodni yuklash

Endi kodni tuzing va yuklang.

KOD:

#clude "DHT.h" #include "U8glib.h" U8GLIB_SSD1306_128X64 u8g (U8G_I2C_OPT_NONE | U8G_I2C_OPT_DEV_0);

#DHTPIN 2 ni aniqlang

#DHTTYPE DHT11 ni aniqlang

DHT dht (DHTPIN, DHTTYPE, 6); char str [10];

void drawTest (bekor) {

u8g.setFont (u8g_font_unifont);

u8g.drawStr (0, 30, "Harorat &");

u8g.drawStr (0, 50, "Namlik o'lchagichi");

u8g.setFont (u8g_font_helvB08); //

u8g.drawStr (7, 60, "PR ROBOTICS");

}

bo'sh o'rnatish () {

dht.begin ();

u8g.firstPage ();

qil {

drawTest ();

}

while (u8g.nextPage ());

kechikish (3000); }

void loop () {

kechikish (500);

float h = dht.readHumidity ();

float t = dht.readTemperature ();

agar (isnan (h) || isnan (t))

{

qaytish;

}

u8g.firstPage ();

qil {

u8g.setFont (u8g_font_helvB08);

u8g.drawStr (0, 15, "Namlik:");

u8g.drawStr (80, 15, dtostrf (h, 5, 2, str));

u8g.drawStr (120, 15, "%");

u8g.drawStr (0, 30, "Harorat:");

u8g.drawStr (80, 30, dtostrf (t, 5, 2, str)); u8g.drawStr (120, 30, "\ 260C");

u8g.drawStr (10, 60, "BY: PR ROBOTICS");

}

while (u8g.nextPage ()); }

5 -qadam: Sinov

Sinov
Sinov

Endi loyihangizni sinab ko'ring.

Tavsiya: