Enginursday: A Qwiic Comparison of Temperature Sensors

Comparing analog and digital temperature sensors TMP36, TMP102 and TMP117. Which is better?

Favorited Favorite 0

It all started when I wanted to measure the ambient temperature of a room at SparkFun. But what is the best option? Well, it depends on what you are looking for in your project. Let's compare three temperature sensors from the SparkFun catalog!

Temperature Sensor - TMP36

Temperature Sensor - TMP36

SEN-10988
$1.60
18
SparkFun Digital Temperature Sensor Breakout - TMP102

SparkFun Digital Temperature Sensor Breakout - TMP102

SEN-13314
$5.50
6
SparkFun High Precision Temperature Sensor - TMP117 (Qwiic)

SparkFun High Precision Temperature Sensor - TMP117 (Qwiic)

SEN-15805
$14.95
4

My initial choice was to grab the TMP36 from my parts kit. It only required three connections and an analog pin. However, after viewing the output, I noticed a majority of the time that the temperature would jump 1°F to 2°F. At other times, the value would spike. Unsatisfied, I placed the project off to the side as this would require a bit more planning to average the values and add additional parts in order to throw out the errors.

TMP36 Output on the Arduino Serial Plotter

Click image for a closer view.

The project sat there on my desk for a bit until I noticed the TMP117 high precision digital temperature sensor in the catalog. I thought it would be a good opportunity to revive the project and see if I could obtain more stable readings using a different temperature sensor. I decided to compare the TMP36 against the TMP102 and TMP117. I wrote some code [1] to output the readings to the Arduino Serial Plotter.

Looking at the TMP102, it performed better than the TMP36 when measuring the ambient temperature of the room. The temperature readings remained stable and it was not as noisy. The temperature readings for the TMP117 performed better than the TMP102 and TMP36. The data points were more smooth and less prone to noise.

TMP117 vs TMP102 vs TMP36

Click image for a closer view.

Good, Better, Best?

So, you might ask, which of the three temperature sensors is the best? Well, that really depends on how you plan to use it. In my opinion, the Qwiic TMP117 is a winner. The sensors performed as expected when looking at the datasheet. The board did not require any soldering. There was no additional circuitry or code needed to average the temperature sensor readings. The power supply did not cause as much of a fluctuation with the digital temperature sensors like it did with the analog temperature sensor.

The TMP102 could work as well if I was not looking for such a precise temperature reading. While it is not as expensive as the TMP117, it does require some soldering for this version of the TMP102 board. The TMP36 is good but it would require a bit more effort to filter out the errors.


What is your favorite temperature sensor to work with in your projects? Until next time - I'm off to build my digital indoor thermometer!


Comments 6 comments

  • tbitson / about 4 years ago / 3

    While not quite as easy to setup as the sensors in the article, the 1-wire DS18B20 has always been my favorite. Once the right library is installed and the device’s address is known, they’re pretty easy to use. I’ve had over eight sensors at 100 feet away providing reliable temperature data for over a year, on a simple twisted pair cable.

    For higher resolution and/or speed, the TMP102 gets the nod.

    • I have tested the DS18B20 briefly. It is an alternative option for that distance using its the digital output. This was one of the temperature sensors that I was considering to use for the comparison but I wanted to make it simple by using only three. There is also the waterproof version that makes it a good option for those measuring objects in water or when exposing the sensor to the raw elements. The other temperature sensors would need some waterproofing or special enclosure to protect the sensor while also providing sufficient air flow.

  • Member #1550958 / about 4 years ago / 2

    I have 11 temperature sensors in and near my house. They are of four different models, none of which are on your list.

    AM2302, AKA DHT22: These are inexpensive, but use a nonstandard protocol. The connection is simple enough -- one (unshared) digital pin, a pull-up resistor, power, and ground. The Arduino library is solid and easy to use, including several sensors on the same MCU. The temperature measurements are probably within a degree, though some sensors are repeatably a little higher than others. The humidity measurements vary wildly between sensors, but more in parallel. There's a way to get the sensor moisture content to a known state. You're supposed to do it when the sensor is new and then every year or so, but I've never done it, so that's probably my error.

    AM2320 -- this is basically a DHT22 with an I2C interface and slightly better specs. It's also pretty inexpensive. Temperature measurements are probalby within half a degree, and I've never paid much attention to the humidity measurements. The I2C interface promises to let a bunch of sensors share one pair of digital pins, but there's no way to change the I2C address. Again, hookup is pretty easy and the Arduino library is solid. This means you actually need more pins than with a DHT22. (You can share one of the I2C pins between busses, so N sensors means N+1 pins)

    DS18B20 -- This is the one I have outside, because I could find a sealed version. The sealed version was substantially more expensive than the others, but there are cheaper non-sealed DS18B20 sensors. It's temperature only, and uses the 1-wire protocol -- one digital pin, power, and ground. I don't recall any trouble with the software, and I've never tried hooking up more than one to the same bus.

    BME280 -- a little more expensive than the AM23xx sensors, and considerably better specs. Measures termperature, probably to within 0.1 degrees, humidity, and barometric pressure. IIRC, the humidity sensor doesn't the periodic moisture resetting. The pressure sensor is easily sensitive enough to measure a difference between the floor and ceiling, but calibration differences between sensors are several times larger. Uses I2C, but (at least with my breakout boards) only two I2C addresses were available, so you still end up needing an average of one pin per sensor. I don't recall any trouble with the Arduino library.

    The BME280 does have one quirk, though -- in the default mode, it reads high by about 2 degrees due to self-heating. Essentially, it's taking measurements almost continuously and using power doing so. To avoid this, put it into "weather station" mode; this is described in the datasheet and took a little figuring out.

    In spite of that, I like the BME280. It's probably what I'll buy if I ever need more indoor temperature sensors.

    There's a serious comparison of temperature+humidity sensors here, though it is focused on the humidity measurements more than the temperature portion.

    • Ah cool. For the comparison, I wanted to keep it simple with only temperature measurements. The humidity/temperature sensors lowers the cost and it has the advantage of measuring the moisture in the air. However, I've read that condensation can affect the accuracy of the temperature readings depending on it's location. I've tested the DHT22, Si7021, and BME280 briefly but I have not personally looked at the data in-depth to compare. I'll have to revisit the comparison using a few of those sensors. ;) The link you provided is a good comparison. =)

  • DonQ / about 4 years ago * / 2

    I would look a little closer at your data for the TMP36. When it changes from 68 to 72, the bits go from:

    10001001
    10010001
    

    That single-bit shift looks suspiciously like a problem with the process of digitizing the analog voltage. Again, when it goes from 55 to 72, the bits go from:

    0110111
    1001000
    

    What are the odds that all the bits would reverse between readings? I've been using sensors like these for ages and have never seen these sort of errors with these sensors (I have seen worse with some other sensors, but not bit-correlated like these readings). Of course, I also have never used "libraries" without thoroughly testing it first. You might want to look a little closer because this error is almost certainly not with the analog voltage output from the sensor.

    • I was using an analog input on the ATmega328P to read the TMP36 without a library. The spike between 55 to 72 was surprising to me as well. I have seen several projects using the TMP36 so I was quite perplexed. I suspect the error might have been caused by the sensor being connected on a breadboard and there was no decoupling capacitor. Soldering to the sensor for a reliable connection and adding a capacitor would have helped clean the signal. I probably could have used a different reference voltage as well or averaged a few readings together to make the reading stable.

      I'll have to revisit the TMP36 another day. The TMP102 and TMP117 cost a bit more. However, they do not require as much effort to deal with the noise and errors.

Related Posts

Recent Posts

Why L-Band?

Tags


All Tags