You are on page 1of 33

Microcontroller Based Temperature Sensing And Controlling

INTRODUCTION
Our minor project involved the design of a fully functional TEMPERATURE SENSING AND CONTROLLING USING MICROCONTROLLER 89S52.This was our attempt at producing a portable device that could be widely used for a variety of different purposes. For example, think of the many situations where the precise measurement of temperature is of high importance. Temperature control and monitoring is important in homes for the comfort of its occupants, it is important for gardeners who want to carefully monitor the atmospheric conditions within greenhouse. Furthermore, our portable digital thermometer could be valuable as a scientific tool in the laboratory. Its ability to accurately measure temperature to within 1degree per celsius . As a household device, our multi-functioning digital thermometer is useful for its ability to carefully display the extreme temperatures reached in its environment. By simply pressing the appropriate button on its user interface, you can easily set the reference value of temperature. This is accomplished by entering lower and upper bound temperatures via two push buttons on the user interface. When the temperature recorded by this device crosses one of these boundary points, the LED glows to indicate the rise or fall of temperature. Additional functionality has been added to this feature regarding the options for changing these boundary temperatures. As the temperature rises above the reference temperature a fan is switched on and as the temperature falls below the reference bulb starts glowing indicating the fall in temperature. Thus the temperature can be monitored using MICROCONTROLLER BASED TEMPERATURE SENSING AND CONTROLLING

1 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

Basic Circuit for 8051

8051 PIN OUT Power - Vcc, Vss Reset - RST Crystal - XTAL[1,2] External device interfacing EA, ALE, PSEN, WR, RD I/O Port P0[7;0], P1[7:0], P2[7:0], P3 P3 is shared with control lines Serial I/O RxD, TxD, external interrupts INT0, INT1 Counter control T0, T1 P0 and P2 are multiplexed with Address and Data bus

FIG.1

BASIC CIRCUIT -THAT MAKES 8051 works

2 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

FIG.2

EA/VP Pin The EA on pin 31 is tied high to make the 8051 executes program from Internal ROM Reset Circuit RESET is an active High input When RESET is set to High, 8051 goes back to the power on state. The 8051 is reset by holding the RST high for at least two machine cycles and then returning it low.

3 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling Power-On Reset - Initially charging of capacitor makes RST High - When capacitor charges fully it blocks DC. Manual reset -closing the switch momentarily will make RST High. After a reset, the program counter is loaded with 0000H but the content of on-chip RAM is not affected.

Register Program counter Accumulator B register PSW SP DPTR All ports

Content 0000h 00h 00h 00h 07h 0000h FFh

Register IP IEv All timer registers SCON SBUF PCON (HMOS) PCON (CMOS)v

Content XXX00000b 0XX00000b 00h 00h 00h 0XXXXXXXbv 0XXX0000b

TABLE-1

Note: content of on-chip RAM is not affected by Reset.

Oscillator Circuit

4 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling The 8051 uses the crystal for precisely that: to synchronize its operation. Effectively, the 8051 operates using what are called "machine cycles." A single machine cycle is the minimum amount of time in which a single 8051 instruction can be executed. although many instructions take multiple cycles. 8051 has an on-chip oscillator. It needs an external crystal thats decides the operating frequency of the 8051. This can be achieved in two ways,, The crystal is connected to pins 18 and 19 with stabilizing capacitors. 12 MHz (11.059MHz) crystal is often used and the capacitance ranges from 20pF to 40pF. The oscillator can also be a TTL clock source connected with a NOT gate as shown

5 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling How fast 8051 works ? A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes one machine cycle to execute, it will take 12 pulses of the crystal to execute. Since we know the crystal is pulsing 11,059,000 times per second and that one machine cycle is 12 pulses, we can calculate how many instruction cycles the 8051 can execute per second: 11,059,000 / 12 = 921,583 Why is such an oddball crystal frequency? 11.0592 MHz crystals are often used because it can be divided to give you exact clock rates for most of the common baud rates for the UART, especially for the higher speeds (9600, 19200). Despite the "oddball" value, these crystals are readily available and commonly used. Power Supply

C1-1000 mf ,C2-100 mf The 78L05 is a 5V regulator. The input voltage ranges from 7V to 35V and the output voltage is about 5V.

FIG.3 6 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling PORT FUNCTIONS Ports Port 0 (Pin 32-39) purpose Dual-purpose port- 1. general purpose I/O Port. 2. multiplexed address & data bus Open drain outputs Port 1 (Pin 1-8) Dedicated I/O port Used solely for interfacing to external devices Internal pull-ups Port 2 (Pin 21-28) Dual-purpose port- 1. general purpose I/O port. 2. a multiplexed address & data bus. Internal pull-ups Port 3 (Pin 10-17) Dual-purpose port- 1. general purpose I/O port. 2. pins have alternate purpose related to special features of the 8051 Internal pull-ups

TABLE-2

7 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling The 8051 internal ports are partly bi-directional (Quasi-bi-directional). The following is the internal circuitry for the 8051 port pins:

FIG.4

1.Configuring for output P0 is open drain. Has to be pulled high by external 10K resistors. Not needed if P0 is used for address lines Writing to a port pin loads data into a port latch that drives a FET connected to the port pin. P0: Note that the pull-up is absent on Port 0 except when functioning as the external 8 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling address/data bus. When a "0" is written to a bit in port 0, the pin is pulled low. But when a "1" is written to it, it is in high impedance (disconnected) state. So when using port 0 for output, an external pull-up resistor is needed, depending on the input characteristics of the device driven by the port pin P1, P2, P3 have internal pull-ups: When a "0" is written to a bit in these port , the pin is pulled low ( FET-ON) ,also when 1 is written to a bit in these port pin becomes high (FETOFF) thus using port P1,P2,P3 is simple. 2. Configuring for input At power-on all are output ports by default To configure any port for input, write all 1s (0xFF) to the port Latch bit=1, FET=OFF, Read Pin asserted by read instruction You can used a port for output any time. But for input, the FET must be off. Otherwise, you will be reading your own latch rather than the signal coming from the outside. Therefore, a "1" should be written to the pin if you want to use it as input, especially when you have used it for output before. If you don't do this input high voltage will get grounded through FET so you will read pin as low and not as high. An external device cannot easily drive it high so, you should not tide a port high directly without any resistor. Otherwise, the FET would burn.

9 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

MICROCONTROLLER (89S52)

Description
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of In-System Programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industrystandard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with In-System Programmable Flash on a monolithic chip, the Atmel AT89s52 is a powerful microcontroller, which provides a highly flexible and cost-effective solution to many embedded control applications. The AT89s52 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 AT89s52 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 contents But freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset.

10 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

11 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

AT89s52
FIG.5

Pin Description

VCC: Supply voltage (all packages except 42-PDIP). GND Ground: (all packages except 42-PDIP; for 42-PDIP GND connects only the logic core and the embedded program memory). VDD: Supply voltage for the 42-PDIP that connects only the logic core and the embedded program memory. PWRVDD: Supply voltage for the 42-PDIP that connects only the I/O Pad Drivers. The application board MUST connect both VDD and PWRVDD to the board supply voltage. PWRGND: Ground for the 42-PDIP that connects only the I/O Pad Drivers. PWRGND and GND are weakly connected through the common silicon substrate, but not through any metal link. The application board MUST connect both GND and PWRGND to the board ground. 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 highimpedance 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. External pull-ups are required during program verification. 12 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

Port 1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification. 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 internal 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. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. 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 internal 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 AT89s52. 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 DISRTO 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. 13 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling 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. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. PSEN Program Store Enable (PSEN): is the read strobe to external program memory. When the AT89s52 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. 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. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL 2: Output from the inverting oscillator amplifier Port Pin Alternate Functions 14 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling P3.0 RXD (serial input port) P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input) P3.6 WR (external data memory write strobe) P3.7 RD (external data memory read strobe) Special Function Registers: A map of the on-chip memory area called the Special Function Register (SFR). Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect.

15 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

General PCB
Process followed While Making Printed Circuit Board :
Step#1 Film Generation:

Generated from the design files, we create an exact film representation of the design. We will create one film per layer. Step#2 Shear Raw Material:

Industry standard 0.059" thick, copper clad, two sides. Panels will be sheared to accommodate many boards.

16 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

Step#3 Drill Holes:

Using NC machines and carbide drills.

Step#4 Electroless Copper:

Apply thin copper deposit in hole barrels.

Step#5 Apply Image:

Apply photosensitive dryfilm (plate resist) to panel. Use light source and film to expose panel. Develop selected areas from panel.

17 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

Step#6 Pattern Plate:

Electrochemical process to build copper in the holes and on the trace area. Apply tin to surface.

Step#7 Strip & Etch:

Remove dryfilm, then etch exposed copper. The tin protects the copper circuitry from being etched.

Step#8 Solder mask:

Apply solder mask area to entire board with the exception of solder pads.

18 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

Step#9 Solder coat:

Apply solder to pads by immersing into tank of solder. Hot air knives level the solder when removed from the tank. Step#10 Nomenclature:

Apply white letter marking using screen printing process Step#11 Fabrication:

Route the perimeter of the board using NC equipment

FIG.6

19 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

SOLDERING
How to Solder
First a few safety precautions:

Never

touch

the

element

or

tip

of

the

soldering

iron.

They are very hot (about 400C) and will give you a nasty burn.

Take great care to avoid touching the mains flex with the tip of the iron. The iron should have a heatproof flex for extra protection. An ordinary plastic flex will melt immediately if touched by a hot iron and there

is a serious risk of burns and electric shock.

Always return the soldering iron to its stand when not in use. Never put it down on your workbench, even for a moment! Work in a well-ventilated area.

The smoke formed as you melt solder is mostly from the flux and quite irritating. Avoid breathing it by keeping you head to the side of, not above, your work.

Wash

your

hands

after

using

solder.

Solder contains lead which is a poisonous metal. Preparing the soldering iron: 20 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

Place

the

soldering

iron

in

its

stand

and

plug

in.

The iron will take a few minutes to reach its operating temperature of about 400C.

Dampen the sponge in the stand.

The best way to do this is to lift it out the stand and hold it under a cold tap for a moment, then squeeze to remove excess water. It should be damp, not dripping wet.

Wait a few minutes for the soldering iron to warm up.

You can check if it is ready by trying to melt a little solder on the tip. Wipe the tip of the iron on the damp sponge. This will clean the tip.

Melt a little solder on the tip of the iron.

This is called 'tinning' and it will help the heat to flow from the iron's tip to the joint. It only needs to be done when you plug in the iron, and occasionally while soldering if you need to wipe the tip clean on the sponge. You are now ready to start soldering:

Hold the soldering iron like a pen, near the base of the handle. Imagine you are going to write your name! Remember to never touch the hot element or tip.

Touch the soldering iron onto the joint Make to sure it be touches made. both the

component lead and the track. Hold the tip there for a few seconds and...

Feed a little solder onto the joint.

It should flow smoothly onto the lead and track to form a volcano shape as shown in the diagram. Apply the solder to the joint, not the iron. 21 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

Remove the solder, then the iron, while keeping the joint still. Allow the joint a few seconds to cool before you move the circuit board.

Inspect the joint closely.

It should look shiny and have a 'volcano' shape. If not, you will need to reheat it and feed in a little more solder. This time ensure that both the lead and track are heated fully before applying solder. . Using a heat sink Some components, such as transistors, can be damaged by heat when soldering so if you are not an expert it is wise to use a heat sink clipped to the lead between the joint and the component body. You can buy a special tool, but a standard crocodile clip works just as well and is cheaper. What is solder? Solder is an alloy (mixture) of tin and lead, typically 60% tin and 40% lead. It melts at a temperature of about 200C. Coating a surface with solder is called 'tinning' because of the tin content of solder. Lead is poisonous and you should

always wash your hands after using solder. Solder for electronics use contains tiny cores of flux, like the wires inside a mains flex. The flux is corrosive, like an acid, and it cleans the 22 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling metal surfaces as the solder melts. This is why you must melt the solder actually on the joint, not on the iron tip. Without flux most joints would fail because metals quickly oxidise and the solder itself will not flow properly onto a dirty, oxidised, metal surface.

ADC 0804
Analog signals are very common inputs to embedded systems .Most transducers and sensors such as temperature ,pressure ,velocity ,humidity are analog. Therefore we need to convert these analog signals in to digital so that 8051 can read it.

ANALOG DIGITAL TO CONVERTER - ADC Commonly used ADC device ADC804

ABOUT IC PinOut CS Chip Select , active low RD Read Digital data from ADC, H-L edge triggered WR -- Start conversion, L-H pulse edge triggered INTR -- end of conversion, Goes low to indicate conversion done Data bits -- D0-D7 CLK IN & CLK R CLK IN is an input pin connected to an external clock source when an external clock is used for timing. However, ADC804 has an internal clock

23 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling generator. To use the internal clock generator of the ADC804, the CLK IN and CLK R pins are connected to a capacitor and a resistor. In that case, the clock frequency is determined by the equation. f = 1/1.1RC R=10K and C=150pF f=606Hz the conversion time is 110us.

Input Voltage range Default 0-5V. Can be changed by setting different value for Vref/2 pin. Vin=Vin(+) Vin (-) Range = 0 to 2x Vref/2.

Vref/2 (Volts) Open (2.5) 2.56 1.28 0.5

Step size (mV) (Volts) 0 to 5 5/256 = 19.53 0 to 5.12 5.12/256 =20 0 to 2.56 2.56/256 = 10 0 to 1 1/256=3.90

Vin

for Vin = 2x Vref/2. we get 256 as a digital output on D0-D7. (Refer Table) TABLE-3 Step Size a Smallest change (2 x Vref/2)/ 256 for ADC804 for eg for step size 10mv ,digital output on D0-D7 changes by one count for every 10mv change of the input analog voltage. Data Out Dout = Vin / Step Size for input vtg. of 2.56 volts (Vref=1.28 volts) and stepsize of 10mv Dout =2560/10 =256 or FF that is full scale output.

24 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling Conversion Time Greater than 110us for ADC804 Resolution 8 bits for ADC804

INTERFACING TO MICROCONTROLLER USING ADC0804

FIG.7 The ADC804 has 8-bit resolution with a maximum of 256 steps and the LM35 produces 10mV for every degree of temperature change. We will do calibration such that , for temperature range of 0 to 100C , voltage in at the input of ADC will be 0 to 2.56 v. we need to set Vref/2 = 1.28V so step size will be 2560mv/256 = 10mv also for every degree change in temp. LM35 output changes by 10mv ,so every degree change in temp. will produce 1 unit change in digital out of ADC

Thus resolution of our system will be 1deg C , which is Smallest temp. that we can measure with this system.

25 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

CALIBRATION For Temperature range 0 to 100C Required gain of amplifier at LM35 = Output voltage 0V to 1V Required Max. voltage input for ADC / Vout 2560mv /100mv =2.56

Use preset for R2 --> 5.12KOhms

so gain =R3/R2 =2.56

Although our theoretical design is correct , operational amplifiers are often needed to to be calibrated practically , what i mean to say is that you need to adjust gain of amp. (Adjusting pot -R2) so that we get designed output at various temperature. That is if current temp. is 25C , LM35 output will be 250mv and amp. output should be 250x2.56 =0.64v . if it is not, adjust R2. LM35 has a limited ability to drive heavy capacitive loads. The LM35 by itself is able to drive 50 pf without special precautions. you can improve the tolerance of capacitance with a series R-C damper from output to ground. 2. P100 Platinum resistance temp. detector .

26 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling PT 1 00 - platinum resistance temp. detector (PRTD) . PT 1 00 has a resistance of 100 W at zero deg. Celsius . Linear Sensitivity-a0 =0.00385W/ deg. Celsius Response time - 0.5 to 5 s or more. DESIGN (0 to 85 deg. cel.) 1) R1*R4 = R2*R3 -----BRIDGE BALANCE CONDITION 2) Rt = Ro [ 1 + a T] ----- RESISTANCE VARIATION FOR RTD 3) Vab = V*R3 / ( R1 + R3 ) - VR4 /( R2 + R4 ) --- BRIDGE OUTPUT (V=5v) 4) Vo = R2 / R1 ( Va Vb )---- GAIN OF INSTRUMENTATION AMPLIFIER 1. At 0oC R1=R2=R3 =R4(100 W RTD )=100 ohms. so bridge is balance -o/p vtg 0v 2.At 85

oC R85 = 100 ( 1 + 0.00385 [ 85 ] ) = 132.72 ohms Bridge output Vab = 0.35V. (FOR R1=R2=R3=100ohms) 27 Swami Devi Dyal Institute Of Engineering And Technology FIG.8

Microcontroller Based Temperature Sensing And Controlling

3.Gain of Amplifier Vo = R2 / R1 ( Va Vb ) For Vab = 0.351 & A = R2 / R1 = 14.62 For R1 = 1 k ohm ; preset). We let R2 = 14.62 K ohm approx. R2 = 15 k ohm(use Vo = 0.351 V at 85 deg. Cel.

Since the change in resistance of RTD w.r.t. temp.is linear , the change in bridge output is also linear w.r.t. temp. i.e. change in temp. from 0 to 85 deg. Cel. causes bridge output to change from 0 to 0.351 V. I have given Ref voltage of 5.12 v to ADC chip so step size will be ,5120mV/256 (8 bit ADC) =20 mV. So bridge output voltage in the range 0 to 0.351 V corresponding to 0 to 85oC change in temperature is converted in to 0 to 5.12V using Amplifier having gain of 14.62 . Interfacing is same as that I have shown in ADC-DAC page . PROGRAM LOGIC: Output of an ADC is from 00 TO FFH for an input voltage variation of 0 to 5.12V. I used lookup table method to display the proper temperature. For this,I prepare a lookup table of 256 values(00 to FF)i.e output of ADC.. An small example of a lookup table has been shown below. Values corresponding to output of ADC are selected from lookup table and displayed. CONCEPT FOR LOOK- UP TABLE: ADC OUTPUT TEMPERATURE IN DEG.CEL 28 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling 0000 0001 0002 0003 0004 0005 Cntd 00FE 00FF 00 00 00 01 01 01

85 85 TABLE-4

INTERFACING ADC804 TO 8051

FIG.9

Signals to be interfaced (on the ADC804) D0-D7, RD, WR, INTR, CS Can do both Memory mapping and IO mapping

29 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling Memory Mapping (timing is critical) Connect D0-D7 of ADC804 to the data bus of the 8051 system Connect RD, WR of the ADC804 to the 8051 system (ensure polarity) Connect CS of ADC804 to an appropriate address decoder output Connect INTR of ADC804 to an external interrupt Pin on the 8051 (INT0 or INT1) IO Mapping (easiest - I prefer ) Connect D0-D7, RD, WR, CS, INTR to some port bits on the 8051 (12 in all).

Algorithm Make CS=0 and send a low-to-high to pin WR to start the conversion. Keep monitoring INTR If INTR =0, the conversion is finished and we can go to the next step. If INTR=1, keep polling until it goes low. After INTR=0, we make CS=0 and send out of the ADC804 a high-to-low pulse to RD to get the data

30 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

SENSORS INTERFACING
Transducer is a device capable of being actuated by an an energizing input from one or more transmission media and in turn generating a related signal to one or more transmission systems. It provides a usable output in response to specified input measurand , which may be in the form physical, chemical, Mechanical or optical.... For eg. temperature transducer transduces temp. changes to equivalent resistance changes which can further converted into electrical signal (voltage) for measurements. TEMPERATURE 1. LM35 Precision temperature sensor LM34 series are precision integration-circuit temperature sensors whose output voltage is linearly proportional to the Fahrenheit temperature.

FIG.10 LM35 series are precision integration-circuit temperature sensors whose output voltage is linearly proportional to the Celsius temperature.

31 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling

P/N LM35A LM35 LM35CA LM35C LM35D

Temperature Range (oC) -55 to 150 -55to 150 -40 to 110 -40 to 110 0 to 100

Accuracy (Oc) Output (mv/oC) 1.0 1.5 1.0 1.5 2.0 10 10 10 10 10

TABLE-5 I am using LM35DT package to operate over a 0 to +100C temperature range

FIG.11 R5 and C3 are used for capacitive load compensation.

Features
n n n n n n Calibrated directly in Celsius (Centigrade) Linear + 10.0 mV/C scale factor 0.5C accuracy guarantee able (at +25C) Rated for full -55 to +150C range Suitable for remote applications Low cost due to wafer-level trimming 32 Swami Devi Dyal Institute Of Engineering And Technology

Microcontroller Based Temperature Sensing And Controlling n n n n n Operates from 4 to 30 volts Less than 60 A current drain Low self-heating, 0.08C in still air Nonlinearity only 1.4C typical Low impedance output, 0.1 for 1 mA load

33 Swami Devi Dyal Institute Of Engineering And Technology

You might also like