Temperature detector-Thermistor

Status
Not open for further replies.

abhim93

Newbie level 2
Joined
Jun 29, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
I would like to know how to interface a thermistor to atmega16a..could anyone provide me the ckt diagram and the code required for internal adc convrsion!
 

A thermistor is just a resistor with a 'bad' temperature coefficient. To interface it to an ADC, you need to convert that resistance to a voltage. The simplest way is to make the thermistor one half of a voltage divider. Pick your reference voltage and other resistor to give the desired range and resolution.
 
Reactions: huub8

    huub8

    Points: 2
    Helpful Answer Positive Rating
Hi,

If you add a trimmer then you can calibrate the hardware against the software.

Using this circuit gives my controller a 0.1deg C resolution / accuracy
 

Attachments

  • ScreenShot001.jpg
    13.6 KB · Views: 65

here is the code im using.... i ve come up with formulae for temperature through fit equations in excel...by drawing a curve for T vs R using the lookup table for the thermistor..! now the problem is the lcd is not displaying decimal values and giving me "???" wen i declare float type..!am using eclipse ide!
I'm gettin the resistance value wen I put some value like 2.2 instead of x!but wen I leave it as x nothin is being displayed!and float or double both are not working I'm jus not able to display decimal!LCD is working fine for other programs or wen I display the output of readadc it's showing me 450 somethin which is fine so no problem wid LCD!wat command can I use other than sprintf?
#include <avr/io.h>
#include "lcd_lib.h"
#include <util/delay.h>
#include "adc_lib.h"
#include<stdio.h>
void main ( )
{
float x,y,t;
char a[15];
LCDinit();
LCDclr( );
ADCinit();// Initializes ADC in 10 bit mode
while(1)
{ x = read_adc(0)* 5/1024; // returns the digital value of the analog i/p connected to pin 0 of port A in terms of voltage
y = 10000 * (x/5-x);//resistance of thermistor
if(30000<y<12200)//temperature calculation
{t = (-1E-12)*(y*y*y) + (1E-07)*y*y - 0.0039*y + 54.581;
}
if(12199<y<5500)
{t = (-2E-11)*(y*y*y) + (7E-07)*y*y- 0.0105*y + 80.776;
}
if(5499<y<2700)
{t = (-2E-10)*(y*y*y) + (3E-06)*y*y - 0.0248*y + 106.77;
}
if(2699<y<1300)
{t = (-2E-09)*(y*y*y) + (1E-05)*y*y - 0.0538*y + 132.94;
}

sprintf(a,"Temperature = %f",t);
LCDclr();
LCDstring(a,13);
_delay_ms(300);
}
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…