Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Improve DS18B20 resolution

Improve DS18B20 resolution

Scheduled Pinned Locked Moved Hardware
6 Posts 4 Posters 6.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Totche
    wrote on last edited by
    #1

    Hello everybody.

    I would like to know if it was possible to improve the resolution for the DS18B20 sensors.

    The goal is to have a reading of XX.XX degrees instead of XX.X.

    In the DallasTemperature.CPP, i have seen "DallasTemperature::setResolution", but i don't know how to use it in the sketch, certainly in the setup(), i think.

    Thanks for answers

    Y 1 Reply Last reply
    0
    • E Offline
      E Offline
      ericvdb
      wrote on last edited by ericvdb
      #2

      You can do as follows:

      //Declare a DeviceAddress
      DeviceAddress deviceAddress;
      
      //In your setup routine do
      sensors.getAddress(deviceAddress, index);
      //Set the resolution to 9/10/11/12 bits
      sensors.setResolution(deviceAddress, 9);
      
      //In your loop change
      gw.send(msg.setSensor(i).set(temperature,1));
      // to
      gw.send(msg.setSensor(i).set(temperature,2));
      

      Just for information, remember that the stepsize in 12bit = 0.0625 °C, so don't expect to see temperature readings like 12.50, 12.51, 12.52, ...

      1 Reply Last reply
      0
      • T Totche

        Hello everybody.

        I would like to know if it was possible to improve the resolution for the DS18B20 sensors.

        The goal is to have a reading of XX.XX degrees instead of XX.X.

        In the DallasTemperature.CPP, i have seen "DallasTemperature::setResolution", but i don't know how to use it in the sketch, certainly in the setup(), i think.

        Thanks for answers

        Y Offline
        Y Offline
        Yveaux
        Mod
        wrote on last edited by Yveaux
        #3

        @Totche said:

        DS18B20

        From the datasheet:
        "It has an operating temperature range of -55°C to +125°C and is accurate to ±0.5°C over the range of -10°C to +85°C."

        There's not much sense in reporting more then 1 decimal, when the sensor is only accurate up to ±0.5°C .

        http://yveaux.blogspot.nl

        1 Reply Last reply
        0
        • E Offline
          E Offline
          ericvdb
          wrote on last edited by
          #4

          @Yveaux ,

          not entirely true, read a bit further in the datasheet:

          The resolution of the temperature sensor is user-configurable to 9, 10, 11, or 12 bits, corresponding to increments of 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, respectively.
          The default resolution at power-up is 12-bit

          Y 1 Reply Last reply
          0
          • E ericvdb

            @Yveaux ,

            not entirely true, read a bit further in the datasheet:

            The resolution of the temperature sensor is user-configurable to 9, 10, 11, or 12 bits, corresponding to increments of 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, respectively.
            The default resolution at power-up is 12-bit

            Y Offline
            Y Offline
            Yveaux
            Mod
            wrote on last edited by
            #5

            @ericvdb Resolution and accuracy are not the same! But if you're only interested in resolution, your solution will work just fine.

            http://yveaux.blogspot.nl

            1 Reply Last reply
            0
            • M Offline
              M Offline
              m26872
              Hardware Contributor
              wrote on last edited by m26872
              #6

              Agree with @Yveaux. The only situations I can see the full resolution to be useful is when one examine the accuracy or calibrate its output (e.g. offset).

              Accuracy like 0.01 C would require some high class Pt100.

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              22

              Online

              12.0k

              Users

              11.2k

              Topics

              113.4k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular