Weather Station Using 8051
Weather Station Using 8051
Introduction
DHT11 is a single wire digital humidity and temperature sensor, which provides humidity and
temperature values serially.
It can measure relative humidity in percentage (20 to 90% RH) and temperature in degree
Celsius in the range of 0 to 50°C.
It has 4 pins of which 2 pins are used for supply, 1 is not used and the last one is used for data.
d
CKT DIAGRAM
PROGRAM
#include<reg51.h>
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
#include "LCD16x2_4bit.h"
void timer_delay30us()
{
TMOD = 0x01; *
TH0 = 0xFF;
TL0 = 0xF1;
TR0 = 1;
while(TF0 == 0);
TR0 = 0;
TF0 = 0;
}
while(DHT11==1);
}
return c;
}
void main()
{
unsigned char dat[20];
LCD_Init(); /* initialize LCD */
while(1)
{
Request(); /* send start pulse*/
Response(); /* receive response */
Connection Diagram
LCD:
RS : P0.5
RW : P0.6
EN : P0.7
Data Lines : P2
ADC:
RD : P0.0
WR : P0.1
INTR : P0.2
Output : P1
PROGRAM
#include<reg51.h>
sbit rd=P0^0;
sbit wr=P0^1;
sbit intr=P0^2;
sbit rs=P0^5;
sbit rw=P0^6;
sbit en=P0^7;
void lcd_int();
void cmd(unsigned int b);
void dat(unsigned int c);
void show(unsigned char *s);
void lcd_int()
{
cmd(0x38);
cmd(0x0e);
cmd(0x06);
cmd(0x01);
cmd(0x80);
}
return conv;
}