Speed of reading Dallas DS18B20

Last night I added a temperature probe to my 'slave' emontx. (This takes generation power and consumed power from my master emontx, has a single CT that reads my immersion power, and controls my immersion via a Crydom SSR  - not the in vogue way of doing things but...).    When I added the temperature software, using the Dallas temperature library, by slave unit could not keep up with the master (one data packet about every 900mS).  It turned out reading the temperature was adding about 700-800mS to the loop, so I was missing every other packet from my master emontx!

Changing to use the OneWire library, everything returned to normal.  It possibly is not as accurate as the Dallas library (I think the delay is to try and allow ADC to settle), but more than good enough for measuring my hot water cylinder.


Sergegsx's picture

Re: Speed of reading Dallas DS18B20

temperature readings normally dont need to be taken every so ofter, I read temperatures every 10 seconds and thats already an overkill.

just make a timer so that temperature is read ever xx seconds, and leave a small delay in the code when reading the sensor. most likely it will not affect missing packages.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.