Page 1 of 1

12-bit/9-bit resolution ds18b20

Posted: 03 Nov 2015, 22:05
by mhoek
When i connect a single ds18b20 temperature sensor to an ESP8266 with ESPEASY R39, the temperature is measured with a 12-bit accuracy. When i connect multiple sensors on one GPIO or multiple GPIO's, the accuracy of the temperature reading is lowered to 9-bits. In some cases the first sensors still have a 12-bit accuracy, but the last sensors have 9-bit.

Do you have any idea if this is a bug, or a feature ;)

Re: 12-bit/9-bit accuracy ds18b20

Posted: 03 Nov 2015, 22:26
by smagghe
Hello,

You can test this version of the dallas plugins. With the one you can set the resolution (accuracy).
please tell me if it's ok and working for you.

Re: 12-bit/9-bit accuracy ds18b20

Posted: 03 Nov 2015, 22:37
by rmtucker
I have multiple sensors running on one esp8266 with no problems.
But i recently bought a few on ebay which would only work in 9bit mode (I think they were fakes).
Luckily the seller returned my money.

Re: 12-bit/9-bit accuracy ds18b20

Posted: 04 Nov 2015, 07:17
by mhoek
smagghe wrote:Hello,

You can test this version of the dallas plugins. With the one you can set the resolution (accuracy).
please tell me if it's ok and working for you.
Thanks, I'll try.
I'm pretty sure the accuracy of the sensors isn't the problem, when i was running my own program, the temperature readings were ok.

Re: 12-bit/9-bit accuracy ds18b20

Posted: 04 Nov 2015, 12:32
by vmfs1968
Hello
I see if my DS18B20 is working the 9-bit or 12?

Re: 12-bit/9-bit accuracy ds18b20

Posted: 05 Nov 2015, 07:21
by mhoek
smagghe wrote:Hello,

You can test this version of the dallas plugins. With the one you can set the resolution (accuracy).
please tell me if it's ok and working for you.
Works like a charm!!

Re: 12-bit/9-bit accuracy ds18b20

Posted: 23 Jan 2017, 21:07
by mhoek
smagghe wrote:Hello,

You can test this version of the dallas plugins. With the one you can set the resolution (accuracy).
please tell me if it's ok and working for you.
Hi there, the plugin you suggested has one minor bug: Every reboot, the resolution must be set again to 12-bits.

I've noticed this plugin isn't compatible with R120. Do you have another version of the plugin that is compatible with R120??

Re: 12-bit/9-bit resolution ds18b20

Posted: 24 Jan 2017, 20:25
by mhoek
I have made the following changes to plugin _004

Code: Select all


  Plugin_004_DS_reset();
  Plugin_004_DS_write(0x55);           // Match ROM command
  for (byte i = 0; i < 8; i++)
    Plugin_004_DS_write(ROM[i]);       //  ROM selection
  Plugin_004_DS_write(0x4E);           //   Write Scratchpad
  Plugin_004_DS_write(0x00);
  Plugin_004_DS_write(0x00);
  Plugin_004_DS_write(0xFF);           // set 12-bit resolution
  delay(50);
  
The code above has been inserted before :

Code: Select all

Plugin_004_DS_reset();
  Plugin_004_DS_write(0x55);           // Match ROM command
  for (byte i = 0; i < 8; i++)
    Plugin_004_DS_write(ROM[i]);       //  ROM selection
  Plugin_004_DS_write(0x44);           //   Convert T

  delay(800);
I think some of my sensors have been programmed in 9-bit resolution before. This was the most easy fix i think.