Temperature and Humidity Meter Using OLED Display

Introduction: Temperature and Humidity Meter Using OLED Display

About: Arduino, Drones, robots, electronics, Fusion 360, PCB projects, 3D printing and many more. YOUTUBE || INSTAGRAM || INSTRUCTABLES

COMPONENTS REQUIRED-

1. Arduino NANO: https://amzn.to/2HfX5PH

2. DHT11 sensor: https://amzn.to/2HfX5PH

3. OLED display: https://amzn.to/2HfX5PH

4. Breadboard: https://amzn.to/2HfX5PH

5. Jumper Wires: https://amzn.to/2HfX5PH

Purchase links are for INDIA only.

Step 1: Circuit Diagram

After collecting all the required components. Download this circuit diagram for better understanding.

Step 2: Start Connecting

Put the circuit diagram in front of you and start connecting the wires.

Step 3: Configure Setting of Arduino IDE

Now, after completing the connecting open arduino IDE and select your board type and COM board. Also download and include the libraries.

Step 4: Code Uploading

Now, compile and upload the code.

CODE:

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

#define DHTPIN 2

#define DHTTYPE DHT11

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

void drawTest(void) {

u8g.setFont(u8g_font_unifont);

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

u8g.drawStr( 0, 50, " Humidity Meter");

u8g.setFont(u8g_font_helvB08); //

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

}

void setup() {

dht.begin();

u8g.firstPage();

do {

drawTest();

}

while( u8g.nextPage() );

delay(3000); }

void loop() {

delay(500);

float h = dht.readHumidity();

float t = dht.readTemperature();

if (isnan(h) || isnan(t) )

{

return;

}

u8g.firstPage();

do {

u8g.setFont(u8g_font_helvB08);

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

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

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

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

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

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

}

while( u8g.nextPage() ); }

Step 5: Testing

Now, just test your project.

Be the First to Share

    Recommendations

    • Rocks, Gems, and Stones Speed Challenge

      Rocks, Gems, and Stones Speed Challenge
    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest
    • Back to School: Student Design Challenge

      Back to School: Student Design Challenge

    Comments

    0
    arshadrifa
    arshadrifa

    Question 1 year ago

    I need the code