Grove One Wire Temperature Sensor

Hi All,
I have been trying to get this the grove one wire temp sensor to read using DS18B20 sample code, but instead of returning the correct temp, I am getting temps north of 1800.

Here is what I have been trying:
a=analogRead(0);
resistance=(float)(1023-a)*10000/a;
temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;

Here is a link to the sensor.

Should I be using a different method to calculate the temp? Could you share any samples?

Thanks in advance!!!

It’s a time-honored thing and I found a valuable reference for you. @Joe_C

1 Like

Baozhu,
Thank you very much will give it a read.