TMP36 (LM335) vs DS18B20

Good day!

I'm building a trivial digital thermometer project, but adding some things to it to make it more fun :slight_smile:

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?

Thanks!

As far it goes for DS18s20, look at
http://stuff.nekhbet.ro/2009/08/23/how-to-use-the-ds18s20-and-ds18b20-temperature-sensors-with-arduino.html
and ongoing topic about protecting it from moisture
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1290802591/7#7

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 :frowning:

  • 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 :slight_smile:

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...

update:

INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56 volts on the ATmega8 (not available on the Arduino Mega)

Digital DS18B20

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.

Try the LM74, it seems happy with 3-5v and has a simple SPI-style interface.


Rob

Topic about protecting DS18B20 is also mine

My bad didnt look at the topic starter.

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.

The only problem with DS as mentioned before is program size as ur using atmega8.

That's why I mentioned the LM74, it's digital like the DS but has a simple two-wire interface that you could do with about 5 lines of code.

I haven't used one yet, just going on the data sheet but it looks very simple.


Rob

Thank you all for the responses, unfortunatelly I can't find LM74 from local suppliers, so for now I have one DS18B20 and two TMP36 to play with :slight_smile:

The code size is an issue for me, cause I use ATMega8. OneWire library didn't fit into the chip, but this example is smaller: Using a DS18B20 Temperature sensor with an Arduino- ar3ne1tt