0% found this document useful (0 votes)
40 views3 pages

Automaic Weather Station

This document describes the materials and code needed to create a weather recording machine using an Arduino, DHT11 temperature and humidity sensor, LCD display, and I2C module. The code initializes the sensors, displays a startup message on the LCD, then continuously displays the temperature and humidity readings in Celsius and Fahrenheit on the LCD, updating every second.

Uploaded by

abhilash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views3 pages

Automaic Weather Station

This document describes the materials and code needed to create a weather recording machine using an Arduino, DHT11 temperature and humidity sensor, LCD display, and I2C module. The code initializes the sensors, displays a startup message on the LCD, then continuously displays the temperature and humidity readings in Celsius and Fahrenheit on the LCD, updating every second.

Uploaded by

abhilash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Weather Record Station

Material Requirement:
1. DTH11 Humidity and Temperature Sensor
2. Arduino UNO
3. 16*2 LCD display
4. I2C module
5. Connecting wires

Code:
#include <SimpleDHT.h>
#include <LiquidCrystal.h>
// Initialize humidity sensor.
const int pinDHT11 = 6;
SimpleDHT11 dht11;

// Initialize LCD
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Setup LCD and display startup message


void setup() {
// Display is two 16-char rows
lcd.begin(16, 2);

// Print a startup message


lcd.print("Mother's Pride");
delay(2000);
lcd.clear();
lcd.print("Weather Recordin");
delay(1000);
lcd.clear();
lcd.print("g Machine");
delay(2000);
lcd.clear();
}

// Display temp/humidity data until power-down


void loop() {
// Create variables for DHT sensor output.
byte temperature = 0;
byte humidity = 0;
// Read sensor data and store results
// in temperature/humidity variables
dht11.read(pinDHT11, &temperature, &humidity, NULL);

// Print first line to LCD


lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(round(temperature));
lcd.print("C / ");
lcd.print(round(temperature * 1.8 + 32));
lcd.print("F "); // two extra spaces in case temps drop to single digits

// Print second line to LCD


lcd.setCursor(0,1);
lcd.print("Humidity: ");
lcd.print(humidity);
lcd.print("% "); // extra space in case humidity drops to single digit

// Delay 1 second because DHT11 sampling rate is 1HZ.


delay(1000);
}

You might also like