Temperature and Humidity Monitoring System

Temperature and Humidity Monitoring System

1024 576 Avinash Desai

Regardless of the application area Relative Humidity (RH) and temperature almost always go hand in hand. For a given amount of moisture in a set amount of air  the RH value will reduce as temperature increases because hot air is capable of carrying a larger amount of water. This movement of RH with temperature is one of the many important reasons why it is important to record and display the RH and temperature over time with monitoring systems.

In this project, you will display temperature and humidity readings from the DHT11 sensor on the LCD screen using the ‘Learn to Solder’ board.

Additional Components Used:

  1. Itty Bitty  --- 1 no.
  2. USB B Type Cable  --- 1 no.
  3. 5v Regulator Breakout   -- 1 no.
  4. Power Adapter  --- 1 no.
  5. Red 8” Male-Male Jumper Wire  --- 1 no.
  6. Black 8” Male-Male Jumper Wire  --- 1 no.
  7. DHT sensor plug  --- 1 no.
  8. 4-3 A cable  --- 1 no.

 

Procedure:

  1. Upload the code to the ATmega328p  IC, as mentioned earlier using the itty bitty
  2. Mount the  ATmega328p  IC on Learn to Solder board
  3. Connect the Jumper wires to one end of the  power regulator breakout, Ensure Red wire is connected to the ‘+’ & Black to  ‘-’.
  4. Similarly connect the other end to the wires to the power port on Learn to Solder board.
  5. Connect the DHT 11 to the SPI port of the L2S board using the 4-3 A cable .
  6. Connect the DC barrel pin of the power adapter to regulator board & Power On the Adapter
  7. The board will start functioning.

Code:

#include<dht.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

dht DHT; 

#define DHT11_PIN A4
Adafruit_PCD8544 display = Adafruit_PCD8544(8, 9, 10, 12, 11);
int SER_Pin=A1;
int RCLK_Pin=6;
int SRCLK_Pin = 5;       

const byte logo_el[] PROGMEM = {16,10,
B00000000,B00000000,
B11111010,B00000000,
B11111010,B00000000,
B00000010,B00000000,
B11111010,B00000000,
B11111010,B00000000,
B00000010,B00000000,
B11111011,B11000000,
B11111011,B11000000,
B00000000,B00000000,
};
#define number_of_74hc595s 3
#define numOfRegisterPins number_of_74hc595s*8
boolean registers[numOfRegisterPins];

void setup() 
{
  pinMode(SER_Pin,OUTPUT);
  pinMode(RCLK_Pin,OUTPUT);
  pinMode(SRCLK_Pin,OUTPUT);
  clearRegisters();
  writeRegisters();
  display.begin();
  display.setContrast(50);
  display.clearDisplay();
  display_El_logo();
  display_L2S();
  display_title();
}
void loop()
{ // READ DATA
  int chk = DHT.read11(DHT11_PIN);    
  display.drawRect(0, 0, 84 , 48,BLACK);
  display.setCursor(10,2);
  display.print("Temperature:");
  display.setTextSize(1);
  display.setTextColor(BLACK);
  display.setCursor(24,11);
  display.print(DHT.temperature);
  display.setTextSize(1);
  display.setTextColor( BLACK);
  display.drawPixel(56,11,BLACK);                    
  display.drawPixel(55,12,BLACK);
  display.drawPixel(56,13,BLACK);
  display.drawPixel(57,12,BLACK);                                                    
  display.setCursor(59,11);
  display.println("C");
  
  display.setCursor(19,22);
  display.println("Humidity:");
  display.setCursor(19,31);
  display.println(DHT.humidity);
  display.setCursor(53,31);
  display.print("%RH");
  display.drawBitmap(70,37,logo_el,10,10,BLACK);
  display.display();
  display.clearDisplay();
  delay(2000);
}

//*****Elintlabz logo*****//
void display_El_logo()
{
   display.fillRect(15,2,21,6,BLACK);
   display.fillRect(15,12,21,6,BLACK);
   display.fillRect(15,22,21,6,BLACK);
   display.fillRect(45,2,6,26,BLACK);
   display.fillRect(50,22,18,6,BLACK);
   display.setCursor(15,35);
   display.print("ElintLabz");
   display.display();
   delay(5000);
   display.clearDisplay();
}

//*****learn2solder*****//
void display_L2S()
{
  display.drawRect(0, 0, 84 , 48,BLACK);
  display.setCursor(26, 10);
  display.println("LEARN");
  display.setCursor(38,20);
  display.println("2");
  display.setCursor(22,30);
  display.println("SOLDER");
  display.display(); 
  delay(5000);
  display.clearDisplay();
}
//*****Title*****//
void display_title()
{
  display.drawRect(0, 0, 84 , 48,BLACK);
  display.setCursor(10,2);
  display.println("Temperature");
  display.setCursor(12,12);
  display.println("& Humidity");
  display.setCursor(13,22);
  display.println("monitoring");
  display.setCursor(20,32);
  display.println("system");
  display.drawBitmap(70,35,logo_el,10,10,BLACK);
  display.display(); 
  delay(5000);
  display.clearDisplay();
}

//*****clear bargraph*****//
 void  writeRegisters()
 {
  digitalWrite(RCLK_Pin, LOW);
  for(int i = numOfRegisterPins - 1; i >=  0; i--)
  {
    digitalWrite(SRCLK_Pin, LOW);
    int val = registers[i];
    digitalWrite(SER_Pin, val);
    digitalWrite(SRCLK_Pin, HIGH);
  }
  digitalWrite(RCLK_Pin, HIGH);
 }
 
 void clearRegisters()
 {
  for(int i = numOfRegisterPins - 1; i >=  0; i--)
  {
     registers[i] = LOW;
  }
  writeRegisters();
 } 

 

Leave a Reply