weather monitoring system

Introduction

The purpose of the of this project is to build a simple Weather Monitoring System which is designed to monitor temperature, humidity, and air pressure of the environment and display the readings on an LCD screen using Arduino Uno board. Additionally, it uses a Serial Peripheral Interface (SPI) to transfer data to a computer, where the data is logged and analyzed for long-term weather trends.

General Description

Hardware Design

The following components are required for this project:

* Arduino board

* DHT11 (RHT01) sensor

* 1602 LCD screen

* 4.7K ohm resistor

* 10K ohm variable resistor

* 330 ohm resistor

* Breadboard

* Jumper wires

* Computer with Serial monitor software (such as PuTTY)

Software Design

The following software requirements are used for this project:

* Arduino Integrated Development Environment (IDE)

* library for the BMP280 sensor may be needed to read the temperature, humidity, and air pressure data

* Serial monitor software

Interfacing Arduino with DHT22 humidity and temperature sensor include LCD library code #include <LiquidCrystal.h> include DHT library code #include “DHT.h” #define DHTPIN 8 DHT22 data pin is connected to Arduino pin 8

LCD module connections (RS, E, D4, D5, D6, D7) LiquidCrystal lcd(7, 6, 5, 4, 3, 2); #define DHTTYPE DHT22 DHT22 sensor is used DHT dht(DHTPIN, DHTTYPE); Initialize DHT library char temperature[] = “Temp = 00.0 C”; char humidity[] = “RH = 00.0 %”; void setup() { set up the LCD's number of columns and rows

lcd.begin(16, 2);
dht.begin();

}

void loop() {

delay(1000);               // wait 1s between readings
// Read humidity
int RH = dht.readHumidity() * 10;
//Read temperature in degree Celsius
int Temp = dht.readTemperature() * 10;

// Check if any reads failed and exit early (to try again)
if (isnan(RH) || isnan(Temp)) {
  lcd.clear();
  lcd.setCursor(5, 0);
  lcd.print("Error");
  return;
}

if(Temp < 0){

  temperature[6] = '-';
  Temp = abs(Temp);
}
else
  temperature[6] = ' ';
temperature[7]   = (Temp / 100) % 10  + 48;
temperature[8]   = (Temp / 10)  % 10  + 48;
temperature[10]  =  Temp % 10 + 48;
temperature[11]  = 223;        // Degree symbol ( °)
if(RH >= 1000)
  humidity[6]    = '1';
else
  humidity[6]    = ' ';
humidity[7]      = (RH / 100) % 10 + 48;
humidity[8]      = (RH / 10) % 10 + 48;
humidity[10]     =  RH % 10 + 48;
lcd.setCursor(0, 0);
lcd.print(temperature);
lcd.setCursor(0, 1);
lcd.print(humidity);

}

Results Obtained

For example if the temperature = 37.2 °C and this is the value which the Adafruit library returns using the function dht.readTemperature(), by multiplying this value by 10 we get 372. yields: (372 / 100) % 10 = 3 (372 / 10) % 10 = 7 372 % 10 = 2 The number 48 is used to convert decimal numbers to AscII because the LCD works with AscII format. The line temperature[11] = 223; is for the degree symbol ( °).

Conclusions

The conclusion is that the code converts the floating-point values of temperature and humidity into a formatted string representation with one decimal place. This string representation is stored in character arrays, which can be used to display the values on an LCD or any other output device that can handle character arrays.

Download

An archive (or more if necessary) with the files obtained as a result of the project: sources, schemes, etc. A README file, a ChangeLog, a build script and automatic copy on uC always make a good impression ;-).

The files are uploaded to the wiki using the Add Images or other files facility. The namespace in which the files are uploaded is of the type :pm:prj20??:c? or :pm:prj20??:c?:student_name (if applicable). Example: Dumitru Alin, 331CC → :pm:prj2009:cc:dumitru_alin.

Journal

You can also have a journal section where the project assistant can track the progress of the project.

Bibliography/Resources

pm/prj2023/tmiu/weathermonitoringsystem.txt · Last modified: 2023/05/30 12:43 by malak.safiya
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0