CHAPTER 1
INTRODUCTION
Weather, is a state of the atmosphere at a particular time and place. Raining conditions also will be changing with respect to season and place. An automatic retracting roof system is a special kind of roofing system which will be forecasting rain and adjusting the roof. For many houses, restaurant’s, and auditorium and even for stadiums we can design a open roof arrangement for more sunlight and beauty purposes. But there rain will be a problem. This interference of rain can be avoided with our smart roof arrangement.
This roofing system has an ability to monitor weather parameters like humidity and temperature which causes rain. The chances of rain can be determined by observing relative humidity and temperature.
This smart roof system consists of three sensors humidity sensor, temperature sensor, water sensor. These sensors are connected to the ADC (Analog to Digital Converter) and to the microcontroller. The software loaded in the microcontroller receives the input signals from the sensors and compare it with the raining conditions and if chances of rain present it will drive the motors connected.
CHAPTER 2
LITERARY SURVEY
As per the forecasters of rain its told that rain in a place will mainly depend on relative humidity. Factors effecting rain are:
— Relative humidity
— Temperature
— Pressure
— Wind
We can forecast rain at a place with these four factors. And the influence of these factors on rain will be different at different place. So the device we making must be seasonably calibratable with respect to different places. We can make a table of humidity and temperature for which rain may occur for different places. To avoid the occurrence of sudden rain without much influence of humidity and temperature we use a water sensor which can sense the first drop of rain.
Hourly Forecast | 6AM | 12 Noon | 6PM | 12 Midnight |
Temp. | Dew Point | 27 | 25 | 34 | 23 | 30 | 24 | 28 | 27 |
Humidity | 86% | 52% | 69% | 92% |
Chance of Precip. | 40% | 0% | 0% | 40% |
Cloud Cover | 24% | 33% | 30% | 10% |
Conditions | Chance of a Thunderstorm | Partly Cloudy | Partly Cloudy | Chance of a Thunderstorm |
Table 2.1 Sample Survey of Chennai
CHAPTER 3
TEMPERATURE SENSOR |
Fig 3.1 Block diagram |
MICROCONTROLLER 8051 |
MOTOR DRIVER IC |
DC MOTOR |
ADC (ANALOGE TO DIGITAL CONVERTER) |
MULTIPLEXER |
HUMIDITY SENSOR |
WATER SENSOR |
Temperature Sensor: For temperature sensor we are using LM35. Which will monitor the atmospheric temperature with change in temperature voltage will be varied. The LM 35 is a precision integrated-circuit temperature sensor, whose output voltage is linearly proportional to the Celsius (centigrade) temperature.
Humidity Sensor:Humidity is a measure of amount of water vapor or moisture in actually in the air at a certain temperature. At higher temperatures air can hold more humidity. The amount of watervapour in the air varies. The percentage of water vapor in the air compared to what the air can hold at that certain temperature is called the relative humidity.
Water Sensor:This rain detector will give you a heads-up the instant it starts to rain.The rain sensor may be built any number of ways and is simply two conductors that are bridged by the rain water. A simple sensor is shown below. Two conductors of bare copper wire are woven through the holes so that the conductors are near each other but do not come into contact.
Multiplexer IC:The CD4051BC, CD4052BC, and CD4053BC analog multiplexers/demultiplexers are digitally controlled analog switches having low “ON” impedance and very low “OFF” leakage currents. Control of analog signals up to 15Vp-p can be achieved by digital signal amplitudes of 3−15V. For example, if VDD = 5V, VSS = 0V and VEE = −5V, analog signals from −5V to +5V can be controlled by digital inputs of 0−5V..
Analogue Digital Converter:The ADC0804 is CMOS 8-bit successive approximation A/D converters that use a differential potentiometric ladder—similar to the 256R products. These converters are designed to allow operation with the NSC800 and INS8080A derivative control bus with TRI-STATE output latches directly driving the data bus. These A/Ds appear like memory locations or I/O ports to the microprocessor and no interfacing logic is needed.
Microcontroller (AT89S51):The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of In-System Programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the indus-try-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory pro-grammer.
CHAPTER 4
TO MUX CD4051 |
Fig 4.1: Connection Diagram of Microcontroller, ADC & Motor Drive IC |
FROM MUX CD4051 |
TO MICROCONTROLLER |
TO ADC |
Fig 4.1: Circuit Diagram of ADC, Microcontroller &Motor drive IC |
To MICROCONTROLLER |
FROM MUX CD4051 |
Fig 4.3: Sensors connection to MUX |
To ADC |
To MC |
Fig 4.2: Power Supply |
CIRCIUT DIAGRAM DISCRIPTION
4.1 SENSORS
4.1.1 Temperature Sensor (LM 35: Precision Centigrade Temp. Sensor)
TO MUX |
The LM 35 is a precision integrated-circuit temperature sensor, whose output voltage is linearly proportional to the Celsius (centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. It does not require any external calibration or trimming to provide typical accuracies of ±1/4̊C at room temperature and ±3/4̊C over a full -55 to +150̊C temperature range. The output of the LM35 is equal to the atmospheric temperature at its output terminal multiplied by 10 in mV. The output voltage will be amplified using a Low Power
Fig 4.4:Temperature Sensor Circuit
LM358:The LM358 series consists of two independent, high gain, internally frequency compensated operational amplifiers which were designed specifically to operate from a single power supply over a wide range of voltages. Operation from split power supplies is also possible and the low power supply current drain is independent of the magnitude of the power supply voltage.Application areas include transducer amplifiers, dc gain blocks and all the conventional op amp circuits which now can be more easily implemented in single power supply systems. For example, the LM358 series can be directly operated off of the standard +5V power supply voltage which is used in digital systems and will easily provide the required interface electronics without requiring the additional ±15V power supplies.The LM358 and LM2904 are available in a chip sized package(8-Bump micro SMD) using National’s micro SMD packagetechnology.
Unique Characteristics
· In the linear mode the input common-mode voltage range includes ground and the output voltage can also swing to ground, even though operated from only a single power supply voltage.
· The unity gain cross frequency is temperature compensated.
· The input bias current is also temperature compensated.
Advantages
· Two internally compensated op amps
· Eliminates need for dual supplies
· Allows direct sensing near GND and VOUT also goes to GND
· Compatible with all forms of logic
· Power drain suitable for battery operation
Features
· Available in 8-Bump micro SMD chip sized package
· Internally frequency compensated for unity gain
· Large dc voltage gain: 100 dB
· Wide bandwidth (unity gain): 1 MHz (temperature compensated)
· Wide power supply range:
— Single supply: 3V to 32V
— or dual supplies: ±1.5V to ±16V
· Very low supply current drain (500 μA)—essentially independent of supply voltage
· Low input offset voltage: 2 mV
· Input common-mode voltage range includes ground
· Differential input voltage range equal to the power supply voltage
· Large output voltage swing
Fig 4.5:Connection Diagram of LM358
4.1.2Humidity Sensor (SY-HS-220)
This humidity sensor SY-HS-220 can sense the relative humidity in the atmosphere and will convert this humidity into output voltage.Humidity is a measure of amount of water vapour or moisture in actually in the air at a certain temperature. At higher temperatures air can hold more humidity. The amount of watervapour in theair varies. The percentage of water vapor in the air compared to what the air can hold at that certain temperature is called the relative humidity. This can be sensed by this humidity sensor.
Fig 4.6: Humdity Sensor Dimensions
Fig 4.7: Humidity Sensor Chip |
Fig 4.7: Humidity Sensor Chip |
SPECIFICATION
Table 4.1: Specification of Humidity Sensor
STANDARD CHARACTERISTICS
Fig 4.8:Characteristics of Humidity Sensor
4.1.3 Water sensor
This rain detector will give you a heads-up the instant it starts to rain.The rain sensor may be built any number of ways and is simply two conductors that are bridged by the rain water. A simple sensor is shown below. Two conductors of bare copper wire are woven through the holes so that the conductors are near each other but do not come into contact. Notice the holes each conductor uses are staggered so the loops underneath miss each other. Ordinary phone cable is used to connect to the electronics.
With this simple rain detector, the first few drops of rain will sound the alarm allowing you a few precious seconds to roll up windows and bring in possessions. Figure shows a simple rain detector consisting of two strips of aluminum foil glued to a piece of plastic. A single square of foil is glued to the plastic with two lead wires underneath as shown in the figure. The lead wires are striped back so that the foil makes good electrical contact with the conductors but the bare wire should not protrude so that the foil will protect the wire from corrosion.A narrow zigzag gap is cut in the foil to electrically separate the two lead wires. The rain drops bridge the gap causing conduction which is sensed by the circuit.
Fig 4.9:Water Sensor |
Fig 4.9: Water Sensor |
4.2 AnalogMultiplexer
The CD4051BC, CD4052BC, and CD4053BC analog multiplexers/demultiplexers are digitally controlled analog switches having low “ON” impedance and very low “OFF” leakage currents. Control of analog signals up to 15Vp-p can be achieved by digital signal amplitudes of 3−15V. For example, if VDD = 5V, VSS = 0V and VEE = −5V, analog signals from −5V to +5V can be controlled by digital inputs of 0−5V. The multiplexer circuits dissipate extremely low quiescent power over the full VDD−VSS and VDD−VEE supply voltage ranges, independent of the logic state of the control signals. When a logical “1” is present at the inhibit input terminal all channels are “OFF”. CD4051BC is a single 8-channel multiplexer having three binary control inputs. A, B, and C, and an inhibit input. The three binary signals select 1 of 8 channels to be turned “ON” and connect the input to the output. CD4052BC is a differential 4-channel multiplexer having two binary control inputs, A and B, and an inhibit input. The two binary input signals select 1 or 4 pairs of channels to be turned on and connect the differential analog inputs to the differential outputs. CD4053BC is a triple 2-channel multiplexer having three separate digital control inputs, A, B, and C, and an inhibit input. Each control input selects one of a pair of channels which are connected in a single-pole double-throw configuration. Wide range of digital and analog signal levels: digital 3 – 15V, analog to 15Vp-p. Low “ON” resistance: 80Ω (typ.) over entire 15Vp-p signal-input range for VDD − VEE = 15V.
Fig 4.10: Pin Diagram of Multiplexer
4.3 Analog To Digital Converter (ADC0804)
The ADC0804 is CMOS 8-bit successive approximation A/D converters that use a differential potentiometric ladder—similar to the 256R products. These converters are designed to allow operation with the NSC800 and INS8080A derivative control bus with TRI-STATE output latches directly driving the data bus. These A/Ds appear like memory locations or I/O ports to the microprocessor and no interfacing logic is needed. Differential analog voltage inputs allow increasing the common-mode rejection and offsetting the analog zero input voltage value. In addition, the voltage reference input can be adjusted to allow encoding any smaller analog voltage span to the full 8 bits of resolution.
Features
· Compatible with 8080 μP derivatives—no interfacing logic needed - access time - 135 ns
· Easy interface to all microprocessors, or operates “stand alone”n Differential analog voltage inputs
· Logic inputs and outputs meet both MOS and TTL voltage level specifications
· Works with 2.5V (LM336) voltage reference
· On-chip clock generator
· 0V to 5V analog input voltage range with single 5V supply
· No zero adjust required
· 0.3" standard width 20-pin DIP package
· 20-pin molded chip carrier or small outline package
· Operates ratio metrically or with 5 VDC, 2.5 VDC, or analog span adjusted voltage reference
Key Specifications
· Resolution 8 bits
· Total error ±1⁄4 LSB, ±1⁄2 LSB and ±1 LSB
· Conversion time 100 μs
Pin Diagram
Fig 4.11: Pin Diagram of ADC(080ADC)
4.4 MICROCONTROLLER (AT89S51)
The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of In-System Programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the indus-try-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory pro-grammer. By combining a versatile 8-bit CPU with In-System Programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a five-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset. 8-bit Microcontroller with 4K Bytes In-System Programmable Flash AT89S51 2487D
Fig 4.12: Pin Diagram of Microcontroller
Pin Description
1. VCC: Supply voltage.
2. GND: Ground.
3. Port 0:Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification
4. Port 2: Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the inter-nal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s
5. Port 3: Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the inter- Port Pin Alternate Functions P1.5 MOSI (used for In-System Programming) P1.6 MISO (used for In-System Programming) P1.7 SCK (used for In-System Programming)5 2487D–MICRO–6/08 AT89S51 pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S51.
6. RST: Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. The DIS-RTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.
7. ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. PSEN: Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
8. EA/VPP: External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. Port Pin XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
9. XTAL2: Output from the inverting oscillator amplifier
4.5 MOTOR DRIVE IC (L293D )
Fig 4.13 Motor drive IC |
The L293 is designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V. The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both devices are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply applications. All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo- Darlington source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the associated drivers are enabled, and their outputs are active and in phase with their inputs. When the enable input is low, those drivers are disabled, and their outputs are off and in the high-impedance state. With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor applications. On the L293, external high-speed output clamp diodes should be used for inductive transient suppression. A VCC1 terminal, separate from VCC2, is provided for the logic inputs to minimize device power dissipation. The L293and L293D are characterizedfor operation from 0°C to 70°C.
CHAPTER 5
PCB LAYOUT
Fig 5.1: PCB Layout |
CHAPTER 6
NO |
YES |
OPERATE MOTOR TO CLOSE ROOF IF OPENED |
CHECK FOR RAIN |
INITIALISATION OF PORTS AND MEMORY LOCATIONS |
START |
CHECK FOR HUMIDITY>70 77770% |
CHECK FOR TEMPERATURE < 30 DEGREE |
OPERATE MOTOR TO OPEN ROOF if CLOSED |
STOP |
NO |
YES |
YES |
NO |
Fig 6.1: Flow Chart of Program
CHAPTER 7
RESULT & ANALYSIS
A typical smart roof which is automatically retracting using microcontroller AT89S51 was setup. The system will monitor the following parameters like atmospheric temperature, relative humidity, and presence of water drop with the help of three sensors. If any chance of raining condition observed, the roof will be closed with the help of dc motors. And if the raining conditions of the atmosphere are disappeared the roof will be again opened. The voltages obtained for Humidity Sensor for 50%RH is 1.65 V and for 70%RH is 2.31 V.
CHAPTER 8
FUTURE ENHANCEMENT OF THE WORK
Ø This can be used in sports stadiums so that the interrupt of rain in the matches can be avoided.
Ø This can be used to make restaurants open roof for beautification and sunlight.
Ø This can be used to make ‘naalukettu’ houses for more sunlight in the houses.
Ø This can be used to protect gardens and nurseries from heavy rain. As some plants want need direct rainfall.
Ø This can be used to make automobiles open roof.
Ø This system can be implemented for rain water harvesment. The roof of the tank can be opened when rain comes and will be closed we raining finished.
CHAPTER 9
CONCLUSION
A thorough study has been made about microcontroller AT89S51. Using this project atmospheric temperature, relative humidity and rain water presence using the program executed in the microcontroller. This smart roofing system which automatically retract which we done as our mini project is a better development in the field of construction of infrastructures because it has wide application which is relevant in the modern society.
It can be produced in the market in wide range very cheaply. It is very small equipment which can be installed anywhere very easily.By doing this project what we have tried to do is to make just a demo of it. The most difficult part of the project was to calibrate the sensor output. It is done in maximum possible extend. With this we are concluding this mini project
SOURCE CODE
led1 equ p0.0
led2 equ p0.1
rain equ p3.5
mtr1_a equ p2.0
mtr1_b equ p2.1
mtr2_a equ p2.2
mtr2_b equ p2.3
mux1 equ p3.3
mux2 equ p3.4
roof_status equ 00h
org 0000h
start:
mov p0,#0ffh
mov p1,#0ffh
mov p2,#0ffh
mov p3,#0ffh
clr led1
acall delay
setb led1
clr led2
acall delay
mov 30h,#00h
mov 31h,#00h
setb led2
clr mux1
clr mux2
clr roof_status
main_loop:
jb rain,close_roof
setb mux1
acall adc_conv
mov a,p1
mov 31h,a
clr mux1
acall adc_conv
mov a,p1
mov 30h,a
mov a,31h
clr c
subb a,#46h
jc no_humidity
clr led1
sjmp check_temp
no_humidity:
setb led1
sjmp open_roof
check_temp:
mov a,30h
clr c
subb a,#1eh
jnc no_temp
clr led2
sjmp close_roof
no_temp:
setb led2
sjmp open_roof
close_roof:
jb roof_status,main_loop
acall motor_forward
setb roof_status
call delay
call delay
call delay
call delay
sjmp main_loop
open_roof:
jnb roof_status,main_loop
acall motor_reverse
clr roof_status
call delay
call delay
call delay
call delay
sjmp main_loop
motor_forward:
clr mtr1_a
clr mtr2_a
setb mtr1_b
setb mtr2_b
call delay
call delay
call delay
call delay
setb mtr1_a
setb mtr1_b
setb mtr1_b
setb mtr2_b
ret
motor_reverse:
setb mtr1_a
setb mtr2_a
clr mtr1_b
clr mtr2_b
call delay
call delay
call delay
call delay
setb mtr1_a
setb mtr2_a
setb mtr1_b
setb mtr2_b
ret
adc_conv:
clr p3.2
nop
nop
setb p3.2
acall delay_adc
ret
delay: mov r3,#05h
delayc: mov r5,#0ffh
delaya: mov r4,#0ffh
delayb: dec r4
cjne r4,#00h,delayb
dec r5
cjne r5,#00h,delaya
dec r3
cjne r3,#00h,delayc
ret
delay_adc: mov r3,#01h
delay1c: mov r5,#01h
delay1a: mov r4,#0ffh
delay1b: dec r4
cjne r4,#00h,delay1b
dec r5
cjne r5,#00h,delay1a
dec r3
cjne r3,#00h,delay1c
ret
end