Dallas DS18S20 Issue



  • Hi,

    I've been experimenting with some sensors and decided to look at some temperature sensors. I knew I had some Dallas DS18... chips lying about, so thought I'd try them. It appears I have DS18S20's and not DS18B20's as you've specified. As it looks like you're using the standard Dallas 1-Wire library by Miles Burton which supports (amongst others) the DS18S20, I thought I'd give it a go.

    I'm pleased to report that it works fine, apart from the fact that the first temperature measurement sent back comes in at 85.00C. As you can imagine, with experimenting (powering on/off to move the sensor), this is adding some incorrect data to my logs/charts. The simplest thing I've found is to extend line that reads:

    if (lastTemperature[i] != temperature && temperature != -127.00) {
    

    to read as follows:

    if (lastTemperature[i] != temperature && temperature != -127.00 && temperature !=85.00) {
    

    This, as you can imagine, just ignores the 85.00C reading and doesn't send it. And so then now, mysensors now supports another temperature sensor ๐Ÿ™‚

    I expect the code could be further expanded to cope with all of the DS18 chips that the library supports (DS18B20, DS1822, DS18S20, DS1820). It'd probably just need to testing to see what oddities these chips may have compared to each other. I assume the ignoring of -127.00 is another issue seen with this family of chips?

    The odd thing is that Miles' library page (http://milesburton.com/Main_Page?title=Dallas_Temperature_Control_Library) it states there are problems reported with the DS18S20 chips. I've done some searching, but can't find any information on what these problems may be. I'm only running one DS18S20 on "the wire" and this 85.00C temperature incorrect reading first time is the only issue I've found so far.

    Hope this helps someone ๐Ÿ™‚

    LaesQ



  • I've seen this 85 degree value on the DS18B20's as well. I would assume it's common to the whole range, i normally solve this with a sensors begin call followed by a delay in the setup loop, but this addition would be a good add to the sketch imho !



  • Hi, have you tried increasing the delay after the conversion command is send to the DSs? I have noted this behavior when the very first conversion of the DS is not waited long enought to finish, athts why its returning 85 Cยบ, wich is the power on state of the scratchpad.
    Let me know if you try it.
    Gonzalo


 

238
Online

8.6k
Users

9.4k
Topics

99.5k
Posts