Beruflich Dokumente
Kultur Dokumente
SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE AWARD OF DEGREE OF BACHELOR OF TECHNOLOGY IN ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted By: Ashwani Kumar Saxena (07614802810) Rishabh Chopra(05696402810) Rohit Gupta(07514802810)
Certificate
This is to certify that the Minor Project Report (ETEC 459) entitled Environment Monitoring System done by team comprising of Ashwani Kumar Saxena (07614802810), Rishabh Chopra (05696402810) and Rohit Gupta (07514802810) is an authentic work carried out by them under my guidance. The matter embodied in this minor project work has not been submitted earlier for the award of any degree or diploma to the best of my knowledge and belief.
Date:
ACKNOWLEDGEMENT
We would like to articulate our profound gratitude and indebtedness to our project guide Mr. B. K. Singh, who has always been a constant motivation and guiding factor throughout the project time in and out as well. It has been a great pleasure for us to get an opportunity to work under him and complete the project successfully. We wish to extend our sincere thanks to Prof. R S Gupta, Head of Department, for approving our project work with great interest. An undertaking of this nature could never have been attempted with our reference to and inspiration from the works of others whose details are mentioned in references section. We acknowledge our indebtedness to all of them.
Ashwani Kumar Saxena (07514802810) ashwanikumar686868@gmail.com Rishabh Chopra (05696402810) chopra.rishabh22@yahoo.in Rohit Gupta (07514802810) rohitgupta11041993@gmail.com 3
ABSTRACT
Motivation: A comfortable environment can increase the productivity multi-folds. So it is important that the environment variables such as temperature, relative humidity and light intensity are continuously monitored and corresponding systems adjusted to maintain a comfortable working environment.
What We Thought: If a microcontroller based development system is provided with sensors such as Temperature sensor, Humidity sensor and Light dependent resistor to measure the present values of temperature, relative humidity and light intensity respectively; microcontroller can then control the output values sent to various devices such as fans, AC, bulbs, tube lights. In this way, all these controlled devices will work collectively to bring the environment to our comfort level.
Goal: The goal of this work is to develop an environment monitoring system that senses these parameters and performs various functions such as showing the present values on LCD screen, analog and digital controlling of various devices.
CONTENTS
Certificate Acknowledgement Abstract List of figures List of tables Chapter 1. Introduction 1.1 What do we want to change? 1.2 Basic Details 1.3 Advantages 1.4 Applications Chapter 2. Components Used 2.1 Microcontroller 2.2 Sensors 2.2.1 Temperature sensor 2.2.2 Light sensor 2.2.3 Humidity sensor 2.3 LED dot matrix 2.4 LCD 2.5 Relay Chapter 3. Hardware Interfacing 3.1 Detailed Block Diagram 3.2 Components controlled by sensors 3.3 Circuit diagram 3.4 Components details Chapter 4. Source Code Chapter 5. Outputs Catalogue 5.1 Light parameter output 5.2 Temperature parameter output 5.3 Humidity parameter output Conclusion References 2 3 4 6 7 8 8 9 10 10 12 12 16 16 17 18 19 20 22 24 24 25 26 27 28 32 32 36 38 39 40
LIST OF FIGURES
FIGURE NO. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
PAGE NO. 8 8 9 10 10 11 11 13 13 16 16 16 17 17 17 18 18 19 20 21 22 22 23 24
26 32 32 32 33 33 33 34 34 34 35 35 35 36 36 37 37 38 38
DETAILS Fan and its regulator Lights in a room Block diagram Intelligent homes Industries Remote areas Cool cabin-Google Pin diagram of Atmega16 Atmega16 architecture Thermocouple vs thermistor vs I.C. sensor LM 35 LM 35 pin out Photoresistor symbol NORP12 Circuit diagram of NORP12 SY-HS-220 SY-HS-220 characteristics LED dot matrix LCD pin out Generating character code Block diagram of relay Relay ON Relay OFF Detailed block diagram Circuit diagram LCD showing SUNLIGHT 2*2 display on LED dot matrix Bulb OFF LCD showing BRIGHT 4*4 display on LED dot matrix Bulb OFF LCD showing DIM 6*6 display on LED dot matrix Bulb ON LCD showing DARK 8*8 display on LED dot matrix Bulb ON LCD showing 24oC temperature Fan OFF LCD showing 28oC temperature Fan ON LCD showing 30% relative humidity LCD showing 70% relative humidity 6
LIST OF TABLES
TABLE NO. 1 2
3
PAGE NO. 12 25
27
Chapter 1. INTRODUCTION
What Do We Want To Change?
Fig.2 Lights in a room What if all these lights know when to get lightened up themselves!
Basic Details:
The environment monitoring system consists of a microcontroller, few sensors and controlled devices. Sensors include Light sensor Temperature sensor Humidity sensor
LCD display will continuously display the current values of environment variables.
Fig.3
Advantages:
Power consumption by controlled devices is optimum. Removes the need of constant manual monitoring. Makes the process computerized thus reducing the probability of errors. Beneficial for monitoring remote areas.
Applications:
1. Intelligent Homes
Fig.4 A home where when you enter lights lighten up themselves, fans will start rotating, if its hot, fans will themselves rotate faster, if its humid, AC will itself take the charge is what everybody want. And advancements done to this project can lead to all this.
2. Hazardous Industries
Fig.5 No one will like to enter a laboratory where nuclear reaction is going on or some exothermic reaction is going on. Our system can help in maintaining the optimum environment in all such areas.
10
Fig.6 If you are at your base office and you need to maintain the environment in your plant in some remote area, what else can you think of except our system that can itself maintain the environment and can let you decide the environment to be maintained.
Fig.7 A good company is not where you can see everyone busy at his table with some file, a good company is where they all can talk, enjoy and when they will work for just an hour with a better understanding and satisfaction, they can give what those busy people cant in whole day!
11
8KB 8KB
1KB 1KB
19 19 21 21 21 21 Table 1
0-16 MHz 0-8 MHz 0-16 MHz 0-8 MHz 0-16 MHz 0-8 MHz
28 28 40 40 40 40
16KB 1KB
12
Atmega16 Microcontroller:
Figure 9
13
I/O Ports Atmega16 has four (PORTA, PORTB, PORTC and PORTD) 8-bit input-output ports. Internal Calibrated Oscillator o Atmega16 is equipped with an internal oscillator for driving its clock. o By default Atmega16 is set to operate at internal calibrated oscillator of 1 MHz. o The maximum frequency of internal oscillator is 8MHz. o Alternatively, ATmega16 can be operated using an external crystal oscillator with a maximum frequency of 16MHz. In this case, we need to modify the fuse bits. ADC Interface o Atmega16 is equipped with an 8 channel ADC (Analog to Digital Converter). o ADC reads the analog input for e.g., a sensor input and converts it into digital information which is understandable by the microcontroller. Timers/Counters o Atmega16 consists of two 8-bit and one 16-bit timer/counter. o Timers are useful for generating precision actions for e.g., creating time delays between two operations. Watchdog Timer Watchdog timer is present with internal oscillator. Watchdog timer continuously monitors and resets the controller if the code gets stuck at any execution action for more than a defined time interval. Interrupts Atmega16 consists of 21 interrupt sources out of which four are external. The remaining are internal interrupts which support the peripherals like USART, ADC, timers etc. USART It is available for interfacing with external device capable of communicating serially (data transmission bit by bit). Memory: Atmega16 consist of three different memory sections: 1. Flash EEPROM: o Flash EEPROM or simple flash memory is used to store the program dumped or burnt by the user on to the microcontroller. o It can be easily erased electrically as a single unit.
14
o Flash memory is non-volatile i.e., it retains the program even if the power is cut-off. o Atmega16 is available with 16KB of in system programmable Flash EEPROM. 2. Byte Addressable EEPROM: o This is also a non volatile memory used to store data like values of certain variables. o Atmega16 has 512 bytes of EEPROM, this memory can be useful for storing the lock code if we are designing an application like electronic door lock. 3. RAM: o Random Access Memory, this is the volatile memory of microcontroller i.e., data is lost as soon as power is turned off. o Atmega16 is equipped with 1KB of internal RAM. o A small portion of RAM is set aside for general purpose registers used by CPU and some for the peripheral subsystems of the microcontroller. ISP AVR family of controllers have In System Programmable Flash Memory which can be programmed without removing the IC from the circuit, ISP allows to reprogram the controller while it is in the application circuit. SPI (Serial Peripheral Interface) SPI port is used for serial communication between two devices on a common clock source. The data transmission rate of SPI is more than that of USART. TWI (Two Wire Interface) can be used to set up a network of devices, many devices can be connected over TWI interface forming a network, the devices can simultaneously transmit and receive and have their own unique address. DAC Atmega16 is also equipped with a Digital to Analog Converter (DAC) interface which can be used for reverse action performed by DAC. DAC can be used when there is a need of converting a digital signal to analog signal.
15
SENSORS
1. Temperature Sensor
What Is Integrated Circuit Temperature Sensor? A two/three terminal integrated circuit temperature transducer that produces an output current/voltage proportional to absolute temperature in Kelvin or Centigrade. Why it is preferred over thermistors and thermocouples? Linearity Low cost No additional circuit required
Figure 10
Figure 11
Figure 12
They use the fact as temperature increases, the voltage across a diode increases at a known rate. Technically, this is actually the voltage drop between the base and emitter Vbe of a transistor. Voltage at pin in mV = (reading from ADC) *(5000/1024) Centigrade temperature = (analog voltage in mV) / 2 The temperature Sensor is interfaced to the microcontroller as analog sensor. 16
FEATURES: calibrated directly in Celsius Linear scale +10 mV/C 0.5C accuracy Temperature range -55 to 150 C
2. Light Sensor
A photoresistor or light dependent resistor (LDR) is a resistor whose resistance decreases with increasing incident light intensity. A photoresistor is made of a high resistance semiconductor. If light falling on the device is of high enough frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electron (and its hole partner) conduct electricity, thereby lowering resistance.
Figure 13
Figure 14
Figure 15
It has a high resistance in the dark, and a low resistance in the light. LDR response is not linear, in general there is a larger resistance change at brighter light levels. FEATURES o linear resistance variation o temperature range -60C to 75C o cheap
17
3. Humidity Sensor
Humidity is the presence of water in air. The amount of water vapor in air can affect human comfort as well as many manufacturing processes in industries. Humidity sensor converts relative humidity to corresponding voltage. Relative humidity is ratio of actual vapor pressure to saturated vapor pressure expressed in %. Substance used possesses the property of hygroscopy i.e. ability of a substance to attract and hold water molecules from the surrounding environment.
Figure 16 FEATURES Accuracy + 5% Humidity range : 30 to 90 % Temperature range : -30 to 85 C in-built driver circuit
Figure 17
18
Figure 18 It is a matrix of LEDs. All the anode terminals of a row LEDs are connected together and taken out as 1 pin. Similarly, all cathodes of a column LEDs are connected together and taken out as 1 pin. In case of a 8X8 LED dot matrix, we have 8 pins for the 8 rows and 8 pins for 8 columns. There are 64 LEDs in this matrix. We use one PORT for controlling the rows and one PORT for controlling the columns. For selecting a row we give 1 to that row and the rest rows are passed 0. Similarly, for selecting a column we give 0 the corresponding pin and the rest columns are passed 1. Thus, if we want to glow the LED in 2nd row and 5th column, we write: PORTB=0b00000010; PORTC=0b11101111; //for rows //for columns
19
Figure 19
20
Figure 20 int main() { // configure the LCD LCD_cmd(0x40); /* bringing the cursor to the initial CGRAM address to store the character. The character codes are being passed one by one after this. The cursor gets incremented automatically.*/ LCD_write(0x00); LCD_write(0x04); LCD_write(0x0e); LCD_write(0x0e); LCD_write(0x0e); LCD_write(0x1f); LCD_write(0x04); LCD_write(0x00); LCD_cmd(0x80); /* bringing the cursor back to the DDRAM address for printing the character.*/ LCD_write(0); return 0; }
21
RELAY
Relay is used to connect bulb and fan. Relay is a type of switch which is connected/ operated in one circuit and they control the flow of current in other circuit. In other words, they allow a small current flow circuit to control a higher current circuit.
Figure 21
Relay Design:
All relays operate using the same basic principle. Relays have two circuits: o A control circuit (shown in GREEN) o A load circuit (shown in RED). The control circuit has a small control coil while the load circuit has a switch. The coil controls the operation of the switch.
Relay Operation:
When no voltage is applied to pin 1, there is no current flow through the coil. No current means no magnetic field is developed, and the switch is open. When voltage is supplied to pin 1, current flow though the coil creates the magnetic field needed to close the switch allowing continuity between pins 2 and 4.
Figure 22 22
Figure 23
Relay Connection:
Relays are magnetized when a proper voltages and proper current is applied to it. For providing these IC ULN2803 is used. The microcontroller pins are declared as output. These pins are connected to ULN input pins. ULN outputs are then used to drive relays.
23
Figure 24
24
INPUTS
OUTPUTS
LCD
LM 35 Temperature Sensor
Fan
LCD
LCD
25
26
27
fourbit_cmd(0xca); LCD_str("C"); fourbit_cmd(0xcb); _delay_ms(1000); LCD_clr(); //code to display humidity on LCD fourbit_cmd(0x80); LCD_str("HUMIDITY"); fourbit_cmd(0xc8); LCD_num(humidity); _delay_ms(1000); LCD_clr(); if(light>850 && light<1023)//if outside its too much bright { fourbit_cmd(0x80); LCD_str("LIGHT INTENSITY"); fourbit_cmd(0xc4); LCD_str("SUNLIGHT "); _delay_ms(2000); LCD_clr(); //code for LED DOT MATRIX PORTB=0b00011000; PORTC=0b11100111; //if temperature >26, switch on the fan at pin 1 if(temperature>26)//temperature { PORTA=0b00000010; goto l1; } else { PORTA=0b00000000; goto l1; } _delay_ms(100); } else if(light>450 && light<850) { fourbit_cmd(0x80); LCD_str("LIGHT INTENSITY"); fourbit_cmd(0xc4); LCD_str("BRIIGHT "); _delay_ms(2000); LCD_clr(); PORTB=0b00111100; PORTC=0b11000011; if(temperature>26) { 29
PORTA=0b00000010; goto l1; } else { PORTA=0b00000000; goto l1; } _delay_ms(100); } else if(light>350 && light<450) { fourbit_cmd(0x80); LCD_str("LIGHT INTENSITY"); fourbit_cmd(0xc6); LCD_str("DIM "); _delay_ms(2000); LCD_clr(); PORTB=0b01111110; PORTC=0b10000001; //as light intensity is dim, bulb is also glown at pin 2 if(temperature>26) { PORTA=0b00000110; goto l1; } //for bulb else { PORTA=0b00000100; goto l1; } _delay_ms(100); } else if(light>250 && light<350) { fourbit_cmd(0x80); LCD_str("LIGHT INTENSITY"); fourbit_cmd(0xc6); LCD_str("DARK "); _delay_ms(2000); LCD_clr(); PORTB=0xff; PORTC=0x00; //as light intensity is dark, bulb is also glown at pin 2 if(temperature>26) { PORTA=0b00000110; goto l1; 30
} else {
//for bulb
31
32
1.b. Case 2
33
1.c. Case 3
34
1.4. Case 4
35
36
2.b. Case 2
37
3.b. Case 2
38
39
REFERENCES
1. Design and Implementation of Environmental Monitoring System in Intelligent System in Intelligent Home Hong, Wu & Wang, IEEE 2. Embedded C Programming and the Atmel AVR, Richard H Barnett 3. Datasheets by i3indya Technologies 4. www.atmel.in/Images/doc2466.pdf 5. www.ti.com/lit/ds/symlink/lm35.pdf 6. www.alldatasheet.com/datasheet-pdf/pdf/124418/ETC1/NORP-12.html 7. www.alldatasheet.com/datasheet-pdf/pdf/184066/.../SY-HS-230.html 8. http://embedded-lab.com/?p=2478 9. https://www.sparkfun.com/datasheets/LCD/ADM1602K-NSA-FBS-3.3v.pdf 10. en.wikipedia.org/wiki/Relay 11. http://www.labcenter.com/index.cfm
40