2014/02/08

TMP006

Measuring temperature is a common task. Luckily, many electrical quantities change with temperature. Well, luckily… sometimes it is a big bugger. Diodes change their forward voltage, resistors change their resistance and thermocouples their voltage. There is a plenty of temperature sensors out there but not all are created equal. I was always fascinated by contactless themometers. Heck, I use IR themometer when I cook all the time. And that is why I ordered this:

TMP006
The TMP006 is a contactless temperature sensor from Texas Instruments, an infrared thermopile. Unfortunately in tiny BGA package with 8 balls and 0.5 mm pitch. It has a thermocouple inside which is heated by the radiation of the measured object. But because it has to be connected to the rest of the die somehow, it is also heated by the die/board itself. So there is another temperature sensor, this time sensing the local temperature. Then, from the difference between these temperatures, you can calculate the temperature of the measured object. It is not very straightforward but TI have provided a user guide with the necessary equations. Some specs? Well, the range is -40 to 125 °C and it is connected via I2C. It can make 4 readings per second but it is more recommended to take just one per sec (lowering the noise of course).

How to solder
For a casual diyer its BGA package is a problem. Furthermore, there is a recommended layout which I reckon would be good to follow to get the best accuracy. There are breakout boards from Sparkfun as well as from Adafruit both for 15 $. I decided to design my own breakout board and have it manufactured in a local PCB company. I followed the TI's guidelines and made a small breakout with the TMP006 and one bypass capacitor of 0603 size. And with such a board, it is actually not so hard to solder the chip.
Silkscreen is necessary to precisely align the chip. And a magnifying glass. But before doing so, you have to use a good flux because the little balls on the bottom do not have any. I used some tacky Chipquik flux. 
The bypass capacitor makes a good indicator of the reflow process. If you use a lead-free solder paste, it will reflow at about the same time as the balls on the BGA. I use a crude hotplate for reflow soldering – a 4 mm thick duralumin plate heated by a regular gas stove. I am at the reflow temperature after 3–4 minutes. It is a poor-man reflow setup but so far it worked every time. The plate is covered with Kapton tape so I can take temperature readings using an infrared themometer (the duralumin has a hard-to-determine emissivity).
Maybe i was just lucky but it reflowed correctly. Unlike larger BGAs, you can check all the connections visually because they are on the sides (you only need a microscope or magnifying glass). Finally, I soldered the pinheads and was almost ready to go.

After soldering
For the best accuracy, you have to clean the board thoroughly, preferably in ultrasonic bath. I am lucky to have one industrial ultrasonic bath in my lab so it was no problem. But you can get a cheap ultrasonic bath for less than 30 € these days. TI recommends demineralized water. The final product of my effort was ready…

TMP006 on a very basic custom breakout board.

Calibration
I used Arduino for I2C communication and it went with no problems. So I got it connected and now for calibration… yes, the chip is not factory-calibrated. You have to DIY. And it is not that easy because it measures surface temperature, which tends to be different from the bulk temperature. Calibrating it with a contact thermometer could lead to serious errors. Just make a cup of coffee/tea and measure its surface temperature and its bulk temperature. They can easily differ by 10 °C.
So it is best to calibrate it with another IR themometer. Or thermal imaging camera. I have access to both so I used Flir i7 because it is just more fun than an IR thermometer. But both will suffice.
For calibration, I used a cup of tea (65 °C) and a bottle of Becherovka from the fridge (-14 °C). And a piece of paper for the ambient temperature (22 °C).
After some math magic, you are supposed to get a linear correlation and finally calculate a single value which is then used for calculation of the temperature of measured object. However, to my surprise, the calibration values weren't on a straight line. 

The catch
It turned out the sensor had a major flaw. The object being measured does not only change the thermocouple's temperature but also the board temperature so the final calculation is inaccurate. Very inaccurate until some kind of equlibrium is established. And that can take a loooong time. It is obvious if you think about it but it is not so obvious why TI didn't account for this. And apparently, I am not the only one who noticed so TI published a workaround paper that shows how to compensate for the change in board temperature. It is done by processing 4 consecutive samples. I did that and it worked. 

The bottom line
So finally, I got a sensor that was measuring temperature with about +/- 3°C uncertainty. Which is nothing special but remember this is a (relatively) low-cost contactless sensor. So after all, it is not that bad.
There is actually a pretty cool project using the TMP006 available on Instructables – an Arduino controlled coaster which changes backlight according to the cup's temperature. So, would you use this sensor?

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Can you please upload the PCB design?

    ReplyDelete
    Replies
    1. No problem! https://drive.google.com/open?id=0B7G3xJXZNLUpfnVaa0hoYktSYTZZYXNjd19WTlZwSDc2YWlvVWEwWHRrUDZldWtyeS1yak0

      Delete