Low cost temp sensor

First off I'm new here and new to Arduino and I have a lot to learn!

OK, I have a project idea that will require 6-8 temp sensors with most of the temps being in the range of 0C to 75C and more typically 15C to 50C. I do have one or more temps that could be below 0C and perhaps as low as -40C as this will be the ambient temp sensor so it could be below freezing.

So, looking about there appears to be several options like the TMP36 or the DS18B20 with the first being cheaper but requiring a dedicated analog input pin for each sensor while the second one is more expensive but would not require any analog pins as best I can tell. I should mention that in addition to the Mega2560 (real one) I also have a Teensy 3.6.

My project idea, which I hope to bring to market at some point, would benefit from the cheapest solution possible given the need for 6-8 temp readings and even at $1.50 each that would bring the parts cost to perhaps $10 or more just for the temp values -- I have several other sensors (current, fan speed) as well as several voltage readings I need to make so anywhere I can save money would be an advantage.

So, while it looks like the TMP36 is probably the better choice from a cost standpoint and offers a range of -40C to 125C which is perfect for my application are there cheaper options that have a comparable range? The DS18B20, though more expensive, might be preferred if the number of analog inputs becomes a problem as it might with the Mega2560 so I plan to test this part out for S&G's if nothing else. But, to use this temp sensor, and actually to use 6-8 of them, would involve the appropriate wiring and coding including the necessary #includes and #defines. So, if there is a pointer to where I could learn more about the coding requirements for the DS18B20 I would appreciate that. OTH, if there is a better/cheaper temp sensor using 1-wire, SPI or I2C I'm all ears.

Brian

The Mega has 16 analogue pins. I think the DS18B20 is only good for -25, so you need to check that. If it is OK for that, the DS18B20 is a good choice as it s easy to work with, getting decent accuracy over a wide range.

Nick_Pyner:
The Mega has 16 analogue pins. I think the DS18B20 is only good for -25, so you need to check that. If it is OK for that, the DS18B20 is a good choice as it s easy to work with, getting decent accuracy over a wide range.
http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html

Thanks Nick, I think -25C is probably low enough though being able to get to -40C would be preferred. Yes, the 16 analog pins of the Mega should be enough as my rough count is at 14, but on the chance I need to add a few more I need to look at alternatives. The Teensy 3.6 should get me more like 23 analog inputs so that could alleviate the problem. Still, always good to have a couple alternatives in case one doesn't work out.

Brian

It's always best to consult the datasheet. The DS18B20 datasheet says:

  • Measures Temperatures from -55°C to +125°C (-67°F to +257°F)
  • ±0.5°C Accuracy from -10°C to +85°C

P.S. banggood.com has 10 DS18B20 for about $1US

Pete

el_supremo:
It's always best to consult the datasheet. The DS18B20 datasheet says:P.S. banggood.com has 10 DS18B20 for about $1US

Pete

Thanks Pete, very helpful. If the Banggood items is workable that would largely eliminate my cost concern so long as that kind of price was something I could count on.

I just poked around the Banggood website and there are quite a few listings of the DS18B20 ranging from the TO-92 package to the small boards with the TO-92 sensor on it. Price now appears to be more like $0.95 per at this point when ordering 10 or more.

Brian

A thermistor + resistor is the cheapest option (<=US$0.25).
Downside is a decreasing resolution above and below a fixed point (e.g. room temp).
Maybe ok for 15-50C. Search for 10k thermistor on ebay.

Not sure what temp accuracy you expect.
The DS18B20 might be the only option if you don't want to calibrate every setup.
Leo..

Wawa:
A thermistor + resistor is the cheapest option (<=US$0.25).
Downside is a decreasing resolution above and below a fixed point (e.g. room temp).
Maybe ok for 15-50C. Search for 10k thermistor on ebay.

Not sure what temp accuracy you expect.
The DS18B20 might be the only option if you don't want to calibrate every setup.
Leo..

Thanks Leo, I could probably get by with 1.5C accuracy but I'd prefer better if possible. Thermistors are an option for sure, but that would almost certainly require some form of calibration which wouild add to the cost of production. The DS18B20 option might make using a cheaper Arduino board usable so I'll probably order 10 or 20 of them and see what I see...

Brian

The DS18B20 can be had for well under USD 0.50 even in single units, the moment you go to a manufacturer to have your boards produced price should be even less. Thermistors are also highly accurate and don't need calibration, and they are pennies a piece (just saw them offered at about USD 0.80 for 50 pcs).

But is it a sensor that's suitable for your application? Are you measuring air or water temperature or something else? If air, what's the expected humidity range? What's the expected wire length from the sensor to your Arduino?

If you use the DS18B20, you need to consider the possibility of a failure/replacement in the field and how the code will handle a new address.

Cheapest my a country mile is NTC thermistors, cheap, reliable, accurate, and available in loads of packages. Also 2 wire and can be run 100s of metres as their relative resistance to wire resistance is minimal.

Most are defined by their resistance at 25°C, so 10K thermistor has 10kΩ resistance at 25°. Put it and a voltage divider on an analogue input and it'll be more accurate than the resolution from an Arduino input.

Good luck with your project.

Problem with the TMP36 (or LM35) is that temp readout depends on Aref.
If Aref (5volt) drops, temp display goes up with the same percentage.
1.1volt Aref can be used to make temp supply independent and increase resolution.
But Aref is different for every single Arduino. So Aref for each setup has to be calibrated.

A thermistor/resistor is ratiometric (supply independent).
Initial accuracy (between thermistors in the system) depends on thermistor and pull up resistor tolerances.
As said before, a thermistor has a narrow high resolution band.
The highest number of A/D values per degree if R and Th have the same value.
You have to do the calculations if -40C and +75C give acceptable resolutions.
There are "thermistor resistance by temp" tables online.

The DS18B20 has the same high resolution across the entire temp range.
And 0.5C accurate without final calibration.
Very easy to set up if you use e.g.
sensors.requestTemperatures();
temp1 = sensors.getTempCByIndex(0);
temp2 = sensors.getTempCByIndex(1);
temp3 = sensors.getTempCByIndex(2);
etc.
Leo..

Raptor1956:
First off I'm new here and new to Arduino and I have a lot to learn!

OK, I have a project idea that will require 6-8 temp sensors with most of the temps being in the range of 0C to 75C and more typically 15C to 50C. I do have one or more temps that could be below 0C and perhaps as low as -40C as this will be the ambient temp sensor so it could be below freezing.

So, looking about there appears to be several options like the TMP36 or the DS18B20 with the first being cheaper but requiring a dedicated analog input pin for each sensor while the second one is more expensive but would not require any analog pins as best I can tell. I should mention that in addition to the Mega2560 (real one) I also have a Teensy 3.6.

My project idea, which I hope to bring to market at some point, would benefit from the cheapest solution possible given the need for 6-8 temp readings and even at $1.50 each that would bring the parts cost to perhaps $10 or more just for the temp values -- I have several other sensors (current, fan speed) as well as several voltage readings I need to make so anywhere I can save money would be an advantage.

So, while it looks like the TMP36 is probably the better choice from a cost standpoint and offers a range of -40C to 125C which is perfect for my application are there cheaper options that have a comparable range? The DS18B20, though more expensive, might be preferred if the number of analog inputs becomes a problem as it might with the Mega2560 so I plan to test this part out for S&G's if nothing else. But, to use this temp sensor, and actually to use 6-8 of them, would involve the appropriate wiring and coding including the necessary #includes and #defines. So, if there is a pointer to where I could learn more about the coding requirements for the DS18B20 I would appreciate that. OTH, if there is a better/cheaper temp sensor using 1-wire, SPI or I2C I'm all ears.

Brian

your cost of components will never even come close to the labor cost of assembling your project. Concentrate on ease of assembly, after building one or two prototypes.

Paul

Signal diodes make the cheapest temperature sensors, just feed a constant current and measure the
voltage. They do need calibration and the voltage is a bit low, but they are cheap.

I am running simultaneously 10 DS18B20's to monitor input and output temperatures in my floor heating system, with display on a 3.5inch TFT screen (all ten temperatures plus relative room humidity displayed on one screen), and powered by one Arduino Nano. Temperatures are in the 18-23 degrees Celsius range, as I hate cold feet ( ;-). No below-zero centigrade temperatures in my living room.

I am working on serial communication to connect this unit to a logging device (an Arduino fitted with an RTC-SD card shield) which will log 10 temperatures to file.

I am very happy with DS18B20's because they need only one pin on the Nano (plus 5V and GND but that's no deal). A description of the project, including pictures, wiring and sketch, is to be found on: (11) Temperatures in floor heating loops - Zonnestroompanelen in Nederland

photoncatcher:
I am working on serial communication to connect this unit to a logging device (an Arduino fitted with an RTC-SD card shield) which will log 10 temperatures to file.

Sounds rather like using two Arduinos where one would surely suffice.

Paul_KD7HB:
your cost of components will never even come close to the labor cost of assembling your project. Concentrate on ease of assembly, after building one or two prototypes.

Paul

Yep, I do appreciate that assembly cost will likely be a significant fraction of the total price but in this application is unlikely to be more than the parts count, but keeping all cost down is always desirable. I'm reluctant to go into much detail about the final product at this time but my guesstimate for the sale price is in the $400-$500 USD range -- temp sensors are just a fraction of the total parts count which would include a 3" to 5" LCD touch screen for UI.

Brian

Hi Nick, we had a discussion before on this topic. My Nano equipped with the 10 DS18B20 sensors does a good job and the presentation off all readouts on a 3.5 inch 320x480 TFT display is terrific (see picture). This comes at a prince, that is, occupied pins on the Nano and sketch size.
Sensing and Logging on SD card of 10 temperature values has its own price, too. With some tricks I managed to get 10 temp readings in my log file, but the logging became, say, erratic when I tried to see the temperatures simultaneously on a modest 20x4 LCD display and even in Serial Monitor. 'T' spiltting the DS18B20 data wire to a display-Nano and a logging-Nano is in conflict with the one-wire concept of the sensor, although data come through now and then. I don't have a Mega to do the job while there is a tinkerbox full of Nano's available.

floorheating_figure_09.jpg

Well, if you have Nanos to hand, who am I to quibble? Your installation looks pretty neat.

Sensing and Logging on SD card of 10 temperature values has its own price, too. With some tricks I managed to get 10 temp readings in my log file, but the logging became, say, erratic

This sounds like you might be reading the sensors too fast - probably faster than you need to.

'T' spiltting the DS18B20 data wire to a display-Nano and a logging-Nano is in conflict with the one-wire concept of the sensor, although data come through now and then.

I don't understand this. I would assume one Nano reads the sensors and sends the result to the other by serial.