GOAT logo

Join the conversation! The forum activity is now at GOATeach.org!  We are working to cross pollinate our conversations. Document and share tools at farm hack and talk at GOAT!  Also join GOAT riot and introduce yourself and your projects!

Temperature Sensor Talk

Topic Type: 
Information

I've been playing with quite a few different temperature sensors over the past few months and I just thought I'd post some kind of summary about it. I may turn this into a wiki entry once I've gotten some feedback, improvements.

Temperature Sensors

Like most sensors, you can break temperature sensors into two different categories: analog and digital.

The trade-off is that analog sensors require an Analog-to-Digital Converter (ADC) to make their information useful to a microcontroller which have some inaccuracies depending on resolution and on the reliability of the voltage regulator. The Arduino, for example, has 6 ADC pins and has a resolution of 10 bits (range of 0-1023). This resolution is important because it means that a reading of 1023 either means you are reading anywhere from 4.995 to 5V (that is, 5 minus a step size (5V/1023). Additionally, the on-board voltage regulator gives +/- 0.075V (5V +/- 1.5%) which adds more inaccuracies to your readings. These are worth keeping track of in addition to the sensors own inherent inaccuracies.

One trick to improving accuracy, however, is to use the Arduino's 3.3V instead, assuming your sensor is OK with that. Just remember to give the analog-reference (AREF) pin the voltage so that the resolution can be scaled to that!

The big advantage of analog sensors is that you don't need to learn a digital protocol to get them. Just ask your ADC for readings, convert them using floating-point arithmetic. There's a little snag here, since that can be kind of slow, but using look-up tables (here's an example) can speed things up.

Now why use digital sensors at all? Well first off, you don't have to worry about the inaccuracies from the ADC. Additionally, they tend to have some nice features.

The Dallas One-Wire allows you to put TONS of them on one digital pin! Now, this is possible with analog senors too and you could either average them out in the analog world or you a MUX chip if you wanted to preserve each reading individually, but it's really easy with these One-Wire sensors and probably faster than if you used a MUX (unconfirmed). I think that these might also run faster than analog depending on the accuracy that you've configured them for.

The DHT11 and DHT22 are also pretty neat because they'll give you temperature and humidity readings on one digital pin (you can't stack a bunch of these on one pin though like Dallas One-Wire).

Analog Examples:

  • Resistor Based (Thermistor): logarithmic arithmetic to convert, higher current draw than diode
  • Diode Based (TMP36, LM335): linear to convert, lower current draw than resistor
  • Thermocouple (Omega Selection Guide): can take deal with extreme heat and cold, much noisier than resistor and diode based within human-bearable temperatures, requires complex circuit for readings (single, quad (currently unavailable)

Digital Example:

3rdstephenson's picture

Thank you very much for your information. I know this sensor is really useful. I might buy one soon. I started searching this but no one could ever provide me the benefit of the temperature sensor. Again thank you

3rdstephenson's picture

Hi Louis, I just want to ask are you referring to this sensor? Since there's a lot of sensors that can measure the temperature   https://www.abestmeter.com/electronic-water-level-switch/.