I am planning to use this sensor but iam not understanding how 
I found this code here can someone help; me understand ? i have a 3.3V system running on atmega1284P
thanks
void WriteTemperatureOnLCD(void)
{
k++;
if (k == 50)
{
Vin=0;
temp=0;
for(j=0 ; j<=49 ; j++)
{
samples[j] = (analogRead(analogtemp)); //Here you get a value from 0 to 1023. If Vref is 1100mV, then 1023 represents a Vin = 1023*1100/1024 = 1098.93mV.
Vin = Vin + samples[j]*1089/1024; //Here you convert from ADC to milivolt -> Voltage = ADC*Vref/1024
}
Vin=Vin/50;
Serial.println(Vin);
lcd.setCursor(9, 0);
lcd.print(Vin, 1);
lcd.print("mV");
}
if (k == 100)
{
temp = (Vin / 6.250) + minimum;
Start by posting the datasheet for the sensor you are requesting help with. Also, read the datasheet. There will be quiz.
Where did you get that code ? Did you write it ?
raschemmel:
Where did you get that code ? Did you write it ?
no i found the code here on this forum from an old post.
the data sheet is below
The reason I asked is that it is incorrect. Look at the following from the first page of datasheet.
VO = (+6.25 mV/°C × T°C) + 424 mV
The 424mV is the offset because THIS temp sensor can measure down to -40 degrees and the only way to make that possible without a negative supply voltage is by using the offset (which does not appear in THAT code you posted). You should delete it.
The analogReference(INTERNAL) statement sets the analog range for 0 to 1.1V.
The offset = 0.424V
The input voltage for your sensor at 25 deg C = [(0.00625* 25)+(0.424)]=0.58025V.
You must include the following analogReference statement PRIOR to reading your LM60.
analogReference(INTERNAL);
analogRead(0);
If you need to read voltages higher than
1.1V elsewhere in your program you can set it back right after reading the sensor, so if the sensor were connected to A0 input the code would look like this:
analogReference(INTERNAL);
analogRead(0);
analogReference(DEFAULT);
analogRead(1);
thanks !
one more thing. the datasheet is saying accuracy of this device is +-3 deg C what does that mean ? I will be measuring the aquarium temp with it , does it mean that 3 degrees C shift in the aquarium water temp might be in error ?
the datasheet is saying accuracy of this device is +-3 deg C what does that mean ?
+/- 3 degrees Celsius means just that. Whatever you measure could be off by as much as 3 degrees in either direction. If the fish cannot tolerate a deviation of 3 degrees above or below their nominal temp then you need to get some sealed DS18B20 ONEWIRE
16-bit precision sensors and use those or buy them in the TO-92 case package, solder the wires and hotglue or epoxy the leads to
waterproof them. My choice would be the factory made sealed probes. I don't know why you would think of using an LM60 when the poor little critters lives are at stake. What were you thinking ? XD