Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Remote temperature sensor

Status
Not open for further replies.

x3.exe

Member level 1
Joined
Sep 8, 2009
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Bradford
Activity points
1,653
Hi everyone,

I have a question about interfacing a temperature sensor to microcontroller, which is 5m away from the sensor. There are a couple of things that I want to find out:

1) How would this separation between the uC and the sensor affect the acuuracy of readings? If the sensor's gain is 10mV/C, than voltage drop across the cable could result in significant error.
2) Are there any methods that could reduce this error.
3) What type of temperature sensor should I use for this purpose?

Looking forward to your replies, Thanx in advance.
 

there should be no problem any way you can amplify the signal and then send the result
about the sensor a simple lm35 or LM 335 will do the work. It you need the answer in degree C kelvin or F? although you are using MC better to get result in the unit you need
 

    x3.exe

    Points: 2
    Helpful Answer Positive Rating
Hi x3exe,
Thes is depend on your senors type.
Use a supply line extra & signal & GND in a shielded cable.
But if you have thermo cross/element_is some others to do...
In all cases for better precision are 3/or 4 wire (Kelvin connection) solutions to apply.
K.
 

    x3.exe

    Points: 2
    Helpful Answer Positive Rating
Hi,
Take a look at DS1820.
It uses the one-wire protocol. Isn't too hard too implement with mikroC/mikroBASIC.
It can be used upto 300 metres.
Hope this helped.
Tahmid.

Added after 2 minutes:

I have a code written in mikroBASIC and ATmega88. If you want, I can post it.
Tahmid.
 

    x3.exe

    Points: 2
    Helpful Answer Positive Rating
Thank you all for your replies, they were really helpful.

Tahmid, DS1820 seems to be perfectly suitable for my application. I would appreciate if you could send me the code for interfacing it to uC.

Tnanx in advance.
 

Hi,
Here is the code in mikroBASIC for ATmega88 microcontroller.
Code:
program Temp_DS1820

'Microcontroller: ATmega88 (Atmel AVR)
'Programming Language: BASIC
'Compiler: mikroBASIC PRO for AVR v2.10
'Sensor: DS18S20
'Programmer: Tahmid

dim LCD_RS as sbit at PORTB2_bit
dim LCD_EN as sbit at PORTB3_bit
dim LCD_D4 as sbit at PORTB4_bit
dim LCD_D5 as sbit at PORTB5_bit
dim LCD_D6 as sbit at PORTB6_bit
dim LCD_D7 as sbit at PORTB7_bit

dim LCD_RS_Direction as sbit at DDB2_bit
dim LCD_EN_Direction as sbit at DDB3_bit
dim LCD_D4_Direction as sbit at DDB4_bit
dim LCD_D5_Direction as sbit at DDB5_bit
dim LCD_D6_Direction as sbit at DDB6_bit
dim LCD_D7_Direction as sbit at DDB7_bit


sub procedure ConversionDelay()
    delay_ms(800)
end sub

sub procedure StabilizeDelay()
    delay_ms(200)
end sub

dim Temperature as word
dim TempH as byte
dim TempL as byte
dim TLow as byte
dim vDisp as string[9]
dim DecimalPoint as byte

main:
     DDRC = $FE 'RC0 input for One-Wire
     LCD_Init()
     LCD_Cmd(_LCD_CURSOR_OFF) 'LCD Cursor off
     LCD_Cmd(_LCD_CLEAR) 'Clear LCD
     StabilizeDelay() 'Wait for sensor and LCD to stabilize
     vDisp = "+124.5 'C"
     LCD_Out(1, 1, "Temp:")
     while true
         OW_Reset(PORTC, 0) 'Reset command to initialize One-Wire
         OW_Write(PORTC, 0, $CC) 'Skip ROM Command
         OW_Write(PORTC, 0, $44) 'Convert_T command
         ConversionDelay() 'Provide delay for conversion
         OW_Reset(PORTC, 0) 'Reset command to initialize One-Wire
         OW_Write(PORTC, 0, $CC) 'Skip ROM Command
         OW_Write(PORTC, 0, $BE) 'Read Scratchpad Command
         Temperature = OW_Read(PORTC, 0) 'Read Temperature low byte
         Temperature = Temperature + ((OW_Read(PORTC, 0)) << 8) 'Read Temperature high byte and convert low and high bytes to 16-bit
         TempH = Hi(Temperature) 'High 8 bits of Temperature
         TempL = Lo(Temperature) 'Low 8 bits of Temperature
         DecimalPoint = Temperature.B0 'Check if Temperature is integer or fractional
         if (Temperature and $8000) then 'If reading is negative
            vDisp[0] = "-"
            TempL = byte((not TempL + 1) >> 1)
         else 'If reading is positive
            vDisp[0] = "+"
            TempL = TempL >> 1 'Shift one position right (divide by 2) to get integer reading and get rid of decimal point
         end if
         vDisp[1] = TempL div 100 + 48 'Get hundreds and convert to ASCII
         vDisp[2] = (TempL div 10) mod 10 + 48 'Get tens and convert to ASCII
         vDisp[3] = TempL mod 10 + 48 'Get units and convert to ASCII
         if (DecimalPoint) then 'If reading is fractional, ie has 0.5 at end
            vDisp[5] = "5"
         else 'If reading is a whole number
            vDisp[5] = "0"
         end if
         LCD_Out(1, 8, vDisp) 'Show temperature
     wend
end.
Code:
Fuse bit settings:
   SUT1 = 0(PROGRAMMED)
   CKSEL3 = 0(PROGRAMMED)
   CKSEL2 = 0(PROGRAMMED)
   CKSEL0 = 0(PROGRAMMED)
   SPIEN = 0(PROGRAMMED)
   Everything else = 1(UNPROGRAMMED)
48_1265794181.jpg

Hope this helps.
Tahmid.
 

    x3.exe

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top