Project report on design and fabrication of temperature measurement setup


Published on

Published in: Design, Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Project report on design and fabrication of temperature measurement setup

  1. 1. DESIGN AND FABRICATION OF TEMPERATURE MEASUREMENT SET UP A PROJECT REPORT Submitted by ARUN KUMAR.S (105914144005) RAJESH KUMAR.M (105914144039) RAJSHEKAR.S (105914144040) SEENIVASAGAN.R (105914144047) In partial fulfillment for the award of the degree of BACHELOR OF ENGINEERING IN MECHANICAL ENGINEERING RAJA COLLEGE OF ENGINEERING AND TECHNOLOGY, MADURAI ANNA UNIVERSITY: CHENNAI 600 025 APRIL 2013 ANNA UNIVERSITY: CHENNAI 600 025 BONAFIDE CERTIFICATE Certified that this project report "DESIGN AND FABRICATION OF TEMPERATURE MEASUREMENT SETUP" is the bonafide work of "ARUN KUMAR.S (105914144005), RAJESH KUMAR.M (105914144039), RAJSHEKAR.S (105914144040), and SEENIVASAGAN.R (105914144046)" who carried out the project
  2. 2. work under my supervision. SIGNATURE Prof. P.SUGUMARAN M.E., Ph.d HEAD OF THE DEPARTMENT SIGNATURE T.KATHIRAVAN B.E SUPERVISOR Assistant professor Mechanical Engineering Mechanical Engineering Raja College of Engg&Tech, Raja College of Engg &Tech, Madurai- 625020. Madurai- 625020. Submitted for the project vice-voce held on …………… INTERNAL EXAMINER EXTERNAL EXAMINER ACKNOWLEDGEMENT This project has been successfully completed owing comprehensive endurance of many distinguished persons. First and foremost we would like to thank the almighty, our family members , and friends for encouraging us to do this project. 2
  3. 3. We extend our heartfelt thanks to our beloved Chairman PDG.Lion. G. Nagarajan , M.A and our Principal Dr. S.M. Sekkilar, M.E., Ph.D for their advice and ethics inculcated during the entire period of our study We are extremely indebted to Prof. P. Sugumaran, B.E. (Distn), M.E., Ph.D, The Head Of Department of Mechanical Engineering for the devoted attention, love and affection shown on us in making this project grand success. We profusely thank our internal guide, Mr. T. Kathiravan, B.E., Asst. professor, Mechanical Engineering for his support throughout the project. His suggestions and participative encouragement throughout the project will ever hold a memorable place in our hearts. Finally, we thank one and all for their valuable support in this project work. ABSTRACT This can be used for measuring, controlling and acquisition of the temperatures in the engineering systems. The apparatus is used mainly to observe the source temperature by sensor and to generate graph between temperature and time by using the program in the microcontroller. Graphs can be drawn between a temperature and time. 3
  5. 5. 1.1 Temperature 10 1.2 Temperature control SENSOR 11 2.1 Sensor 12 2.2 Sensor deviation 2. 10 12 2.3 Resistance thermometer 13 2.4 R Vs T relationship of various metals 13 2.5 Element types 15 2.6 Function 15 2.7 Advantages and limitations 16 2.8 Sources of error 17 2.9 RTDs vs thermocouples 17 2.10 Construction 17 2.11 Classifications of RTDs 18 2.12 Applications 18 2.13 History 19 2.14 Pt100 Platinum Resistance Thermometers 3. TEMPERATURE READER (CONTROLLER) 23 3.1 Introduction to Temperature Controllers 3.2 Different Types of Controllers, and How Do They Work? 5 19 24 24
  6. 6. 3.3 SELEC TC303 4. 26 PIC16F877A and RS232 4.1 PIC16F877A 30 4.2 RS232 5. 29 31 GRAPHICAL DISPLAY 37 5.1 Graphical LCD 128*64 38 5.2 Interfacing of PIC16F877A with 128x64 graphical display 6. PROCEDURE 41 6.1 PROCEDURE 42 COST ESTIMATION 42 CONCLUSION 43 LIST OF TABLES TABLE 4.1.1 38 PAGE NO FEATURES OF PIC16F877A 31 TABLE 4.2.1 SIGNALS IN RS232 33 TABLE 4.2.2 PIN ASSIGNMENTS 34 6
  8. 8. FIG 3.3.1 TEMPERATURE READER (CONTROLLER) FIG 4.1.1 PIC16F877A FIG 4.2.1 RS232 cable FIG 5.1.1 28 31 36 Graphical LCD 128*64 38 FIG5.2.1 FIG 6.1 Interfacing of PIC16F877A with 128x64 graphical display 40 BLOCK DIAGRAM OF TEMPERATURE MEASUREMENT SETUP 42 CHAPTER1 8
  9. 9. INTRODUCTION 1.1 Temperature: Temperature is a physical quantity that is a measure of hotness and coldness on a numerical scale. It is a measure of the thermal energy per particle of matter or radiation; it is measured by a thermometer, which may be calibrated in any of various temperature scales: Celsius, Fahrenheit, Kelvin, etc. Temperature is an intensive property, which means it is independent of the amount of material present; in contrast to energy, an extensive property, which is proportional to the amount of material in the 9
  10. 10. system. For example a spark may well be (very briefly!) as hot as the Sun. Empirically it is found that an isolated system, one that exchanges no energy or material with its environment, tends to a spatially uniform temperature as time passes. When a path permeable only to heat is open between two bodies, energy always transfers spontaneously as heat from a hotter body to a colder one. The transfer rate depends on the thermal conductivity of the path or boundary between them. Between two bodies with the same temperature no heat flows. These bodies are said to be in thermal equilibrium. In kinetic theory and in statistical mechanics, temperature is the effect of the thermal energy arising from the motion of microscopic particles such as atoms, molecules and photons. The relation is proportional as given by the Boltzmann constant. 1.2 Temperature control: Temperature control is a process in which change of temperature of a space (and objects collectively there within) is measured or otherwise detected, and the passage of heat energy into or out of the space is adjusted to achieve a desired average temperature. CHAPTER 2 10
  11. 11. SENSOR 2.1 SENSOR: A sensor (also called detector) is a converter that measures a physical quantity and converts it into a signal which can be read by an observer or by an (today mostlyelectronic) instrument. For example, a mercury-in-glass thermometer converts the measured temperature into expansion and contraction of a liquid which can be read on a calibrated glass tube. A thermocouple converts temperature to an output voltage which can be read by a voltmeter. For accuracy, most sensors are calibrated against knownstandards. Sensors are used in everyday objects such as touch-sensitive elevator buttons (tactile sensor) and lamps which dim or brighten by touching the base. There are also innumerable applications for sensors 11
  12. 12. of which most people are never aware. Applications include cars, machines, aerospace, medicine, manufacturing and robotics. A sensor is a device which receives and responds to a signal when touched. A sensor's sensitivity indicates how much the sensor's output changes when the measured quantity changes. For instance, if the mercury in a thermometer moves 1 cm when the temperature changes by 1 °C, the sensitivity is 1 cm/°C (it is basically the slope Dy/Dx assuming a linear characteristic). A good sensor obeys the following rules: • Is sensitive to the measured property only • Is insensitive to any other property likely to be encountered in its application • Does not influence the measured property The sensitivity is then defined as the ratio between output signal and measured property. For example, if a sensor measures temperature and has a voltage output, the sensitivity is a constant with the unit [V/K]; this sensor is linear because the ratio is constant at all points of measurement. 2.2 Sensor deviations: If the sensor is not ideal, several types of deviations can be observed: 1) Sensitivity error 2) An offset or bias. 3) Non linearity. 4) Dynamic error. 5) Drift (telecommunication). 6) Long term drift 7) Noise 8) Hysteresis 9) Aliasing errors. All these deviations can be classified as systematic errors or random errors. 12
  13. 13. 2.3 Resistance thermometer: Resistance thermometers, also called resistance temperature detectors (RTDs), are sensors used to measure temperature by correlating the resistance of the RTD element with temperature. Most RTD elements consist of a length of fine coiled wire wrapped around a ceramic or glass core. The element is usually quite fragile, so it is often placed inside a sheathed probe to protect it. The RTD element is made from a pure material, platinum, nickel or copper. The material has a predictable change in resistance as the temperature changes; it is this predictable change that is used to determine temperature. They are slowly replacing the use of thermocouples in many industrial applications below 600 °C, due to higher accuracy and repeatability. 2.4 R Vs T relationship of various metals Common RTD sensing elements constructed of platinum, copper or nickel have a unique, and repeatable and predictable resistance versus temperature relationship (R vs T) and operating temperature range. The R vs T relationship is defined as the amount of resistance change of the sensor per degree of temperature change. The relative change in resistance (temperature coefficient of resistance) varies only slightly over the useful range of the sensor. Platinum is a noble metal and has the most stable resistance-temperature relationship over the largest temperature range. Nickel elements have a limited temperature range because the amount of change in resistance per degree of change in temperature becomes very non-linear at temperatures over 572 °F (300 °C). Copper has a very linear resistance-temperature relationship, however copper oxidizes at moderate temperatures and cannot be used over 302 °F (150 °C). Platinum is the best metal for RTDs because it follows a very linear resistance-temperature relationship and it follows the R vs T relationship in a highly repeatable manner over a wide temperature range. The unique properties of platinum make it the material of choice for temperature standards over the range of -272.5 °C to 961.78 °C, and is used in the sensors that define the International Temperature Standard, ITS-90. Platinum is chosen also because of its chemical inertness. The significant characteristic of metals used as resistive elements is the linear approximation of the resistance versus temperature relationship between 0 and 100 °C. This temperature coefficient of 13
  14. 14. resistance is called alpha, α. The equation below defines α; its units are ohm/ohm/°C. the resistance of the sensor at 0°C the resistance of the sensor at 100°C Pure platinum has an alpha of 0.003925 ohm/ohm/°C and is used in the construction of laboratory grade RTDs. Conversely two widely recognized standards for industrial RTDs IEC 60751 and ASTM E-1137 specify an alpha of 0.00385 ohms/ohm/°C. Before these standards were widely adopted several different alpha values were used. It is still possible to find older probes that are made with platinum that have alpha values of 0.003916 ohms/ohm/°C and 0.003902 ohms/ohm/°C. These different alpha values for platinum are achieved by doping; basically carefully introducing impurities into the platinum. The impurities introduced during doping become embedded in the lattice structure of the platinum and result in a different R vs. T curve and hence alpha value. Calibration To characterize the R vs T relationship of any RTD over a temperature range that represents the planned range of use, calibration must be performed at temperatures other than 0°C and 100°C. Two common calibration methods are the fixed point method and the comparison method. 1) Fixed point calibration 2) Comparison calibration 2.5 Element types: There are three main categories of RTD sensors; Thin Film, Wire-Wound, and Coiled Elements. While these types are the ones most widely used in industry there are some places where other more exotic shapes are used, for example carbon resistors are used at ultra low temperatures (-173 °C to -273 °C). 1) Carbon resistor elements 2) Strain free elements 3) Thin film elements 4) Wire-wound elements 14
  15. 15. 5) Coiled elements The current international standard which specifies tolerance, and the temperature-to-electrical resistance relationship for platinum resistance thermometers is IEC 60751:2008, ASTM E1137 is also used in the United States. By far the most common devices used in industry have a nominal resistance of 100 ohms at 0 °C, and are called Pt100 sensors ('Pt' is the symbol for platinum). The sensitivity of a standard 100 ohm sensor is a nominal 0.385 ohm/°C. RTDs with a sensitivity of 0.375 and 0.392 ohm/°C as well as a variety of others are also available. 2.6 Function: Resistance thermometers are constructed in a number of forms and offer greater stability, accuracy and repeatability in some cases than thermocouples. While thermocouples use the Seebeck effect to generate a voltage, resistance thermometers use electrical resistance and require a power source to operate. The resistance ideally varies linearly with temperature. The platinum detecting wire needs to be kept free of contamination to remain stable. A platinum wire or film is supported on a former in such a way that it gets minimal differential expansion or other strains from its former, yet is reasonably resistant to vibration. RTD assemblies made from iron or copper are also used in some applications. Commercial platinum grades are produced which exhibit atemperature coefficient of resistance 0.00385/°C (0.385%/°C) (European Fundamental Interval). [8] The sensor is usually made to have a resistance of 100 Ω at 0 °C. This is defined in BS EN 60751:1996 (taken from IEC 60751:1995). The American Fundamental Interval is 0.00392/°C, [9] based on using a purer grade of platinum than the European standard. The American standard is from the Scientific Apparatus Manufacturers Association (SAMA), who are no longer in this standards field. As a result the "American standard" is hardly the standard even in the US. Measurement of resistance requires a small current to be passed through the device under test. This can cause resistive heating, causing significant loss of accuracy if manufacturers' limits are not respected, or the design does not properly consider the heat path. Mechanical strain on the resistance thermometer can also cause inaccuracy. Lead wire resistance can also be a factor; adopting three- and four-wire, instead of two-wire, connections can eliminate connection lead resistance effects from measurements (see below); three-wire connection is sufficient for most purposes and almost universal industrial practice. Four-wire connections are used for the most precise applications. 15
  16. 16. 2.7 Advantages and limitations The advantages of platinum resistance thermometers include: 1) High accuracy 2) Low drift 3) Wide operating range 4) Suitability for precision applications. Limitations: RTDs in industrial applications are rarely used above 660 °C. At temperatures above 660 °C it becomes increasingly difficult to prevent the platinum from becoming contaminated by impurities from the metal sheath of the thermometer. This is why laboratory standard thermometers replace the metal sheath with a glass construction. At very low temperatures, say below -270 °C (or 3 K), because there are very few phonons, the resistance of an RTD is mainly determined by impurities and boundary scattering and thus basically independent of temperature. As a result, the sensitivity of the RTD is essentially zero and therefore not useful. Compared to thermistors, platinum RTDs are less sensitive to small temperature changes and have a slower response time. However, thermistors have a smaller temperature range and stability. 2.8 Sources of error: The common error sources of a PRT are: 1) Interchangeability 2) Insulation Resistance 3) Stability 4) Repeatability 5) Hysteresis 6) Stem Conduction 7) Calibration/Interpolation 16
  17. 17. 8) Lead Wire 9) Self Heating 10) Time Response 11) Thermal EMF 2.9 RTDs vs thermocouples: The two most common ways of measuring industrial temperatures are with resistance temperature detectors (RTDs) and thermocouples. Choice between them is usually determined by four factors. 1) Temperature 2) Response time 3) Size 4) Accuracy and stability requirements 2.10 Construction: FIG 2.10.1 CONSTRUCTION OF RTD These elements nearly always require insulated leads attached. At temperatures below about 250 °C PVC, silicon rubber or PTFE insulators are used. Above this, glass fibre or ceramic are used. The measuring point, and usually most of the leads, require a housing or protective sleeve, often made of a metal alloy which is chemically inert to the process being monitored. Selecting and designing protection sheaths can require more care than the actual sensor, as the sheath must withstand chemical or physical attack and provide convenient attachment points. Wiring configurations Two-wire configuration Three-wire configuration 17
  18. 18. Four-wire configuration 2.11 Classifications of RTDs: Standard platinum Resistance Thermometers (SPRTs). Secondary Standard platinum Resistance Thermometers (Secondary SPRTs). Industrial PRTs 2.12 Applications: Sensor assemblies can be categorized into two groups by how they are installed or interface with the process: immersion or surface mounted. 1) Immersion sensors 2) Surface mounted sensors Immersion sensors generally have the best measurement accuracy because they are in direct contact with the process fluid. Surface mounted sensors are measuring the pipe surface as a close approximation of the internal process fluid. 2.13 History: The application of the tendency of electrical conductors to increase their electrical resistance with rising temperature was first described by Sir William Siemens at the Bakerian Lecture of 1871 before the Royal Society of Great Britain. The necessary methods of construction were established by Callendar , Griffiths, Holborn and Wein between 1885 and 1900. Resistance thermometer elements can be supplied which function up to 1000 °C. The relation between temperature and resistance is given by the Callendar-Van Dusen equation, Here, is the resistance at temperature T, is the resistance at 0 °C, and the constants (for an alpha=0.00385 platinum RTD) are 18
  19. 19. Since the B and C coefficients are relatively small, the resistance changes almost linearly with the temperature. 2.14 Pt100 Platinum Resistance Thermometers(Pt100 SENSORS): Platinum resistance thermometers (PRTs) offer excellent accuracy over a wide temperature range (from200 to +850 °C). Standard Sensors are are available from many manufacturers with various accuracy specifications and numerous packaging options to suit most applications. Unlike thermocouples, it is not necessary to use special cables to connect to the sensor. The principle of operation is to measure the resistance of a platinum element. The most common type (PT100) has a resistance of 100 ohms at 0 °C and 138.4 ohms at 100 °C. There are also PT1000 sensors that have a resistance of 1000 ohms at 0 °C. The relationship between temperature and resistance is approximately linear over a small temperature range: for example, if you assume that it is linear over the 0 to 100 °C range, the error at 50 °C is 0.4 °C. For precision measurement, it is necessary to linearise the resistance to give an accurate temperature. The most recent definition of the relationship between resistance and temperature is International Temperature Standard 90 (ITS-90). FIG 2.14.1 SENSOR This linearisation is done automatically, in software, when using Pico signal 19 Pt100
  20. 20. conditioners. The linearisation equation is: Rt = R0 * (1 + A* t + B*t2 + C*(t-100)* t3) Where: Rt is the resistance at temperature t, R0 is the resistance at 0°C, and A=3.9083E-3 B =-5.775E-7 C =-4.183E-12(below0°C),or C = 0 (above 0 °C) For a PT100 sensor, a 1 °C temperature change will cause a 0.384 ohm change in resistance, so even a small error in measurement of the resistance (for example, the resistance of the wires leading to the sensor) can cause a large error in the measurement of the temperature. For precision work, sensors have four wires- two to carry the sense current, and two to measure the voltage across the sensor element. It is also possible to obtain three-wire sensors, although these operate on the (not necessarily valid) assumption that the resistance of each of the three wires is the same. The current through the sensor will cause some heating: for example, a sense current of 1 mA through a 100 ohm resistor will generate 100 µW of heat. If the sensor element is unable to dissipate this heat, it will report an artificially high temperature. This effect can be reduced by either using a large sensor element, or by making sure that it is in good thermal contact with its environment. For example, a 100 µV voltage measurement error will give a 0.4 °C error in the temperature reading. Similarly, a 1 µA error in the sense current will give 0.4 °C temperature error. Because of the low signal levels, it is important to keep any cables away from electric cables, motors, switchgear and other devices that may emit electrical noise. Using screened cable, with the screen grounded at one end, may help to reduce interference. When using long cables, it is necessary to check that the measuring equipment is capable of handling the resistance of the cables. Most equipment can cope with up to 100 ohms per core. 20
  21. 21. The type of probe and cable should be chosen carefully to suit the application. The main issues are the temperature range and exposure to fluids (corrosive or conductive) or metals. Clearly, normal solder junctions on cables should not be used at temperatures above about 170 °C. Sensor manufacturers offer a wide range of sensors that comply with BS1904 class B (DIN 43760): these sensors offer an accuracy of ±0.3 °C at 0 °C. For increased accuracy, BS1904 class A (±0.15 °C) or tenth– DIN sensors (±0.03 °C). Companies like Isotech can provide standards with 0.001 °C accuracy. Please note that these accuracy specifications relate to the SENSOR ONLY: it is necessary to add on any error in the measuring system as well. The function for temperature value acquisition (C++) The following code estimates a Pt100 or Pt1000 sensor's temperature from its current resistance (input parameter r). float GetPt100Temperature(float r) { float const Pt100[] = { 80.31, 82.29, 84.27, 86.25, 88.22, 90.19, 92.16, 94.12, 96.09, 98.04, 100.0, 101.95, 103.9, 105.85, 107.79, 109.73, 111.67, 113.61, 115.54, 117.47,119.4, 121.32, 123.24, 125.16, 127.07, 128.98, 130.89, 132.8, 134.7, 136.6,138.5, 140.39, 142.29, 157.31, 175.84, 195.84 }; int t = -50, i = 0, dt = 0; if (r > Pt100[0]) while (250 > t) { dt = (t < 110) ? 5 : (t > 110) ? 50 : 40; if (r < Pt100[++i]) return t + (r - Pt100[i-1]) * dt / (Pt100[i] - Pt100[i-1]); t += dt; }; return t; } float GetPt1000Temperature(float r) { return GetPt100Temperature(r / 10); 21
  22. 22. } CHAPTER3 22
  23. 23. TEMPERATURE READER (CONTROLLER) 3.2 What Are the Different Types of Controllers, and How Do They Work? 3.1 Introduction to Temperature Controllers There are three basic types of How do Temperature Controllers work? controllers: on-off, proportional and To accurately control process temperature without extensive operator PID. Depending upon the system to involvement, a temperature control system relies upon a controller, be controlled, the operator will be which accepts a temperature sensor such as a thermocouple or RTD as able to use one type or another to input. It compares the actual temperature to the desired control control the process. temperature, or set point, and provides an output to a control element. The controller is one part of the entire control system, and the whole On/Off Control system should be analyzed in selecting the proper controller. The An on-off controller is the simplest following items should be considered when selecting a controller: form of temperature control device. 1. Type of input sensor (thermocouple, RTD) and temperature The output from the device is either on or off, with no middle state. An range 2. Type of output required (electromechanical relay, SSR, analog on-off controller will switch the output only when the temperature output) crosses the setpoint. For heating 3. Control algorithm needed (on/off, proportional, PID) control, the output is on when the temperature is below the setpoint, 4. Number and type of outputs (heat, cool, alarm, limit) and off above setpoint. Since the temperature crosses the setpoint to change the output state, the process temperature will be cycling continually, going from below setpoint to above, and back below. In cases where this cycling occurs rapidly, and to prevent damage to contactors and valves, an on-off differential, or “hysteresis,” is added to the controller operations. This differential requires that the temperature exceed setpoint by a certain amount before the output will turn off or on again. On-off differential prevents the output from “chattering” or making fast, continual switches if the cycling above and below the setpoint occurs very rapidly. On-off control is usually used where a precise control is not necessary, in systems which cannot handle having the energy turned on and off frequently, where the mass of the system is so great that temperatures change extremely slowly, or for a temperature alarm. One special type of on-off control used for alarm is a limit controller. This controller uses a latching relay, which must be manually reset, and is used to shut down a process when a certain temperature is 23
  24. 24. reached. Proportional Control Proportional controls are designed to eliminate the cycling associated with on-off control. A proportional controller decreases the average power supplied to the heater as the temperature approaches setpoint. This has the effect of slowing down the heater so that it will not overshoot the setpoint, but will approach the setpoint and maintain a stable temperature. This proportioning action can be accomplished by turning the output on and off for short time intervals. This "time proportioning" varies the ratio of “on” time to "off" time to control the temperature. The proportioning action occurs within a “proportional band” around the setpoint temperature. Outside this band, the controller functions as an on-off unit, with the output either fully on (below the band) or fully off (above the band). However, within the band, the output is turned on and off in the ratio of the measurement difference from the setpoint. At the setpoint (the midpoint of the proportional band), the output on:off ratio is 1:1; that is, the on-time and off-time are equal. if the temperature is further from the setpoint, the on- and off-times vary in proportion to the temperature difference. If the temperature is below setpoint, the output will be on longer; if the temperature is too high, the output will be off longer. PID Control The third controller type provides proportional with integral and derivative control, or PID. This controller combines proportional control with two additional adjustments, which helps the unit automatically compensate for changes in the system. These adjustments, integral and derivative, are expressed in time-based units; they are also referred to by their reciprocals, RESET and RATE, respectively. The proportional, integral and derivative terms must be individually adjusted or “tuned” to a particular system using trial and error. It provides the most accurate and stable control of the three controller types, and is best used in systems which have a relatively small mass, those which react quickly to changes in the energy added to the process. It is recommended in systems where the load changes often and the controller is expected to compensate automatically due to frequent changes in setpoint, the amount of energy available, or the mass to be controlled. OMEGA offers a number of controllers that automatically tune themselves. These are known as autotune controllers. Standard Sizes Since temperature controllers are generally mounted inside an instrument panel, the panel must be cut to accommodate the temperature controller. In order to provide interchangeability between temperature 24
  25. 25. controllers, most temperature controllers are designed to standard DIN sizes. The most common DIN sizes are shown below. FIG 3.2.1 STANDARD PANEL SIZES 3.3 SELEC TC303: Selec TC303 temperature controller is a single set point controller. //Manufacturer SELEC Controls Pvt. Ltd Code No SELEC TC303// Features: Single display 4 digits 7 segment LED TC / RTD input PID ON/OFF control Single set point °C / °F selectable Field selectable control output (Relay or SSR) Auxiliary output: Relay 25
  27. 27. PIC16F877A and RS232 4.1 PIC16F877A: This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC® architecture into an 40- or 44-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. The PIC16F877A features 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2 capture/compare/PWM functions, the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus and a Universal Asynchronous Receiver Transmitter (USART). All of these features make it ideal for more advanced level A/D applications in automotive, industrial, appliances and consumer applications. Features 2 PWM 10-bit 256 Bytes EEPROM data memory ICD 25mA sink/source per I/O Self Programming Parallel Slave Port Parameter Name Value Program Memory Type Flash Program Memory (KB) 14 27
  28. 28. CPU Speed (MIPS) 5 RAM Bytes 368 Data EEPROM (bytes) 256 Digital Communication Peripherals 1-A/E/USART, 1-MSSP(SPI/I2C) Capture/Compare/PWM Peripherals 2 CCP Timers 2 x 8-bit, 1 x 16-bit ADC 8 ch, 10-bit Comparators 2 Temperature Range (C) -40 to 125 Operating Voltage Range (V) 2 to 5.5 Pin Count 40 TABLE 4.1.1 FEATURES OF PIC16F877A FIG 4.1.1 PIC16F877A 4.2 RS232: In telecommunications, RS232 is the traditional name for a series of standards for serial binary singleended data and control signals connecting between a DTE (data terminal equipment) and a DCE (data circuit-terminating equipment). It is commonly used in computer serial ports. The standard defines the electrical characteristics and timing of signals, the meaning of signals, and the physical size and pinout of connectors. The current version of the standard is TIA-232-F Interface between Data Terminal Equipment and Data Circuit-Terminating Equipment Employing Serial Binary Data Interchange, issued in 1997. An RS-232 serial port was once a standard feature of a personal computer, used for connections 28
  29. 29. to modems, printers, mice, data storage, uninterruptible power supplies, and other peripheral devices. However, the low transmission speed, large voltage swing, and large standard connectors motivated development of the Universal Serial Bus, which has displaced RS-232 from most of its peripheral interface roles. Many modern personal computers have no RS-232 ports and must use an external USBto-RS-232 converter to connect to RS-232 peripherals. RS-232 devices are still found, especially in industrial machines, networking equipment, or scientific instruments. History RS-232 was first introduced in 1962 by the Radio Sector of the EIA. The original DTEs were electromechanical teletypewriters, and the original DCEs were (usually) modems. When electronic terminals (smart and dumb) began to be used, they were often designed to be interchangeable with teletypewriters, and so supported RS-232. The C revision of the standard was issued in 1969 in part to accommodate the electrical characteristics of these devices. Many fields (for example, laboratory automation, surveying) provide a continued demand for RS-232 I/O due to sustained use of very expensive but aging equipment. It is often far cheaper to continue to use RS-232 than it is to replace the equipment. Additionally, modern industrial automation equipment, such as PLCs, VFDs, servo drives, and CNC equipment are programmable via RS-232. Some manufacturers have responded to this demand: Toshiba re-introduced the DE-9M connector on the Tecra laptop. Serial ports with RS-232 are also commonly used to communicate to headless systems such as servers, where no monitor or keyboard is installed, during boot when operating system is not running yet and therefore no network connection is possible. An RS-232 serial port can communicate to some embedded systems such as routers as an alternative to network mode of monitoring. Signals: The following table lists commonly used RS-232 signals and pin assignments. [9] See serial port (pinouts) for non-standard variations including the popular DE-9 connector. Signal Name Data Terminal Origin Typical purpose Abbreviation Indicates presence of DTE to DCE. 29 DTE DTR ● DCE DB-25 pin 20
  30. 30. Ready Data Carrier DCE is connected to the telephone line. Data Set Ready DCD ● 8 DCE is ready to receive commands or data. Detect DSR ● 6 RI ● 22 DCE has detected an incoming ring signal on Ring Indicator the telephone line. Request To Send Clear To Send DTE requests the DCE prepare to receive data. Indicates DCE is ready to accept data. RTS ● 4 ● CTS ● 5 Transmitted Data Carries data from DTE to DCE. TxD Received Data RxD ● 3 Common Ground GND common 7 Protective Ground PG common 1 Carries data from DCE to DTE. 2 TABLE 4.2.1 SIGNALS IN RS232 The signals are named from the standpoint of the DTE. The ground signal is a common return for the other connections. The DB-25 connector includes a second "protective ground" on pin 1. Data can be sent over a secondary channel (when implemented by the DTE and DCE devices), which is equivalent to the primary channel. Pin assignments are described in following table: Signal Pin Common Ground 7 (same as primary) Secondary Transmitted Data (STD) 14 Secondary Received Data (SRD) 16 Secondary Request To Send (SRTS) 19 Secondary Clear To Send (SCTS) 13 Secondary Carrier Detect (SDCD) 12 TABLE 4.2.2 PIN ASSIGNMENTS Ring Indicator' (RI), is a signal sent from the modem to the terminal device. It indicates to the terminal 30
  31. 31. device that the phone line is ringing. In many computer serial ports, a hardware interrupt is generated when the RI signal changes state. Certain personal computers can be configured for wake-on-ring, allowing a computer that is suspended to answer a phone call. Cables: The standard does not define a maximum cable length but instead defines the maximum capacitance that a compliant drive circuit must tolerate. A widely used rule of thumb indicates that cables more than 50 feet (15 m) long will have too much capacitance, unless special cables are used. By using lowcapacitance cables, full speed communication can be maintained over larger distances up to about 1,000 feet (300 m). For longer distances, other signal standards are better suited to maintain high speed. Other serial interfaces similar to RS-232: RS-422 (a high-speed system similar to RS-232 but with differential signaling) RS-423 (a high-speed system similar to RS-422 but with unbalanced signaling) RS-449 (a functional and mechanical interface that used RS-422 and RS-423 signals - it never caught on like RS-232 and was withdrawn by the EIA) RS-485 (a descendant of RS-422 that can be used as a bus in multidrop configurations) MIL-STD-188 (a system like RS-232 but with better impedance and rise time control) EIA-530 (a high-speed system using RS-422 or RS-423 electrical properties in an EIA-232 pinout configuration, thus combining the best of both; supersedes RS-449) EIA/TIA-561 8 Position Non-Synchronous Interface Between Data Terminal Equipment and Data Circuit Terminating Equipment Employing Serial Binary Data Interchange EIA/TIA-562 Electrical Characteristics for an Unbalanced Digital Interface (low-voltage version of EIA/TIA232) TIA-574 (standardizes the 9-pin D-subminiature connector pinout for use with EIA-232 electrical 31
  32. 32. signalling, as originated on the IBM PC/AT) SpaceWire (high-speed serial system designed for use on board spacecraft). Serial line analyzers are available as standalone units, as software and interface cables for generalpurpose logic analyzers, and as programs that run in common personal computers. FIG 4.2.1 RS232 cable CHAPTER 5 32
  33. 33. 33
  34. 34. GRAPHICAL DISPLAY 5.1 Graphical LCD 128*64: Description: This is a framed graphical LCD 128*64 with LED backlight. This unit is a very clear STN type LCD with a simple command interface. This new module includes the negative voltage circuitry on board! Dimensions: • Overall: 75x52.7mm • Viewable area: 55.01x27.49mm FIG 5.1.1 Graphical LCD 128*64 5.2 Interfacing of PIC16F877A with 128x64 graphical display: Components/ Softwares: MPLAB IDE (PIC microcontrollers simulator) PIC BURNER 3 with software to load the code LCD (Displaytech 162A) Computer System with Windows operating system and RS 232 cable PIC16F877 Microcontroller +5V D.C Power Supply Resistors - 10K Ω-1,50Ω-1 Capacitors - 27 µ F-2 Potentiometers 34
  35. 35. 10K Ω -1 20MHz Crystal oscillator SPST switches -1 Procedure: Write the assembly code in MPLAB IDE simulator , compile it and check for errors Once the code was error free, run it and check the output in the simulator. After checking the code in the simulator, load the code (in .HEX format) into PIC16F877 microcontroller using PIC BURNER3. Make connections as shown in the circuit diagram. Switch on the power supply and observe "IITK" displayed in the LCD. Initializing LCD by sequence of instructions Executing commands depending on our settings in the LCD Writing data into the DRAM locations of LCD in the Standard Character Pattern of LCD MPLABIDE is a free software which can be downloaded from the Working with MPLABIDE : MPLABIDE is a simulator for PIC microcontrollers to write and edit the code in assembly language, compile it and also to run the code. Output can be verified using simulator. Steps to Use MPLABIDE After Installing the software MPLABIDEv7.2, open MPLABIDE. To built a new project, open Project Project Wizard Project wizard New Device 16F877 Location (C:ProgramFiles-MicrochipMPASM SuiteMPASMWIN.EXE) Next <Project name>&<Project Directory> Next (Add file "f877tmpo.asm" which was located in programfiles microchip MPASM Suite Template Object) (Add file "16f877.lkr" which was located in program files microchip MPASM Suite LKR) Next Finish To have more clear refer to MPLABIDE help files. After building the project open the editor f877tmpo.asm and write the assembly code After writing the assembly code in the editor, build the project by clicking on the following option Project Build all Check for the errors in the output window View Output Once the error free code was made, simulate the code by following option Debugger Select Tool MPLAB SIM Simulator options are Step into - Each time only one instruction will be executed (Single stepping mode) Run - To run the whole code at once. Animate - to animate the executing the code Additional things: To view DRAM, program memory, SFRs, and External memory use the option VIEW To set break points in the code (where simulation stops at that point). Debugger Breakpoints To stop the simulation Debugger Halt After checking the code in the simulator, the code (file with .HEX extension) is loaded into 16F877 35
  36. 36. microcontroller using PIC BURNER 3. PIC BURNER3 PIC BURNER3 can be used to program PIC microcontrollers. The steps to be followed to program the IC safely are as follows. Connect the PIC BURNER3 through RS232 Port to computer system with windows98 as operating system. Execute the file "icprog" which was in the software that comes with PIC BURNER3. Set the device as PIC16F877 Switch on the power supply of PIC BURNER3 Settings Hardware { JDM Programmer,Com1,Direct I/O} Settings Hardware check 1. on clicking "Enable Data out", Data in must be clicked automatically 2. on clicking Enable MCLR, red LED on the PICBURNER3 must glow Settings Options Confirmation [ Erasing the devise,Code Protecting the Devise] Settings Options MISC Process Priority Normal Settings Options Programming Verify After Programming. Remaining options keep them at default settings. [Refer Manual of PICBURNER3 for detail] Now insert the 16F877 microcontroller into the slot provided on the PICBURNER3 as the direction specified in the manual of PICBURNER3. load the .hex file File open file Command Erase All Command Blank Check Then there should be a notice on the window that "Device is Blank " Command Program All Command Blank Check Then there should be a notice on the window that "Device is not blank at address 0x0000H". Close the window, remove the IC from the PIC BURNER3 and switch off the power supply for PIC BURNER3. FIG5.2.1 Interfacing of PIC16F877A with 128x64 graphical display CHAPTER6 36
  37. 37. PROCEDURE 6.1 PROCEDURE: Ensure proper electrical connections. Place the sensor (tip probe) in a heat source. It will be read and shown in selecTC303. Then, the output from it is given to the microcontroller and program gets executed. From the PIC16F877A, RS232 cable is linked to system and values are seen. Then, it is given to graphical display. FIG6.1 BLOCK DIAGRAM OF TEMPERATURE MEASUREMENT SETUP: TEMPERATURE SENSOR (Pt100) TEMPERATURE READER/CONTROLLER PIC16F877A MICROCONTROLLER 37 RS232 128*64 GRAPHICAL DISPLAY UNIT
  38. 38. COST ESTIMATION: Sensor Temperature controller Microcontroller chip(kit) Graphical display Rs.480 Rs.1200 Rs.2500 Rs.800 CONCLUSION This can be used for measuring, controlling and acquisition of the temperatures in the engineering systems such as IC Engines, Boilers, etc. Graphs can be drawn between a temperature and time. 38