Temprature Sensing Major_Project_Report (2)

Embed Size (px)

Citation preview

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    1/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

    1Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    2/33

    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 FIG.1

    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

    BASIC CIRCUIT -THAT MAKES 8051 works

    2Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    3/33

    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.

    3Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    4/33

    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.

    TABLE-1

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

    Oscillator Circuit

    4Swami Devi Dyal Institute Of Engineering And Technology

    Register Content Register Content

    Program counter 0000h IP XXX00000b

    Accumulator 00h IEv 0XX00000b

    B register 00h All timer registers 00h

    PSW 00h SCON 00h

    SP 07h SBUF 00h

    DPTR 0000h PCON (HMOS) 0XXXXXXXbv

    All ports FFh PCON (CMOS)v 0XXX0000b

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    5/33

    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

    5Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    6/33

    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

    6Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    7/33

    Microcontroller Based Temperature Sensing And Controlling

    PORT FUNCTIONS

    Ports purpose

    Port 0

    (Pin 32-39)

    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

    7Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    8/33

    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

    8Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    9/33

    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 (FET-

    OFF) 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 portLatch 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.

    9Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    10/33

    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 industry-

    standard 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 contentsBut freezes the oscillator, disabling all other chip functions until the next external

    interrupt or hardware reset.

    10Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    11/33

    Microcontroller Based Temperature Sensing And Controlling

    11Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    12/33

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    13/33

    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.

    13Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    14/33

    Microcontroller Based Temperature Sensing And Controlling

    ALE/ PROGAddress 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

    14Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    15/33

    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.

    15Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    16/33

    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.

    16Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    17/33

    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.

    17Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    18/33

    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.

    18Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    19/33

    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

    19Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    20/33

    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:

    20Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    21/33

    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 to be made.

    Make sure it touches both thecomponent 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.

    21Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    22/33

    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

    22Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    23/33

    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

    23Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    24/33

    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.

    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.

    24Swami Devi Dyal Institute Of Engineering And Technology

    Vref/2

    (Volts)

    Vin

    (Volts)

    Step size (mV)

    Open (2.5) 0 to 5 5/256 = 19.53

    2.56 0 to 5.12 5.12/256 =20

    1.28 0 to 2.56 2.56/256 = 10

    0.5 0 to 1 1/256=3.90

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    25/33

    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.

    25Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    26/33

    Microcontroller Based Temperature Sensing And Controlling

    CALIBRATION

    For Temperature range 0 to 100C Output voltage 0V to 1V

    Required gain of amplifier Required Max. voltage input for ADC / Vout

    at LM35 = 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 becalibrated 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 .

    26Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    27/33

    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 FIG.8

    Bridge output

    Vab = 0.35V. (FOR R1=R2=R3=100ohms)

    27Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    28/33

    Microcontroller Based Temperature Sensing And Controlling

    3.Gain of Amplifier

    Vo = R2 / R1 ( Va Vb )

    For Vab = 0.351 & Vo = 0.351 V at 85 deg. Cel.

    A = R2 / R1 = 14.62

    For R1 = 1 k ohm ; We let R2 = 14.62 K ohm approx. R2 = 15 k ohm(use

    preset).

    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

    28Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    29/33

    Microcontroller Based Temperature Sensing And Controlling

    0000 00

    0001 00

    0002 00

    0003 01

    0004 01

    0005 01Cntd

    00FE 85

    00FF 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

    29Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    30/33

    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 a high-to-low pulse to RD to get the data

    out of the ADC804

    30Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    31/33

    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 inputmeasurand , which may be in the form physical, chemical, Mechanical or optical....

    For eg. temperature transducer transduces temp. changes to equivalent resistance changeswhich 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.

    31Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    32/33

    Microcontroller Based Temperature Sensing And Controlling

    P/NTemperature

    Range (oC)Accuracy (Oc) Output (mv/oC)

    LM35A -55 to 150 1.0 10

    LM35 -55to 150 1.5 10

    LM35CA -40 to 110 1.0 10

    LM35C -40 to 110 1.5 10

    LM35D 0 to 100 2.0 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 Calibrated directly in Celsius (Centigrade)n Linear + 10.0 mV/C scale factorn 0.5C accuracy guarantee able (at +25C)n Rated for full -55 to +150C rangen Suitable for remote applicationsn Low cost due to wafer-level trimming

    32Swami Devi Dyal Institute Of Engineering And Technology

  • 8/2/2019 Temprature Sensing Major_Project_Report (2)

    33/33

    Microcontroller Based Temperature Sensing And Controlling

    n Operates from 4 to 30 voltsn Less than 60 A current drainn Low self-heating, 0.08C in still airn Nonlinearity only 1.4C typical

    n Low impedance output, 0.1 for 1 mA load