sanithu_hemage
Published © GPL3+

Temperature And Humidity Monitoring System

Using DHT11 and OLED

BeginnerFull instructions provided715
Temperature And Humidity Monitoring System

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
Graphic OLED, 128 x 64
Graphic OLED, 128 x 64
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

You can See from this the wiring that needs to be made

Code

The Code

Arduino
Paste This Code In the Arduino IDE
#include<dht.h>
#define dht_apin 7
dht DHT;



#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 
#define SCREEN_HEIGHT 64 

Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);



void setup(){
 
  Serial.begin(9600);
  delay(500);
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  delay(1000);
 
}
 
void loop(){
 
    DHT.read11(dht_apin);
    
    Serial.print("Current humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature); 
    Serial.println("C  ");
    
    delay(2000);
    Temp_and_Humidity();
 

  

}

void Temp_and_Humidity(){
  if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    while (true);
  }

  delay(2000);        
  oled.clearDisplay(); 
  oled.setTextSize(2);          
  oled.setTextColor(WHITE);    
  oled.setCursor(0, 10); 
  oled.print("Temp & Humidity "); 

  oled.clearDisplay(); 
  
  oled.setTextSize(1);          
  oled.setTextColor(WHITE);    
  oled.setCursor(0, 10); 
  oled.println("Temp(C) : ");
  
  oled.setTextSize(2);          
  oled.setTextColor(WHITE);    
  oled.setCursor(50, 20); 
  oled.println(DHT.temperature);

  oled.setTextSize(1);          
  oled.setTextColor(WHITE);    
  oled.setCursor(0, 40);       
  oled.println("Humidity(%) : ");
  oled.setTextSize(2);          
  oled.setTextColor(WHITE);    
  oled.setCursor(50, 50); 
  oled.println(DHT.humidity);
  oled.setCursor(60, 90);
  oled.println("%");
  oled.display(); 
  
}






  

Credits

sanithu_hemage
0 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.