I'm building a trivial digital thermometer project, but adding some things to it to make it more fun
The project is battery powered and builded around ATmega8 chip. I have two options for sensors (I need two of them):
Analog TMP36/LM335 -- they are easier to use (just read from ADC), but what to do with AREF? MCU is powered from 3 AA batteries, so reference voltage will be not stable.
Digital DS18B20. More advanced, require more programming, but seems to be self-contained and callibrated.
Is it possible to use TMP36 with battery powered project?
Good point to DS18s20 would be that u dont have to worry about supply voltage droping over time, the datasheet says it works down to 3V. The bad thing here is that the program on that page takes up to 5310bytes, u could make it a bit less, but not much. 1 good point is also as u need 2 sensors you will need just 1 input for both sensor, but i dont think that rly mathers to you
Analog TMP36/LM335 -- they are easier to use (just read from ADC), but what to do with AREF? MCU is powered from 3 AA batteries, so reference voltage will be not stable.
I didnt work with those 2 yet, because the local suplier doesnt have them. If u have to measure only positive temperature then pick LM35DZ. Why?
Because its easy to use...
Take a look at code and there are some interesting coments as to what to do with the analog value.
In ur case as they measure negative volatage and because of that u have offset voltage and diffrent voltage range not like the LM35DZ which has 0-1V for 0-100 degrees Celsius and because of that u can even pick internal referece volatage of 1.1V.
But the links do explain how to use the analog reading u just have to change it, so it suits you.
Btw i am sure there are plenty examples with TMP36 if u google it up.
Thanks for the responses. Topic about protecting DS18B20 is also mine
About size of one wire code for DS18B20 -- yes, I use ATmega8 and this is an issue.
What about using internal reference voltage will it work from batteries? I've found example in the comments to posts you mentioned, I need to check ATMega8 datasheet it reference voltage as far as I remember is different from ATmega168 and ATmega328...
Check out this library for the DS18 MilesBurton.com Works very well, with the onewire interface you can add up to 127 devices on one communication line costing you 1 I/O pin for all your temp needs - my max is 6 temp sensors simultaneously, worked very well.
I looked at the LM335 and looks prety simple. it has an output 10mv/K.
so 0V is 0K or -273 degrees
2.73V is 273K or 0 degrees
Now the sensor should be calibrated and used as shown in datasheet. Its beeing calibrated at 25 degrees and should have once calibrated 2.98V
As far it goes for analog reading u have to multiply analog value with 5 and then divide by 1024
At this point u get voltage value on analog pin.
Now u multiply everything by 100 or divide by 0.01 (10mV) to get value in Kelvin, if u want value in degrees Celzius substract by 273
Personaly i would use the DS cause it uses digital communication and is therefore less subject to outside interferance.
And as someone mentioned u can use multiple of them on just 1 pin.
The only problem with DS as mentioned before is program size as ur using atmega8.