ATmega168 and LM335 sensor

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a LM335 that I would use with an ATmega168 to measure an indoor temperature, in the range 250K..313K (-23°C...+40°C) so the voltage swing is 0.25V..0.313V.

Was wondering if I can attach directly the sensor to ADC input of ATmega168 or I have to use a conditioning stage (to bring the voltage swing to 0..5V)

The resolution needed is 1°C

Thansk in advance

My (HW && SW) Setup: (MyAVR USB Programmer | bread-board | Butterfly | Arduino 10k | ATtiny2313 | ATmega8) && (WinAVR | AVR asm | AVRstudio)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you don't then you will only have just short of 13 steps out of a potential 1024.

5V / 1024 = 0.00488 V/division

0.313V - 0.25V = range of 0.063V

0.063V / 0.00488 = 12.9 distinct readings

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
If you don't then you will only have just short of 13 steps out of a potential 1024.

5V / 1024 = 0.00488 V/division

0.313V - 0.25V = range of 0.063V

0.063V / 0.00488 = 12.9 distinct readings

Your post is a confirm for me. I saw a LM335 used without any conditioning stage and was wondering how it was possible.

My (HW && SW) Setup: (MyAVR USB Programmer | bread-board | Butterfly | Arduino 10k | ATtiny2313 | ATmega8) && (WinAVR | AVR asm | AVRstudio)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My mistake...range of LM335 (10mV/K) is 0,6V [2,53V..3,13V] so the distinct readings would be:

0,6 / 0.00488 = 122.95

So we would have a resolution of 60K/122.95, about 0,48K [0,48 °C] that is ok for my needs (better or equal than 0,5°C) so the conditioning stage should not be necessary.

Can you give me confirm of above calc?

Thanks again.

[cliff: looks right to me]

My (HW && SW) Setup: (MyAVR USB Programmer | bread-board | Butterfly | Arduino 10k | ATtiny2313 | ATmega8) && (WinAVR | AVR asm | AVRstudio)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now, I realize the "engineering is the art of making what you need from what you have". But you certainly could make it easier on yourself.

First,

Quote:
indoor temperature, in the range 250K..313K (-23°C...+40°C)
I'm glad I do not live at your house. ;) Hard on the water pipes at least.

Next, a simple device selection of, say, an LM50 at the same price would enable good sub-1-degree precision. 'Cause I've done it. ;)

For your range, that would be roughly 300mV-900mV. It is perfect to be measured with the internal 1.1V bandgap reference. You get roughly 10 ADC counts for each degree.

But, you say, the 1.1V is +/- 10%. No real problem. When you start up, you do a conversion on the internal 1.1V nominal using the "clean" "precision" AVcc as the reference. From there the actual transfer function can be calculated.

When/if temperatures get >~50C then switch to the AVcc as the reference. Some loss of precision but quite a high range.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A properly-biased thermistor can give you a curve that is close enough to linear over the area of interest that it can be used as such. +/- 1 degree is no problem. I'd have to look at my charts to see if fractional degree is practical without a lookup table. As it is a monotonic curve with only a little "belly" the actual accuracy doesn't really matter in a temperature-control application.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@theusch

In our modhest school-lab are available only some LM35 and LM335 so we have to use these ones.

-20°C seems too low for an lower indoor temperature as you noticed...so we could use a LM35 (10mV/°C) instead which guarantees a 0.25 °C accuracy at room temperature and narrow the range to a more reasonable 0°C..40°C

So doing, we have 81.96 distinct readings (0.4/0.00488) with a resolution of 0.488 °C (40/81.96)

Let me know what do you think about the above approach.

Thanks again for your help.

My (HW && SW) Setup: (MyAVR USB Programmer | bread-board | Butterfly | Arduino 10k | ATtiny2313 | ATmega8) && (WinAVR | AVR asm | AVRstudio)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't use LM335 ,I use DS18B20. Maybe you need check the LM335 datasheet first.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

diy.jack wrote:
I don't use LM335 ,I use DS18B20.

Nice...CANbus...it would be interesting to study it ;)

My (HW && SW) Setup: (MyAVR USB Programmer | bread-board | Butterfly | Arduino 10k | ATtiny2313 | ATmega8) && (WinAVR | AVR asm | AVRstudio)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

CANbus.

??? that is a "1-wire" interface device.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
Quote:

CANbus.

??? that is a "1-wire" interface device.

Lee

OMG I have to relax a bit :shock:

Anyway, LM35 seems simpler to implement.

My (HW && SW) Setup: (MyAVR USB Programmer | bread-board | Butterfly | Arduino 10k | ATtiny2313 | ATmega8) && (WinAVR | AVR asm | AVRstudio)