DS18B20 library problem

Hey,

Pretty new to prototyping with my Particle Photon but the experience has been great for the first few small projects. However I ran into my first major problem when when proceeding to a temperature/weather logging project with some DS18B20 temperature sensors. I have spent lots of time troubleshooting with examples from the most used library with no success, only getting NaN from getTemperature(). When switching to example code from the ds18x20 library it immediately worked though. I’m wsing standard wiring with 5k pull-up resistor.

So the purpose of the thread is primarily to report the problem and see if I can assist in resolving it, whilst I have a workaround for my project.

Ping to @ScruffR based on other threads involving the library

Library that’s not working: https://github.com/eliteio/DS18B20/tree/master
Library that’s working: https://github.com/MORA99/particle-ds18x20

Have you got one or more sensors on the pin?

Tried two different sensors, both individually and together on the pin. Tried the _test and SingleDrop examples provided.

I’d have to check when I can, but last time I did (when adding the multi drop sample) the lib worked for me (and the user I added multidrop for).

You see me puzzled :confused:

Obviously (judging from the pull-up) you are not using parasitic mode sensors, or are you?
AFAIK there are DS18B20-PAR sensors that are meant for parasitic mode.
Which kind are you using?

Sounds strange. I tried including the lib in both web and desktop IDEs.

I’m using standard sensors with pull-up, not parasitic.

Yup, just tested the MultiDrop sample of the lib with two sensors and got this

(The increase in temperature is due to breathing on the sensors)

1 Like