picsil said: "I use the DS18 library in a similar application with multiple sensors on different GPIO pins. It works okay, but is not always reliable. I retry readings up to 25 times(!) to make sure I get a good one. I’ve looked at the DS18B20 library but haven’t implemented it yet. Not sure if it’s more reliable. Note that both of these libraries default to 12 bit precision and have a hard coded 750ms conversion time. If you don’t need 12 bits of precision you can modify the library and reduce the conversion delay according to the DS18B20 datasheet."
I have been working on a project with the DS18B20 in this thread:
Here are some comments about the libraries.
The DS18 library doesn't expose a "setResolution" function to change DS18B20 resolution. The DS18B20 library exposes that function, but it might have been taken from a different chip and doesn't work. As per data sheet, writing a new resolution requires a "Write Scratchpad" command along with 3 bytes which include the new resolution...not what is in that library. Initially, on my project, I thought I wanted to change the resolution. I have since decided against that so this would not have been a show-stopper for me. Because of that, and as you mention, those libraries are currently stuck with a 750ms minimum execution time which is implemented with a delay() function. It really can't be reduced because there is no way to change the resolution of the DS18B20.
The other two libraries available in the particle.io database are ds18x20 and DS18B20Minimal. I have perused those and my first impression is that they do correctly support changing the resolution. In addition, both of those libraries also separate the "start conversion" function from the "read conversion" function which allows a user to do the conversions in parallel to other operations and not use a delay() function. The user can start a conversion, do other things (waiting at least 750ms for 12-bit resolution), and then read the conversion. I personally like that. On the flip side, however, there no corresponding function to "start and read" a conversion in one swoop as the DS18B20 and DS18 libraries do...and why they require the delay(750ms) function. However, I didn't use these libraries and there may be other issues associated with them.
I started out my project trying to use the DS18B20 and DS18 libraries but had issues and so ended up simplifying and extracting the two functions I really needed from them: 1) start conversion, 2) read conversion. I also extracted a 3) setResolution function but ending up dropping that from my code because there was no need to do faster conversion in my application...but it did work.