You are on page 1of 36

NETAJI SUBHASH ENGINEERING COLLEGE

This is to certify that the following students:

S.NO. NAME ROLL NO.

1. Pritha Dawn 071090103098

2. Aarish Shahab 071090103084

3. Madhukar Singh 071090103085

4. Surajit Mondal 071090103081

5. Pooja Roychoudhury 071090103122

Of 2007-11 batch pursuing B.TECH degree in ELECTRONICS AND


COMMUNICATION ENGINEERING have successfully completed their
project on

ROOM LIGHT AND TEMPERATURE CONTROL USING


MICROCONTROLLER

In partial fulfillment of the requirement as prescribed by the WEST


BENGAL UNIVERSITY OF TECHNOLOGY.

HOD,ECE PROJECT ADVISOR


ACKNOWLEDGEMENTS

We are greatly indebted to our project advisor Mrs.


Madhurima for her valuable help in the
formulation and execution of this project.
We wish to make a special mention of Mr. T.K. Dawn and Mr. B.
Choudhury in the Project Lab to whom we owe a debt of
gratitude for their assistance with the hardware
implementation part of our project.
Finally, we wish to thank
the Principal of NSEC and the head of the ECE Department for
giving us the opportunity to present this project.

Pritha Dawn
Aarish Shahab
Madhukar Singh
Surajit Mondal
Pooja Roychoudhury
ROOM LIGHT AND
TEMPERATURE CONTROL
USING MICROCONTROLLER
ABSTRACT

We propose to create a system for room light and temperature


control:

the lights are switched on when ambient light intensity


falls below a specified level
the fan is switched on when temperature rises above a
specified level.
the light and the fan work only when there is someone in
the room.
Chapter 1 of this report is the introduction.
Chapter 2 shows us the flow of process ie the Programming
part
Chapter 3 is hardware implementation; circuit diagrams and
brief explanations.
Chapter 4 is the results and verifications part.
Chapter 5 deals with the future scope of the project.
Chapter-1
INTRODUCTION
Need of the project: The aim of technology is to
make our lives simpler. This project takes over the
control of lights and fans in a room so that we do not
have to manually switch on and switch off the things.
Besides comfort , this project also prevents wastage of
energy.

This project is based on the concept of Home


automation (also called domotics) - automation of the
home, housework or household activity. Home
automation may include centralized control of lighting,
HVAC (heating, ventilation and air conditioning),
appliances, and other systems, to provide improved
convenience, comfort, energy efficiency and security.
Home automation for the elderly and disabled can
provide increased quality of life for persons who might
otherwise require caregivers or institutional care.
A home automation system integrates electrical devices
in a house with each other. The techniques employed in
home automation include those in building automation
as well as the control of domestic activities, such as
home entertainment systems, houseplant and yard
watering, pet feeding, changing the ambiance "scenes"
for different events (such as dinners or parties), and the
use of domestic robots. Devices may be connected
through a computer network to allow control by a
personal computer, and may allow remote access from
the internet.
Although automated homes of the future have been
staple exhibits for World's Fairs and popular backgrounds
in science fiction, complexity, competition between
vendors, multiple incompatible standards and the
resulting expense have limited the penetration of home
automation to homes of the wealthy or ambitious
hobbyists.

Project overview:
The project is divided into four main parts-
1. Light control the lights in the room are
switched on when the ambient light intensity
drops below a predetermined level.
2. Temperature control the fan is switched on
when the room temperature rises above a
specified level.
3. Infrared sensor circuit there are 2 IR
transmitter-receiver pairs on either side of the
door. The microcontroller uses this circuit to
count the number of persons in the room.
When the number of persons in the room is
zero, the lights and fans are switched off.
4. Microcontroller programming The
appropriate program has to burned into the
microcontroller so that it controls the devices in
the desired manner.
Chapter-2
PROGRAMMING
FLOW CHART:

Counting number of persons.


Controlling Light and Fan.
CODE:
ORG 0000H
LJMP MAIN

ORG 0003H (Interrupt vector for interrupt 0)


CLR IE.2
INC R0
BACK1: MOV R1, #255
DJNZ R1, BACK
SETB IE.2
RETI
ORG 0013H (Interrupt vector for interrupt 1)
CLR IE.0
DEC R0
BACK2: MOV R1, #255
DJNZ R1, BACK2
SET IE.0
RETI
ORG 0030H
MAIN: MOV R0,#00H
MOV IE,#85H
SET TCON.0 (For edge triggering)
SET TCON.2
MOV A,#0FFH
MOV P1,A
LCALL LIGHT
LCALL FAN
END
Light subroutine:
ORG 0300H
MOV C,P1.0
JC NEXT
NEXT: MOV A,R0
JNZ LIGHTON
LIGHTON: SETB P2.0
RET
Fan subroutine:
ORG 0200H
MOVC,P1.2
JC NEXT1
NEXT1: MOV A, R0
JNZ FANON
FANON: SETB P2.2
RET
Chapter-3
HARDWARE IMPLEMENTATION
Light control:
Devices used:
Light dependent resistor: A photoresistor or light dependent
resistor (LDR) is a resistor whose resistance decreases with
increasing incident light intensity.

Op-amp 741: Op-Amp 741 is an 8 pin I.C. Integrated Circuit.


Here, we use the 741 Op-Amp as a voltage comparator.
The 741 has 2 inputs at pins 2 and 3 and output at pin 6. Pin 3 is
the non-inverting input with the sign + and is supplied with a
fixed voltage, normally half the supply voltage by a Potential
Divider. pin 2 is the inverting input with the sign - . The
inverting input voltage at Pin 2 is made to go higher or lower
than the fixed non-inverting input at Pin 3. When the voltage at
Pin 2 (the inverting input - ) goes higher than the fixed voltage
at Pin 3 (the non-inverting input + ) then the output voltage at
pin 6 goes low. (about 1.8 Volts for 9 volt supply). When the
voltage at Pin 2 goes lower than the fixed voltage at Pin 3 then
the output voltage at Pin 6 goes high (about 8 Volts for 9 Volt
supply). The point at which the voltage at Pin 2 and 3 are equal
is called the THRESHOLD voltage. It is the point at which the
output changes from high to low (or low to high) .
Circuit diagram:

Explanation:
As the light intensity on the LDR decreases , its resistance
increases and consequently , the voltage at pin 2 of the opamp
changes.
Temperature control:
Devices used:
LM35DT temperature sensor:

The LM35 series are precision integrated-circuit temperature


sensors, whose output voltage is linearly proportional to the
Celsius (Centigrade) temperature.

Features
Calibrated directly in Celsius (Centigrade)
Linear + 10.0 mV/C scale factor
0.5C accuracy guaranteeable (at +25C)
Rated for full 55 to +150C range
Suitable for remote applications
Low cost due to wafer-level trimming
Operates from 4 to 30 volts
nLess than 60 A current drain
Low self-heating, 0.08C in still air
Nonlinearity only 14C typical
Low impedance output, 0.1 W for 1 mA load

ADC0804:

We use ADC0804 to convert output of LM35 to digital. ADC0804 IC is an 8-


bit parallel ADC. It has 8 output pins which represents the digital value of
input. The input from LM35 is feed to pin 6. The 8 pins 11-18 gives the
corresponding digital value of the signal.
Temperature sensor circuit diagram:

This circuit uses a temperature sensor LM35DT. This sensor generates


an analog signal which is proportional to room temperature, which is
then converted to a digital signal by an analog to digital converter
ADC0804. The fourth and fifth bit corresponds to change in
temperature which range to 288K to 337K. At this temperature the
output from OR gate is high and is sensed by the microcontroller which
activates the FAN through relay circuit.

Visitor counter:
Devices used:
555 timer: The 555 Timer IC is an integrated circuit (chip) used in a
variety of timer, pulse generation and oscillator applications. The 555
timer has 3 modes of operation. In the transmitter circuit,the 555 is
used in the astable mode.

In astable mode, the 555 timer puts out a continuous stream of


rectangular pulses having a specified frequency.

In the astable mode, the frequency of the pulse stream depends on the
values of R1, R2 and C:

[7]
In the monostable mode, the 555 timer acts as a one-shot pulse
generator. The pulse begins when the 555 timer receives a signal at the
trigger input that falls below a third of the voltage supply. The width of
the output pulse is determined by the time constant of an RC network,
which consists of a capacitor (C) and a resistor (R). The output pulse
ends when the charge on the C equals 2/3 of the supply voltage. The
output pulse width can be lengthened or shortened to the need of the
specific application by adjusting the values of R and C.[6]

The output pulse width of time t, which is the time it takes to charge C to
2/3 of the supply voltage, is given by

where t is in seconds, R is in ohms and C is in farads.


IR LED: As the name suggests , IR LEDs emit light in the infrared
region of the light spectrum . There are a couple of key differences in
the electrical characteristics of infrared LEDs versus visible light LEDs.
Infrared LEDs have a lower forward voltage, and a higher rated current
compared to visible LEDs.

TSOP 1738: The TSOP17.. series are miniaturized receivers for


infrared remote control systems. The demodulated output signal can
directly be decoded by a microprocessor.
Output active low
High immunity against active light.
Continuous data transmission possible(upto 2400 bps)
Suitable burst length >=10 cycles/burst
TSOP 1738 has a carrier frequency 38 khz.
IR transmitter circuit:

IR receiver circuit:
There are 2 IR transmitter-receiver pairs, one pair on either side
of the door. When a person enters the room the signal from the
first pair is interrupted first and then the second one. But when
someone leaves the room the process is reversed. In this way,
microcontroller senses whether the person is entering or
leaving the room.
When a person enters the room , a register in the
microcontroller is incremented by one. When a person leaves
the room,the register is decremented by one. In this way , the
microcontroller keeps track of the number of persons in the
room at any given instant.
Microcontroller Circuit:

Microcontroller AT89C52.

AT89C52 developed by ATMEL has 8K of internal ROM and


128 bytes of RAM. It is a 32 I/O IC, having three timer and four
port on a single chip. It is a 8 bit processor.
Pin 20 of AT89C52 is connected to the ground and pin 40 to
the Vcc. We use interrupt input of the microcontroller to count
the number of persons. And switching of Light and Fan is done
through polling. Means we call both the processes one by one
from the main program.
The output of light sensor circuit is given to pin P1.0 and
output for light control comes from Pin P2.0. Again we can
connect the required output of the ADC converter to the pin
P1.2 of the microcontroller and output comes out from pin
P2.2.
Chapter-4
RESULTS AND VERIFICATIONS:
For IR sensor:
In the IR transmitter circuit, the values of R1, R2 and C were
varied to get 38khz square wave from the 555 timer.
When R1= 2kilo ohms, R2=18 kiloohms , C=1 nF
The theoretical value of frequency is given by

= 45 khz.
however, the square wave frequency,as seen on the CRO turns out
to be around 40 khz. this is sufficient for our purpose as the
receiver circuit responds to this frequency.
(diagram of the photosensor circuit)
In the photosensor circuit , we can change the sensitivity of the
circuit, i.e.the level of light intensity to which it responds by
changing the 22k preset.
For temperature sensor circuit:
Digital Output From ADC converter
Temperature(in C) Output from LM35(in Digital
mV) Output(ADC)

19 320 00010011

21 340 00010101

22 350 00010110

24 370 00011000

25 380 00011001

27 400 00011011

Hence we can see that in 27 C D1 and D3 output is one


for the first time. Hence we use output of these pins and
connect it to and gate 7408 and the final output of and
gate to pin P1.2 of the microcontroller.
Chapter 5:
Future scope of the
project
1.It is automation of the household activity
which may include centralized control of
lighting, HVAC (heating, ventilation and air
conditioning), appliances, and other
systems, to provide improved convenience,
comfort, energy efficiency and security.
2.Devices may be connected through
a computer network to allow control by
a personal computer, and may allow
remote access from the internet.
3.Wireless systems are commonly installed
for the purpose as they reduce wiring
changes.
4.With the invention of microcontroller, the
cost of electronic control fell rapidly. Also it
easy to program these programmable
systems.
5.Automatic washing machines were
developed to reduce the manual labor of
cleaning clothes, and water heater reduced
the labor necessary for bathing.
6.Setting the air conditioning to an energy
saving setting when the house is
unoccupied, and restoring the normal
setting when an occupant is about to
return.
7.Smoke detector when detects a fire or
smoke condition, then all lights in the house
will blink to alert any occupants of the
house to the possible fire.
Bibliography

1.THE 8051 MICROCONTROLLER AND


EMBEDDED SYSTEMS by Mazidi and Mazidi
2.DIGITAL CIRCUIT AND DESIGN by S
Salivahanan
3.www.Engineersgarage.com
4.www.8051projects.com

You might also like