[SOLVED] Temp sensor DS18B20 85C reading (thermal paste can electrical conduct)

Hi all,

I have come across the dreaded 85C reading from the DS18B20 temp sensor. I’ve had correct readings from the exact same configuration but today I turn on my device and it’s nothing but 85C readings.

I am powering the DS18B20 with 5V (not in parasite mode). I am using a 4.7KOhm external resistor between 5V and the data line. My line is about 10ft long. Here is my code:

#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#define I2C_ADDR 0x60
 
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
 
// Setup a oneWire instance to communicate with any OneWire devices 
OneWire oneWire(ONE_WIRE_BUS);
 
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

float TempC;
 
void setup(void)
{
  // start serial port
  Serial.begin(9600);

  sensors.begin();   // Start up the library
  
  Wire.begin(I2C_ADDR);
  Wire.onRequest(requestEvent); 
}

void loop(void)
{
   sensors.requestTemperatures(); // Send the command to get temperatures
   delay(2000);
   TempC = sensors.getTempCByIndex(0);
   delay(2000);
   Serial.println(TempC);
   
}

void requestEvent() {
  int temp = (int) TempC;
  Wire.write(temp);
}

This issue is extremely common and I have read the following posts about this issue:

Been banging my head over this one for lots of hours. Maybe I need a fresh set of eyes… Thanks in advance.

I believe I solved my own question. I don't think it had anything to do with wiring or code. I think it is because thermal grease, thermal paste can be electrically conductive when using with temp sensors. I connected to a fresh DS18B20 and the issue went away. The sensor that had been working yesterday, had just been inserted into its thermowell and had all night for the thermal paste to work itself in between the leads of my temp sensor. That's my best guess why it was working yesterday but today nothing but 85C reads.

Yes, its just grease jammed full of aluminium dust...

You can get DS18B20's already built in to stainless steel probes which might be a more reliably way to get
good thermal contact.