DS18B20 gives unexpected readings below 0C 32F freezing

Hello,

I'm really not sure, but try changing:

unsigned int raw = (data[1] << 8) | data[0];
//to
int raw = (data[1] << 8) | data[0];
//or
long raw = (data[1] << 8) | data[0];

Unsigned values will never go below 0, they will overflow, so I think that's your problem :slight_smile: