Shop OBEX P1 Docs P2 Docs Learn Events
Problems with DS18b20 temperature sensor — Parallax Forums

Problems with DS18b20 temperature sensor

Walter JannWalter Jann Posts: 5
edited 2006-12-14 08:32 in BASIC Stamp
Hello Guys,

I've searched the posts and cannot find a solution for my problem.· I am building a multiple sensing thermostat with the BS2p24 based on John Williams 2000 Nuts and Volts article on using multiple DS1820 devices.· Used 2 DS1820 sensors in 1 wire configuration with no problems.· Bought 4 new DS18b20 sensors (can't·find DS1820s) and cannot get a correct temperature reading.· I can read the serial number no problem but the temperature is way·off.· When I plug the DS1820s back in it works great.··Should I be using the DS18s20 sensors?· Any help is appreciated.· Thanks.

-Walter

·

Comments

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-12-13 04:51
    Walter,
    The DS18B20 is a higher resolution device, so you need to use a different formula. That caught me up too, the first time I used one. Compare the data sheets.

     ' ----------------------------------------------------------------------------------------------
    ' {$STAMP BS2pe}
    ' {$PBASIC 2.5}
    ' Tracy Allen, EME Systems
    ' DS18B20 (12 bit) program displays temperature, -55 to +125 Celsius +/- 0.1 degree
    ' single one wire device--the skip ROM command can be used.
    degC VAR word
    DO
      OWOUT 0,1,[noparse][[/noparse]$CC, $44]
      DO : OWIN 0,4,[noparse][[/noparse]degC] : LOOP UNTIL degC  ' wait for done
      OWOUT 0,1,[noparse][[/noparse]$CC, $BE]
      OWIN 0,2,[noparse][[/noparse]degC.byte0, degC.byte1]
      DEBUG HOME, REP "-"\degC.bit15, DEC ABS degC/16, ".", DEC1 ABS degC */ 160 , "   " 
    LOOP
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Walter JannWalter Jann Posts: 5
    edited 2006-12-14 03:48
    Thanks Tracy. I really appreciate the help!!

    -Walter
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-12-14 08:32
    The older devices (DS1820 and DS18s20) returned 8 bit signed data with 0.5 degree resolution, and you could with a little more trouble get higher resolution by reading the "counts_remaining" register and the "counts_per_degree" register and doing some computations. With the DS18b20 they dispense with the oher registers and simply give you the full 12 bits, signed, with 1/16 degree Celsius resolution. Much nicer to work with!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.