Professional Documents
Culture Documents
Home Automation System Based On PLC
Home Automation System Based On PLC
Home Automation System Based On PLC
MEKELLE UNIVERSITY
Page 1
MEKELLE UNIVERSITY
Page 2
1.4. Scope of the project 1. Create for an old man to make their lives simple and easy. Also we aimed this project to disable person that hard to manually switch on the function of electronic and electric part at the room or house. 2. Reduce our energy and time usages because microcontroller makes automation for this project application. 3. Lastly, this project provided the security signal when the emergency cases happened like the room or house is on fire. This project can be placed to many part of area (room or house). For example: 1) Hospital 2) Office 3) House 4) Lab
MEKELLE UNIVERSITY
Page 3
CHAPTER TWO
LITERATURE REVIEW
MEKELLE UNIVERSITY
Page 4
Early people were, at first, fire tenders, maintaining fires originally started by natural causes. Later, they learned how to make fire and became fire makers. Eventually, they became fire managers as they learned to work with fire to gain the heat needed to boil water, cook meat, fire pottery (500F or 257C ), work with copper, tin, bronze (an alloy of copper and tin) and iron, and to make glass. Although they had no quantitative measuring devices to determine how hot a fire was, they developed recipes for building different types of fires and probably used a physical indicator, such as some mineral or metal melting, to indicate the correct temperature for a particular process. The ancient Greeks knew that air expanded when heated and applied the principle mechanically, but they developed no means of measuring temperature or amount of heat needed and devised no measuring instruments.Snow and again, when heated with a candle. The space on the column, between these two points was then divided into 110 equal parts. The Italian scientist Galileo (1564-1642) is one of the first recorded to attempt to measure temperature in 1592. His measuring device consisted of a bulb of air, which, when heated, forced liquid (water or spirits of wine [alcohol]) down a column immersed in an open container of the liquid (see Figure 2.1). In about 1611, the thermometer was calibrated by Sanctorius Sanctorius, a colleague of Galileo, who noted the liquid level when the bulb was cooled with melting.
MEKELLE UNIVERSITY
Page 5
Jean Rey (1582-1645), a French physician, invented the first liquid thermometer in 1632. His thermometer consisted of a flask with a long slender neck partially filled with water (see Figure 2). As the temperature changed, the liquid level would rise or fall in response. Unfortunately, it was later realized that these early thermometers were affected by changes in atmospheric pressure. Sealed, liquid in glass thermometers were first made in about 1644. Of the various liquids used, such as water, alcohol, and mercury, alcohol was preferred since is showed the greatest expansion in response to increases in temperature
By the early 18th century, as many as 35 different temperature scales had been devised. In 1714, Daniel Gabriel Fahrenheit invented both the mercury and the alcohol thermometer. Fahrenheit's mercury thermometer consists of a capillary tube which after being filled with mercury is heated to expand the mercury and expel the air from the tube. The tube is then sealed, leaving the mercury free to expand and contract with temperature changes. Although the mercury thermometer is not as sensitive as the air thermometer, by being sealed it is not affected by the atmospheric pressure. Mercury freezes at -39 Celsius, so it cannot be used to measure temperature below this point. Alcohol, on the other hand, freezes at -113 Celsius, allowing much lower temperatures to be measured.
MEKELLE UNIVERSITY ELECTRICAL AND COMPUTER ENGINERING Page 6
Later in the 18th century, Anders Celsius realized that it would be advantageous to use more common calibration references and to divide the scale into 100 increments instead of 96. He chose to use one hundred degrees as the freezing point and zero degrees as the boiling point of water. Sensibly the scale was later reversed and the Centigrade scale was born. See Olof Beckman's short History of the Celsius Temperature Scale. The late 19th century saw the introduction of bimetallic temperature sensor. These thermometers contain no liquid but operate on the principle of unequal expansion between two metals. Since different metals expand at different rates, one metal that is bonded to another, will bend in one direction when heated and will bend in the opposite direction when cooled (hence the term Bimetallic Thermometer or BiMets). This bending motion is transmitted, by a suitable mechanical linkage, to a pointer that moves across a calibrated scale. Although not as accurate as liquid in glass thermometers, BiMets are more hardly, easy to read and have a wider span, making them ideal for many industrial applications. The 20th century also saw the refinement of the temperature scale. Temperatures can now be measured to within about 0.001C over a wide range, although it is not a simple task. The most recent change occurred with the updating of the International Temperature Scale in 1990 to the International Temperature Scale of 1990 (ITS-90). This document also covers the recent history of temperature standards. LM 35 sensor can work as thermometer. It is the precision temperature sensor with output linearly proportional to the Celsius (Centigrade) temperature. It also operates in single supply and draws only 60 microampere current. Its self-heating is as low as 0.1 degree at still air. LM 35 is rated to operate between -55 to +150 Degree Celsius. LM 35C operates between 40 to +110 Degree Celsius. Supply voltage required for LM 35 ranges between 4 to 30 Volts DC. Nowadays, we are using the manual speed controlling of fan. Unlike air conditioners, fans only move air. They do not directly change its speed refer to current state of temperature. We know the used of potentiometer here as the main component to put the speed by level but we need to change the speed manually by push the switch button.
MEKELLE UNIVERSITY ELECTRICAL AND COMPUTER ENGINERING Page 7
What is potentiometer? A potentiometer is a three-terminal resistor with a sliding contact that forms an adjustable voltage divider. If only two terminals are used (one side and the wiper), it acts as a variable resistor or rheostat. Potentiometers are commonly used to control electrical devices. Other than that, we know that our computers using the fan as the cooling system to protect the Central Processing Unit from getting overheat. Fan will control automatically and adjusts the fan speed depending on the temperature of the CPU. If it isn't properly cooled, the CPU will overheat and become permanently damaged. Standard fan control settings simply set the fan to run at a constant speed all the times that the computer is on. This normally involves setting a minimum and maximum fan speed, as well as a high and low CPU temperature. At the low temperature, the fan will start running at the minimum fan speed. The fan speed will vary in line with the CPU temperature until it reaches the high CPU temperature.
MEKELLE UNIVERSITY
Page 8
CHAPTER THREE
CONFORT ROOM WITH TEMPRETURE CONTROL BASED ON MICROCONROLLER
This part is about the methodology which means to elaborate of how the project can be implemented on a few requirements. There are flow charts and project block diagram with complete explanations, hardware and software development and project planning. To complete this task we need to make the research of every method used and understand those things to prevent the mistake and make the project run smoothly. There are important parts of hardware and software used to move the project to be functioned.We are using Microcontroller as the main brain of the project. This Microcontroller has many functions to work the application automatically, just put the simple program then all can run smoothly. All of these important components were explained in this chapter.
MEKELLE UNIVERSITY
Page 9
The block diagram from the figure 3.1 and 3.2 show the complete part of hardware used to project. The circuit starts working when the AC supply is turned on. Then the supply change from AC to DC by using the adapter. DC supply 12 volt was connected to the IC regulator circuit to produce 5 volt stable voltage. Then the sensor LM 35 start to function as the component to measure the changes of temperature surrounds the area. All the application were controlled by the PIC 16F877A to produce the output. We can put the PIC as a brain of the circuit. It is because that all functions in this block diagram are depending on this component. LCD, fan and buzzer are the output that should be set with the program of PIC. LCD used to measure and show the changes of temperature value. The fans start to function when the switch is turned on and the speed is up depending on current temperature. High value of temperature will caused high speed of fan. Then the buzzer only shows the emergency situation if the temperature reached unusual situation temperature.
MEKELLE UNIVERSITY
Page 10
Figure 3.3: Flow chart of room temperature control based on PIC The flow chart starts to function when the switch is turn on. The supply voltage flow to the circuit and make all the circuit including PIC to work on all application there. Level 1 (normal mode) of fan starts to function after that. If the temperature reached more than 30celcius the fan automatically change the speed to level 2. The speed of fans become more faster. The speed will change back to normal mode if the temperatures reduce. So, we add the application to show more secure and show an emergency case to give the signal if any bad cases happened.
MEKELLE UNIVERSITY
Page 11
The buzzer will function if the temperature more than 40C (to make an easier for our demonstration, we put the emergency temperature only 40 C). All of applications here are working automatically with the use of microcontroller.
The 16F877A is one of the most popular PIC microcontrollers. It comes in a 40 pin DIP pin out and it has many internal peripherals. The 40 pins make it easier to use the peripherals as the functions are spread out over the pins. This makes it easier to decide what external devices to attach without worrying too much if there enough pins to do the job. One of the main advantages is that each pin is only shared between two or three functions so its easier to decide what the pin function (other devices have up to 5 functions for a pin).
MEKELLE UNIVERSITY
Page 12
A disadvantage of the device is that it has no internal oscillator so you will need an external crystal of other clock source. The microcontroller PIC16F877A is connected to the peripheral and internal components. As shown in the figure 3.5.
PIC PIC microcontroller feature description Feature Flash memory RAM EEPROM
MEKELLE UNIVERSITY
microcontroller
Re-programmable program storage. Memory storage for variables. Long term stable memory: Electrically
ELECTRICAL AND COMPUTER ENGINERING Page 13
Read
High current Input Output ports (with pin direction change). Built in RS232 protocol (only needs level translator chip). Capture/Compare/PWM module. I2C and SPI Interfaces. An analogue comparator and internal voltage reference. Analogue to digital converter. Parallel Slave Port microprocessor systems). LCD interface. Simple programming using In Circuit Serial Programming. (for 8 bit
Table 3.1 Feature of PIC16F877A microcontroller Programing is one of the most useful features of a PIC microcontroller is that you can reprogram them as they use flash memory (if you choose a part with an F in the part number e.g. 12F675 not 12C509). Input/output PIC Microcontroller can control outputs and react to inputs.
It is the precision temperature sensor with output linearly proportional to the Celsius (Centigrade) temperature. It operates in single supply and draws only 60 uA current. Its selfheating is as low as 0.1 degree at still air. LM 35 is rated to operate between -55 to +150 Degree Celsius. LM 35C operates between -40 to +110 Degree Celsius. Supply voltage required for LM 35 ranges between 4 to 30 Voltages.
Figure 3.7: LCD temperature Display LCD is an electronically-modulated optical device shaped into a thin, flat panel made up of any number of color or monochrome pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector.This LCD is good to demonstrate and do measurement from the temperature sensor. It can show the changes of value from the sensor clearly. Also this LCD is cheaper than the others. Here the specification of LM 016L LCD MODULE, A/N 16X2 No. of Digits / Alpha:32 Character Count x Line:16 x 2 Supply Voltage:5V Display Area Width:61mm Display Area Height:15.8mm Operating Temperature Range:0C to +50C External Depth:15mm External Length / Height:44mm External Width:84mm Operating Temperature Max:50C Operating Temperature Min:0C
MEKELLE UNIVERSITY
Page 15
Figure 3.8: LM 7805 of voltage regulator IC LM7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed
linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give the fixed voltage output.The voltage regulator IC maintains the output voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides +5V regulated power supply. Capacitors of suitable values can be connected at input and output pins depending upon the respective voltage levels.
We are using C compiler to create the program and run the compilation to get zero error. Produce a range of compilers that cover all 8 bit PICs (PIC10, PIC12, PIC14, PIC16, and PIC18) and a few of the higher spec chips (PIC24 and dsPIC). Although there were a lot of languages that can be used for the programming, but internally the computer only understand two numerical values which are 0 and 1 that were also known as the binary number. The interesting about the C languages is it is easy to understand the programming compared to Assembly languages or other languages.
3.3.2 Multism
Multism is an electronic schematic capture and simulation program which is part of a suite of circuit design programs, along with NI Ultiboard. Multisim is one of the few circuit design programs to employ the original Berkeley SPICE based software simulation. Multisim was originally created by a company named Electronics Workbench, which is now a division of National Instruments. Multisim includes microcontroller simulation (formerly known as MultiMCU), as well as integrated import and export features to the Printed Circuit Board layout software in the suite, Ultiboard. Multisim is widely used in academia and industry for circuits education, electronic schematic design and SPICE simulation.
MEKELLE UNIVERSITY
Page 17
MEKELLE UNIVERSITY
Page 18
CHAPTER FOUR
RESULT AND ANALYSIS This chapter contains the result of fan speed and buzzer. All the system controlled by microcontroller and temperature sensor to make it work automatically. It consists of the hardware and software development as mentioned in the methodology of chapter 3. Upon the completion of hardware construction and programming process, the project is needed to be tested to confirm of its function success. The tests are divided into certain parts. The parts are voltage regulator supply, microcontroller, sensor temperature, PWM motor circuit and programming.
4.1. Results
Referring to above table, the slow level mean the speed of fan is on normal state. The fan will function when the switch is turned on. If the temperature reached above 30C the speed will change automatically to level 2 and will change to level 3 if more than 40C.
MEKELLE UNIVERSITY
Page 19
Figure 4.1: Complete Circuit without PWM Circuit of room temperature control
MEKELLE UNIVERSITY
Page 20
Figure 4.3: Regulator Circuit (12v and 5v) The AC supply is already converted by the adapter to give 12V input in this circuit. The function of this circuit is to produce the 5volts of VCC. Both of the voltages (12volt and 5volt) were used in this project. Both of output voltages were connected to all circuit and give the supply to function all of it. From here, it is easier to make the connection.
MEKELLE UNIVERSITY
Page 21
Figure 4.5: Sketch of PWM Motor Circuit PWM Motor circuit above used to move the fan with microcontroller programming. The speed can be adjusted refer to the duty percentages. The MOSFET component was function as the speed controller to control all the level of duty (speed of fan). The duty programming was set in the PIC.
Figure 4.6: LM 35 sensor and LCD Interfacing LCD will display and measure the current of temperature in the room. Above picture show the designation of the LCD and LM 35 sensor interfaced with PIC.
MEKELLE UNIVERSITY
Page 22
The LM 35 will detect the temperature and every part of rising temperature will state on the display. The speed of fan will change refer to the specification we state in PIC programming.
MEKELLE UNIVERSITY
Page 23
CHAPTER FIVE
CONCLUSION 5.1 Project Conclusion Everybody dream to live with easier life and put some secure awareness among themself. This project make the wish come true to stay the life more comfortable. There are many application of Smart Room. But this project only to show the uses of temperature in our lives and make development of it. So if we understand more about temperature, we know how to manage the situation and also can reduce the time and energy we use every day like switch on the fan manually and never alert of the accident happened in the rooms or house. All the circuit and application of it were done greatly. The temperature can be measure and read from the display. This project also gives the information about current temperature. So we will be more knowledgeable and self-awareness. We will have more self-motivated to work harder to reduce the current problem temperature in our world, and then will save our green life to live in peaceful and harmony situation.
The main important thing of research and development is a cost, especially for electronics components of relates to this project. Hard to create many application because some of the component are not sell in here. Need to order from other country.
MEKELLE UNIVERSITY
Page 24
5.3 Future Project Recommendation A series of enhancement, modification and upgrading have been carried out to produce better performance for the future enhancement. Below is some suggestion from our research to upgrading this project: Make the circuit more compact and smaller. Easy to keep and place it to our house. Produce the system for user where the system can send the SMS directly the status of security level in house to them. Controlling the room application using computer. Use Visual Basic software that can control all operation for example just clicking the mouse then can open the light or fan. Add more applications like solar and also make an improvement of the circuit. Make it more compact and easy to keep it. Produce a backup system like using a generator or battery as a support supply. So if blackout happened the system still can run properly.
MEKELLE UNIVERSITY
Page 25
REFERENCES BOOKS 1. Renato Nuns, Jos Delgado, "An Architecture for a Home Automation System", ICECS '98 International Conference on Electronics, Circuits and Systems, September 1998, pp.259 262. 2. Muhammad Ali Maizidi,The 8051 microcontroller & Embeded Systems 3. Thedore F Bogart, Jr. Electric Circuits PIC GUIDE INTERNET WEBSITE 1. www.alldatasheet.com/datasheet-pdf/pdf/.../PIC16F87X.html 2. http://ezinearticles.com/?Home-Security-History&id=2129354 3. http://www.facstaff.bucknell.edu/mastascu/eLessonsHTML/Sensors/TempLM35.html
MEKELLE UNIVERSITY
Page 26
To control the PIC, we need the programs to control all the circuit. Here the result of it: /* this a project c programming for microcontroller based temperature control system */ /* Mekelle university _EIT-M_ Electrical & Computer Engineering*/ #include<16F877A.h> #fuses HS,NOLVP,NOWDT #use delay(clock=20000000)
#include<lcd.c>
Void main () { float mytemp; setup_port_a (RA0_ANALOG); setup_adc(ADC_CLOCK_INTERNAL); set_adc_channel(0); setup_ccp1(CCP_PWM); // Configure CCP1 as a PWM // 500 Hz
setup_timer_2(T2_DIV_BY_16, 500, 2); //starting mode// lcd_init(); lcd_putc("\fTemperature"); printf (lcd_putc); delay_ms(3000);
MEKELLE UNIVERSITY
Page 27
lcd_init();
while(true) { delay_ms(800); mytemp=(read_adc()*(5.0/254))*100; lcd_gotoxy(1,1); printf(lcd_putc, "Temp Now:%f\n ", mytemp); output_low(pin_B5); output_high(pin_B7); if(mytemp<=35.0) { set_pwm1_duty(1000); } if(mytemp<30.0) { set_pwm1_duty(200); } if(mytemp>=40.0) { output_high(pin_B5); set_pwm1_duty(1000); }
MEKELLE UNIVERSITY ELECTRICAL AND COMPUTER ENGINERING Page 28
} }
MEKELLE UNIVERSITY
Page 29
PIC16F87X Data Sheet 28/40-Pin 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: PIC16F877 Microcontroller Core Features: High performance RISC CPU Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle Up to 8K x 14 words of FLASH Program Memory, Up to 368 x 8 bytes of Data Memory (RAM) Up to 256 x 8 bytes of EEPROM Data Memory
MEKELLE UNIVERSITY ELECTRICAL AND COMPUTER ENGINERING Page 30
Pinout compatible to the PIC16C73B/74B/76/77 Interrupt capability (up to 14 sources) Eight level deep hardware stack Direct, indirect and relative addressing modes Power-on Reset (POR) Power-up Timer (PWRT) and Oscillator Start-up Timer (OST) Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation Programmable code protection Single 5V In-Circuit Serial Programming capability Wide operating voltage range: 2.0V to 5.5V High Sink/Source Current: 25 Ma Commercial, Industrial and Extended temperature ranges Low-power consumption: - < 0.6 mA typical @ 3V, 4 MHz - 20 A typical @ 3V, 32 kHz - < 1 A typical standby current
MEKELLE UNIVERSITY
Page 31