Lets say your a/d reading is a value of 150, which is about .732 volts / 73 degrees

using a simple function such as this will allow you to scale a adc count to any value (with some limitations – see the last paragraph).

By adjusting the value of fs up or down, you can fine tune the output. fs is the value for 1024 counts.

```
```uint16_t scale_adc(uint16_t adc, uint16_t fs)
{
uint16_t v=adc<>=1; // divide v by 2
if (fs&0x8000) { // see if fs bit 15 is set
result+=v; // if so, update result
}
fs<<=1; // multiply fs by 2
}
return result;
}
// a test program
int main(void)
{
uint16_t adc,fs,temp1;
adc=150;
for (fs=5000; fs<=5010; fs++) {
temp1=scale_adc(adc, fs);
printf("fs=%d, adc=%d, scale_adc=%d\n", fs, adc, temp1);
}
return 0;
}

running this gives:

fs=5000, adc=150, scale_adc=731 fs=5001, adc=150, scale_adc=731 fs=5002, adc=150, scale_adc=731 fs=5003, adc=150, scale_adc=731 fs=5004, adc=150, scale_adc=731 fs=5005, adc=150, scale_adc=731 fs=5006, adc=150, scale_adc=731 fs=5007, adc=150, scale_adc=731 fs=5008, adc=150, scale_adc=732 fs=5009, adc=150, scale_adc=732 fs=5010, adc=150, scale_adc=732

So a value of around 5010 would be optimum for 73.2 degrees.

Going a little further, fixing fs at 5010 and varying the adc count:

fs=5010, adc=145, scale_adc=708 fs=5010, adc=146, scale_adc=713 fs=5010, adc=147, scale_adc=717 fs=5010, adc=148, scale_adc=723 fs=5010, adc=149, scale_adc=727 fs=5010, adc=150, scale_adc=732 fs=5010, adc=151, scale_adc=736 fs=5010, adc=152, scale_adc=743 fs=5010, adc=153, scale_adc=747 fs=5010, adc=154, scale_adc=752 fs=5010, adc=155, scale_adc=756

This method isn’t perfect, but it doesn’t require floating point math.

Try to stay away from fs values that are a power of 2 (128,256,512,1024,etc).

]]>i will greatful for your response

]]>put several of them on the same I2C bus (e.g., Sprinkle them around a card, enclosure, etc.).

Dave

]]>I like the LM34DZ in part because it doesn’t require external components for preamplification or level-shifting. But I really dig your idea of feeding a different voltage to AREF — thanks!

]]>A very simple improvement would be to feed the 3.3V output to the AREF pin for ~3.1 steps per degree. Slightly more involved would be to use an op amp to give you full scale for the temperature range of interest.

]]>