3

I've just connected several waterproof DS18B20 sensors to my Raspberry Pi B+ V1.2 running Jessie Lite.

Working on the command line, why does it take so long to display the contents of the sensor's w1_slave file? I.e. if I

cat /sys/bus/w1/devices/28-nnnnnnnnnnnnn/w1_slave

why does it seem to take a full second to get my reading?

I understand this is perfectly normal. My guess is there's a relatively slow (maybe 200 bits/sec) serial conversation going on in the background?

1 Answer 1

4

From the datasheet currently hosted by Adafruit:

Converts Temperature to 12-Bit Digital Word in 750ms (Max)

From s445203's answer here:

...as far as I can tell from the w1_therm source code here [link now dead]... the w1_therm driver has the 750ms wait value hard coded in it.

I'm also seeing reports of slow refresh rates on both the raspberrypi.org and Adafruit forums. It looks like it's just a slow sensor with a 750ms refresh rate dictated by the driver. It's completely epoxy encased, so it will take some amount of time for any temperature change to propagate through the casing; even if it updated faster it wouldn't necessarily have useful new values.

3
  • Yeah. I thought as much. It's not so much about the refresh rate for me; rather about figuring out how to architect the program so that when the web page queries the three devices, it doesn't take 3 seconds to refresh the page. I'll get there. Thanks.
    – KDM
    Commented Mar 31, 2016 at 6:31
  • 2
    @KDM why not just continously read the devices in a background process into 3 files in /tmp then have your web page read the latest from there.
    – meuh
    Commented Mar 31, 2016 at 16:24
  • Indeed, it's "about figuring out how to architect the program so that when the web page queries the three devices..." Thanks.
    – KDM
    Commented Apr 1, 2016 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.