I was exploring the various libraries for the DS18B20 temp sensors. As a simple test, I complied the most basic, single sensor per pin sketch in each library and noted the memory and storage allocation. Results at end.
The one I have been using for quite a while is the DS18B20.h by Mathias Munk Hansen. It has been great except I recently discovered that a disconnected sensor reports 0 deg C. This happens to be a pretty common measurement for me and thus having the (sensorDisconnected) result in the middle of the range is difficult to filter out, should something go wrong.
DallasTemperature.h instead reports a -127. That's perfect as I will never run into that actual measurement. However, DallasTemperature.h is the largest complied library.
As it appears that Tillaart's DS18B20_INT.h is the smallest footprint and is derrived from Burton's DallasTemperature.h (which reports -127 on disconnect) I dug in there.
Compiling and uploading both the simple.ino and minimum.ino however, neither reports -127 on disconnect. minimum.ino reports a 0 on disconnect and simple.ino reports a -1 or a 0 depending on which pin is disconnected.
Even stranger is that on line 30 of DS18B20_INT.h is: "#define DEVICE_DISCONNECTED -127". Which should have something to do with reporting that value if the device is found to be disconnected. I thought perhaps that was not used in the "stripped down" versions of DS18B20_INT.h so I used the main example of the same title. It freeze on disconnect due to a while loop which I commented out, after which it only reported a 0.
Could I enlist your advice on selecting a library which is:
low in resources, has few features as I am only using one sensor on one pin (no alarms, bells, whistles, etc)
can be slow or fast read time, performance is not a constraint
reports an easily identifiable value when sensor disconnected
or any pointers to modify the DS18B20_INT library to do the same.
comparing ds18b20 libraries
DS18B20.h single.ino
by Mathias Munk Hansen
5162 b storage
301 b of memory
DS18B20_INT.h minimum.ino
by Rob Tillaart
3324 b storage
320 b memory
DS18B20_RT.h several
by Rob Tillaart, unsure of difference to DS18B20_INT.h
could not compile examples
missing library version etc..
DallasTemperature.h simple.ino
aka Arduino-Temperature-Control by Miles Burton
5670 b storage
401 b memory
MaximWire.h AnyDevice.ino
could not compile
missing nrf_gpio.h
microDS18B20.h one_pin_one_sensor.ino
4812 b storage
228 b memory