Cheap thermistor vs 1-Wire DS18B20?

Started by Richard, January 24, 2015, 08:45:27 PM

Richard

Yep, one's digital and the other is analog (so, GPIO pin vs ADC+math), but the thermistor costs like $0.30 vs about $3 for the 1-Wire option.  I think the precision of the thermistor might actually be higher too, and its like 100x faster to read out.

I have to think a thermistor could be designed for zero power when not being read.  It's not addressable, if you needed a bunch of peripherals to share a pin or a remote cable.  And yes, probe wire will affect the reading, but at high thermistor resistance values it won't be a major factor.

Do people go for the 1-Wire chip just for its simplicity, or am I missing an important element?  E.g., if I added one to every device to monitor the radio crystal for temp correction, it starts to add up.

Cheers,
Richard

Felix

I've also wondered about this. $3-4 for reading temperature at a dismal accuracy and at like 1sec reading delay? What!??
I think it's the work of the big maker movement retailers who promoted such sensors which makes them more margin than a 0.30 thermistor.

That being said, I am creating a Moteino shield with digital i2c sensors that are very accurate, ultra low power, ultra fast to read. They come at a cost, but they make for a nice weather sensor board, providing temp, hum and pressure.

The issue with powering the resistor only when reading it is that it will behave different and drift over temperature. Also when you pass a current through it it will react different after a while vs after a short power time (depending on the actual resistance) - this might be marginally important but something to think about. I think most cheap thermostats use a 1% thermistor.

TomWS

Well, it's tough to get humidity reading from a Thermistor.  It can be done, but...

If all you want is temperature, I've got a diode that will...

Also, if you're trying to measure a point that's 25 feet away, a thermistor might be a problem.  One wire does that very nicely.

Net is that there are lots of choices because there are lots of applications that demand lots of alternatives.

Tom

Richard

Agreed, if there wasn't a market they wouldn't survive long.  e.g., if I had a string of temp sensors around an area, I'd need the addressability of 1-wire and the added cost would be cheaper than having multiple sensor controllers.

Given an application where ADCs are readily available and the temp reading is local to the MCU's board (e.g., reading the temp of the radio crystal), I'm just curious if I'm missing a gotcha with thermistors.

Regarding resistance changes with longer readings - I could see this with current mode as the heat soaks the part, but I was thinking of resistance mode (presumably a voltage divider arrangement) so the current through it should be very small and not vary the temp reading much.  But this is new territory for me; I'm trying to gauge the path worth taking here.

Cheers,
Richard

TomWS

Quote from: Richard on January 24, 2015, 11:43:27 PM
Agreed, if there wasn't a market they wouldn't survive long.  e.g., if I had a string of temp sensors around an area, I'd need the addressability of 1-wire and the added cost would be cheaper than having multiple sensor controllers.

Given an application where ADCs are readily available and the temp reading is local to the MCU's board (e.g., reading the temp of the radio crystal), I'm just curious if I'm missing a gotcha with thermistors.

Regarding resistance changes with longer readings - I could see this with current mode as the heat soaks the part, but I was thinking of resistance mode (presumably a voltage divider arrangement) so the current through it should be very small and not vary the temp reading much.  But this is new territory for me; I'm trying to gauge the path worth taking here.

Cheers,
Richard
Sorry, I missed that you had a specific application in mind (reading crystal temp).  Any discrete solution would require peripheral electronics to:

  • Amplify (thermistors might have an advantage here, but you have to keep current very low to prevent self-heating)
  • linearize (Thermistors are in the middle of the pack in this regard)
  • calibrate (any discrete solution will require at least two calibration points)

Power management, as you say, could be pretty easy, depending on how fast (and how much current) the peripheral electronics is.

You might look into the SMD version of the MCP9700A (-LT or -TT).  It's small and relatively low cost ($0.31 in 10 pc qty) and has taken care of all of the above.  If you use the 1.1V bandgap reference as the ADC reference, you'll get the most resolution and accuracy.  They're low power and settle reasonably fast so powering from a GPIO is usually ok.

The TO92 version can be glued directly to your crystal...

Tom

Richard

Thanks for the pointer!  That sounds perfect - I'll give it a look.

Certainly on a small scale, a couple bucks isn't a big deal and rapid prototyping is more valuable than cost efficiency.  I do need to keep that in mind, as I have a tendency to design for volume which requires solving cost / manufacturing / test problems before they're real, and this slows my design speed.  (On the other hand, I dislike re engineering a working solution.)

Cheers,
Richard

ColinR

#6
There are a lot of good reasons to use 1Wire, most of which have been pointed out here. I use all sorts of sensors for all sorts of applications, so let me offer my 2c.

Multidrop
This is just impossible with analog sensors. I don't think I need to explain how awesome this can be for an application.

IO Required
Now I realize we're on a micro forum, where we presumably all have at least half a dozen ADCs to play with, but this is not always the case. An RPi and some other SBCs don't have ADCs. Add-on ADCs for a thermistor, RTD, or thermocouple when not necessary are just a waste. Even if you are going to use an RTD or thermocouple, I would recommend dedicated ICs that allow you to talk to them over I2C or SPI. Even for 1Wire I use dedicated I2C masters (which cost $1). Anyway, if you've nothing but a digital pin or two, you can use a 1Wire sensor or few with kernel drivers or some bitbanging.

Precision
Without amplifying electronics (additional circuitry, complication and $$$), you will get worse accuracy with a thermistor or an RTD. Worse, the measurements require measuring resistance. This requires an additional comparator such as a resistor, or a constant current source. You can buy these (constant current sources such as the LM334) for RTDs for about $1, but you need a precision resistor or to calibrate it yourself. If you do not use a constant current source, you need to carefully optimize a series resistor to keep current ideally well below 1mA to minimize self-heating, and preferably even lower if you have a temperature sensor in air. Let me offer an example here:

PT1000 thermocouple. Minimum resistance of 1kohm. To get current of [email protected], you are going to need something like a 2.2k resistor in series. Now let's look at your ADC. Let's assume we're talking about the typical 10-bit micro. This is 3.3V by 1024, or 3.2mV. At 25C, you will have an ADC reading of 320 (assuming the RTD is on the high side). Your next ADC step is 321, which corresponds to 1003.125ohms, or 0.81C. That, quite simply, sucks, and gets worse as temperature increases. Compare this to 0.0625C at 12-bit for the DS18B20 (0.5C accuracy), and the fact that it's adjustable resolution, the DS18B20 wins easily here. Even a 12-bit ADC will only buy you 0.20C resolution.

Accuracy

The DS18B20 is calibrated and rated at 0.5C. Now technically you can do better with a thermistor or RTD, but you must calibrate with a known temperature standard. This is a pain, you must consider nonlinearity and the temperature of the resistor you are comparing with, and without a good op-amp circuit you are not going to get it accurate. Oh, and did I mention self-heating? Blech. This stuff is often a nightmare to deal with. Even at 3mA you can get 10C temperature drift.

Sample rate
While you might complain about the sampling time, there are few applications where the sampling rate is really an issue, and you can, as I mentioned, adjust the sampling rate from 9bits (94ms) to 12bits (750ms). Considering even the 9-bit value is as or more accurate than you will get practically with other methods, 94ms isn't too long to wait for 0.5C precision at 0.5C accuracy, is it? Most of the time, you can get around all practical sampling issues by better coding, reading cached values, and otherwise being smart about what you are doing.

Cost
First of all, you can get DS18B20s on eBay for $1. Sure, they are probably knockoffs, but I've yet to have one fail, and you can get the real deal for $2 or less. If the $1 breaks you on a project (especially if you consider all I wrote above regarding time spent calibrating and external circuitry), you should probably reevaluate your project.

Temperature Range
At the end of the day, this is the biggest drawback for 1Wire temperature sensors, and really the only reason I choose something else. But again, -25-125C will cover 95% of all applications. After that, I go to RTDs, and then thermocouples only if absolutely necessary. I never use thermistors. Calibration and calculation are a mess, and they're usually not very accurate.

Cheers,
Colin
CuPID Controls :: Open Source browser-based sensor and device control
Interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

ColinR

As an addendum:

Form Factor

This is another place where I can using a thermistor.

If you need SMALL SMT devices, throw a resistor and SMT thermistor on there and call it good.

You can get DS18B20 SMT, in SO and uSOP, but they're not as tiny as some thermistors.

For the record, you can also get a DS2438 in an SOIC, which you can use to monitor temperature, voltage, AND current. Yes, they'll cost you $2, but man that's pretty cool functionality.
CuPID Controls :: Open Source browser-based sensor and device control
Interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

EdM

Just getting started with the Moteinos, and I stumbled across this thread.  Thought I would throw in a link to my experiments with the DS18b20's:

http://edwardmallon.wordpress.com/2015/03/01/using-ds18b20-sensors-to-make-a-diy-thermistor-string-pt-1-the-build/

for these underwater sensors, the decision to go with one-wire was based primarily on multi-drop & long distances. The challenge is that "research grade" thermistor strings deliver considerably better accuracy than the +-0.5C I get from the DS18b20s (but they also run $100-$200 per sensor node) I will be happy to get the DS18's  to a more modest +- 0.2C if I can.


ColinR

I knew that looked familiar. I got a pingback from that site to my CuPID Controls blog. Cool project.

Cheers,
C
CuPID Controls :: Open Source browser-based sensor and device control
Interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

jra

DS18B20's are also pretty rugged.  I wired one up backwards the other day, reversed Vcc and ground.  By the time I shut it off it had already melted through the plastic bag it was in along with the dupont connectors it was plugged into.  After powering it off and correcting the wiring it still worked good as new.  If you don't need long cable runs and are looking for an SMD package, the MCP9808 is also a decent pre-calibrated alternative and probably a bit cheaper than the OneWire components.

EdM

Just thought I would post a little progress report on our use of DS18b20's. I think we finally have a procedure to calibrate them to the point where they compare well with commercial kit:

http://edwardmallon.wordpress.com/2016/03/05/ds18b20-calibration-we-finally-nailed-it/

It's almost more work to calibrate these sensors than actually building the loggers themselves, but the thing to keep in mind is our typical installation uses somewhere near 50 temperature sensors, and the signals we are looking at only span 1 degree C if we are lucky.  So even at the low end of the market an installation like that would cost somewhere between $5-7 thousand bucks. So it's worth the effort for us, though that's probably not the case for everyone.

Felix


WhiteHare

Quote from: EdM on March 07, 2016, 01:42:14 PM
Just thought I would post a little progress report on our use of DS18b20's. I think we finally have a procedure to calibrate them to the point where they compare well with commercial kit:

http://edwardmallon.wordpress.com/2016/03/05/ds18b20-calibration-we-finally-nailed-it/

It's almost more work to calibrate these sensors than actually building the loggers themselves, but the thing to keep in mind is our typical installation uses somewhere near 50 temperature sensors, and the signals we are looking at only span 1 degree C if we are lucky.  So even at the low end of the market an installation like that would cost somewhere between $5-7 thousand bucks. So it's worth the effort for us, though that's probably not the case for everyone.

I guess your reason for the "dry well" was to keep water out of the sensor body so that any post-test residual wold not be sealed inside when you subsequently epoxied it?

I would think that rather than incur the thermal mass of the metal probe tip plus epoxy around the sensor, you might prefer to waterproof just the DS18b20 leads and have the DS18b20 plastic package in direct contact with the water.  Is the DS18b20 plastic package not waterproof enough for that?

perky

I've just had that problem to solve, specifically detecting when the ambient (PCB temperature) was below -10degC or above +50degC. I ended up using a potential divider with a 1% 10k top resistor, a 1% 10k NTC thermistor for the bottom resistor (TDK B57330V2103F260, 0603 package) and a 10nF smoothing cap into an ADC input on a micro. This is fed from the top by a switched voltage reference (LM4040, 2.048V) which is also the voltage reference for the A2D so ratiometric and invariant to reference tolerance. Simple and accurate enough for my purposes.
Mark.