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.
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.
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;
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.