Temperature sensor

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Hello guys,
I have LM35DZ it has 3 pin working at 5V of micro controller supply inbuilt ADC of 8 bits.
so, I want to convert 8 bits maximum value 0-255 5v, 10mV mean 1*C
please tell algorithm to convert it in 0 to 99*C

thanks
 

nerdegutta

Joined Dec 15, 2009
2,689
Hi, I found this on a website, while I was searching for answers:

Before You Ask
Before asking a technical question by e-mail, or in a newsgroup, or on a website chat board, do the following:

  1. Try to find an answer by searching the archives of the forum or mailing list you plan to post to.

  2. Try to find an answer by searching the Web.

  3. Try to find an answer by reading the manual.

  4. Try to find an answer by reading a FAQ.

  5. Try to find an answer by inspection or experimentation.

  6. Try to find an answer by asking a skilled friend.

  7. If you're a programmer, try to find an answer by reading the source code.
When you ask your question, display the fact that you have done these things first; this will help establish that you're not being a lazy sponge and wasting people's time. Better yet, display what you have learned from doing these things.
I found it here.
 

GopherT

Joined Nov 23, 2012
8,009
Hello guys,
I have LM35DZ it has 3 pin working at 5V of micro controller supply inbuilt ADC of 8 bits.
so, I want to convert 8 bits maximum value 0-255 5v, 10mV mean 1*C
please tell algorithm to convert it in 0 to 99*C

thanks
Option 1
Set the ADC reference voltage to .99 volts. Then you get a full scale from 0 to 0.99 volts = 0 to 255 ADC value.
This leaves messy math to do in the Microcontroller to convert ADC value to degrees.

Option 2
Set reference ADC voltage to 2.55 volts
Your ADC value will be 0 to 255 (1 tick per 10 mV) which corresponds to 1 tick per degree C
Directly send your ADC value to your display. It is not a full 8-bit accuracy but neither is your 2-digit display. I assume 2 digit display because you said 0-99C instead of 0-99.9C.

Cheers.
 

John P

Joined Oct 14, 2008
2,060
Run the processor on 5.12 Volts, with the power supply used as the reference. Probably the A/D actually has 10 bits of resolution; read it in "right justified" mode and ignore the top 2 bits which will be in another register. You've then got 256 levels of resolution over an input range of 1.28V, which equates to .005V per step. To get 100 levels over a 1V range, all you have to do is divide by 2.

Alternatively, if you don't really need it to be very accurate, just use a 5V supply. It'll only be off by a couple of percent at the high end, and proportionally less at the low end.
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Option 1
Set the ADC reference voltage to .99 volts. Then you get a full scale from 0 to 0.99 volts = 0 to 255 ADC value.
This leaves messy math to do in the Microcontroller to convert ADC value to degrees.

Option 2
Set reference ADC voltage to 2.55 volts
Your ADC value will be 0 to 255 (1 tick per 10 mV) which corresponds to 1 tick per degree C
Directly send your ADC value to your display. It is not a full 8-bit accuracy but neither is your 2-digit display. I assume 2 digit display because you said 0-99C instead of 0-99.9C.

Cheers.
Hello,
The LM35 will require more ADC bits to capture solution is tio have less price micro with DS18b20, is that fine with PIC16F72?
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Directly send your ADC value to your display. It is not a full 8-bit accuracy but neither is your 2-digit display. I assume 2 digit display because you said 0-99C instead of 0-99.9C.
Hello,
Anyway, I have PIC16f887 which has more than 8 Bits ADC so, could i use it to get all range of temp -40 to 155*C and i listen that hot iron for solder run at 350*C which sensor is taht which can indicated large *C?
 

DumboFixer

Joined Feb 10, 2009
217
1-Wire communication has its own protocol so you will need to use that if you are going to use the DS18B20 temperature sensor.

Did you look at the bottom of the page I gave you the link to ? There are several links to external pages that will provide more info or do you just want us to provide you with the solution ?
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
1-Wire communication has its own protocol so you will need to use that if you are going to use the DS18B20 temperature sensor.

Did you look at the bottom of the page I gave you the link to ? There are several links to external pages that will provide more info or do you just want us to provide you with the solution ?
I am learning it, can we do this with pic micro?
 
Top