Improve DS18B20 resolution
-
Hello everybody.
I would like to know if it was possible to improve the resolution for the DS18B20 sensors.
The goal is to have a reading of XX.XX degrees instead of XX.X.
In the DallasTemperature.CPP, i have seen "DallasTemperature::setResolution", but i don't know how to use it in the sketch, certainly in the setup(), i think.
Thanks for answers
-
You can do as follows:
//Declare a DeviceAddress DeviceAddress deviceAddress; //In your setup routine do sensors.getAddress(deviceAddress, index); //Set the resolution to 9/10/11/12 bits sensors.setResolution(deviceAddress, 9); //In your loop change gw.send(msg.setSensor(i).set(temperature,1)); // to gw.send(msg.setSensor(i).set(temperature,2));Just for information, remember that the stepsize in 12bit = 0.0625 °C, so don't expect to see temperature readings like 12.50, 12.51, 12.52, ...
-
Hello everybody.
I would like to know if it was possible to improve the resolution for the DS18B20 sensors.
The goal is to have a reading of XX.XX degrees instead of XX.X.
In the DallasTemperature.CPP, i have seen "DallasTemperature::setResolution", but i don't know how to use it in the sketch, certainly in the setup(), i think.
Thanks for answers
@Totche said:
DS18B20
From the datasheet:
"It has an operating temperature range of -55°C to +125°C and is accurate to ±0.5°C over the range of -10°C to +85°C."There's not much sense in reporting more then 1 decimal, when the sensor is only accurate up to ±0.5°C .
-
@Yveaux ,
not entirely true, read a bit further in the datasheet:
The resolution of the temperature sensor is user-configurable to 9, 10, 11, or 12 bits, corresponding to increments of 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, respectively.
The default resolution at power-up is 12-bit -
@Yveaux ,
not entirely true, read a bit further in the datasheet:
The resolution of the temperature sensor is user-configurable to 9, 10, 11, or 12 bits, corresponding to increments of 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, respectively.
The default resolution at power-up is 12-bit
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login