Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Dallas DS18B20 Characteristics?

Status
Not open for further replies.

Mike - K8LH

Well-Known Member
Anyone have experience with the Maxim/Dallas DS18B20 temperature sensor?

I'm finding temperature readings seem a bit high and fluctuate quite a bit over time. I've tested on both a 16F648A board with 4-digit 7 segment LED displays and a 12F675 board with bit-banged serial interface (below).

TIA. Mike
 

Attachments

  • DS18B20 12F675 Screen.PNG
    DS18B20 12F675 Screen.PNG
    23.7 KB · Views: 1,381
  • DS18B20 schematic 2.PNG
    DS18B20 schematic 2.PNG
    24.8 KB · Views: 3,148
  • 12F675 DS18B20 v2 Source.zip
    7.5 KB · Views: 691
Last edited:
Hi Bill,

Thanks for the reply.

The sensor is plugged into a 3-pin inline machined pin socket on either project board and is probably an inch away from any other components. The temperature reading does seem to be more stable if I take readings less often, perhaps once every few minutes, but it's still seems to be reading several degress higher than I would expect.

Mike
 
I'm not sure that's a problem though Bill. The entire 12F675 circuit is probably using less than 1.0-ma and the 7805 regulator doesn't even get warm.

I'm using the DS18B20 in its default 12-bit mode (0.0625°C resolution) and I wrote 4 digit code (1 decimal place) that supports the entire -025.0°C..125.0°C and corresponding -067.0°F..257.0°F range.

Mike
 
Hi Mike,

So you're saying that it's not 75F in your room? How do you know?

I had similar results with (don't know if I had the 18S20 or 18B20) and also with the LM335Z.

Over what time period are your readings? Here's a log of my freezer with 3 LM335Z's and a 18S20 (or B).

Mike
 

Attachments

  • freezer.GIF
    freezer.GIF
    24.5 KB · Views: 720
upand_at_them said:
Hi Mike,

So you're saying that it's not 75F in your room? How do you know?

I had similar results with (don't know if I had the 18S20 or 18B20) and also with the LM335Z.

Over what time period are your readings? Here's a log of my freezer with 3 LM335Z's and a 18S20 (or B).

Mike
No, it wasn't 75°F in the room at that time, it was around 70°F.

I've taken readings a couple different ways.

On the '648A board with 4-digit LED display I just continually loop through temperature readings and they'll keep drifting up for several minutes until reaching about 80°F. Then they drift up and down several tenths of a degree. Again, the temperature in the room is around 70°F.

On the '675 board with serial interface I simply press a key in Hyperterminal to iniatiate a new reading and display. If I keep pressing a key the temperature will keep drifting higher, almost as if the DS18B20 is heating itself up when taking a temperature measurement. If I press a key every minute or two the readings seem to stay closer together but still seem high by 5°F or more.

Mike
 
Dallas Temp Reading Issues

You have identified two issues:
1: The temperature reading appears high by a fairly consistent amount.
2: The temperature varies around the anticipated level.

I looked at the datasheet for the sensor. For 70 degrees F (~21 Degrees C) the typical error is 0.2 degrees C low. At 3 standard deviations the temperature error ranges from a +0.05 degrees to a -0.45 degrees, both in C. Your unit may be functionally out of spec. If you have a second unit you might try to compare the two.

If temperature accuracy is important, I'd calibrate the unit by placing it in a small foam container with a low wattage lamp. Insert an accurate temperature gauge, like a multimeter thermocouple or a photography type thermometer. Adjust the lamp, by varying the voltage to achieve a stable temperature, so as to correct for differences in heat sinking between the Dallas unit and the thermometer. Run this process with a range of temperatures to achieve a scale of error.

This error can be corrected in the PIC software. If the error is linear, it might simply mean adjusting the Dallas read value by a fixed amount.

The short-term shift is another issue. There may be some short term heating of the Dallas unit when it operates. More likely, the small shifts may reflect convective activity in the room. One way to reduce this is by adding mass to the sensor to reduced the response rate. A small heat sink could be placed over the sensor. In my hot air balloons I add a piece of shrink wrap tubing over the sensor to reduce the effect of the sudden convection caused by firing the balloon burner.

There may be fundamental measurement issues here. The fact the sensor can resolve to a 0.1 degree doesn't mean it is accurate at that level. As noted above the error can be a much as half a degree and still be in factory spec. There are other issues like linearity and repeatability that arise. For example: Suppose you have an ice water bath at 0 degrees C. If you drop the sensor into the water will it read 0.00 degrees? If you now let the sensor warm up to room temperature and drop it back in the water bath does its reading return to the same exact reading you saw before?

I doubt that an inexpensive, mass produced, temperature sensor should be expected to accurately read to 0.1 degrees.
 
bobledoux said:
Y
I doubt that an inexpensive, mass produced, temperature sensor should be expected to accurately read to 0.1 degrees.

Hi Bob,

A fresh technical analysis and perspective helps. I understand the 0.5°C accuracy but I still expected the readings to be somewhat stable.

I did think about adding mass to the sensor and removing it from the board. I'll try that and some of your other suggestions.

Take care. Mike
 
Status
Not open for further replies.

Latest threads

Back
Top