loading

While studying in university we were challenged as part of a course work into designing a box with very accurate temperature control. If the project were to succeed, multiple boxes were to be built and used in a research project studying the effect of surface material on the perceived temperature of flooring and other building materials.

The project was deemed as very challenging by the university staff because the temperature inside the boxes should stay within ± 0.1°C of the desired value.

Therefore we would require the most accurate temperature sensor we could find. On one hand, the sensor should be factory calibrated to the desired temperature, because calibrating to within 0.1°C of the national temperature standard is next to impossible on a simple setup of boiling and freezing water. On the other hand, an analog temperature sensor with a proclaimed accuracy of ± 0.1°C might still produce inaccurate results after the value is converted to a digital value by an ADC (https://en.wikipedia.org/wiki/Analog-to-digital_converter).

The only solution we could find was to use the TSYS01 digital output single chip temperature sensor by Measurement Specialties and communicate with it using a Arduino microcontroller.

In this instructable I will explain how to use the TSYS01 Temperature Sensor Board with an Arduino microcontroller for very accurate temperature measurements. If you have never used an Arduino microcontroller you can get started by using this instructable: https://www.instructables.com/id/Intro-to-Arduino/ I will not go into detail on how to use the Arduino platform on this instructable, but will only focus on the usage of the TSYS01 temperature sensor board with an Arduino.

Step 1: Introduction of the TSYS01 and the Temperature Sensor Board.

With the correct peripheral circuit TSYS01 can give provide ±0.1°C accuracy between -5°C and +50 °C. It's 24 bit ADC conversion result is factory calibrated separately for each chip with a 4th degree polynomial. It has low self heating and a small time constant for a single chip sensor. The 24 bit ADC can provide enough resolution for any application(more than 0.0001°C), but some noise can be seen in the output if using more than 0.01°C of the resolution. The very low measurement noise of the sensor can for example enable you to use time constant compensation based on the current rate of temperature change without unbearable measurement noise. The sensor output and a value with software compensation of 4 s time constant during a transition from room temperature to finger temperature can be seen in the graph above. The full measurement range of the sensor is from -40°C to 125°C, but the accuracy of the sensor is only ±0.5°C outside the -5°C to +50°C temperature range.

The downside of the TSYS01 is that it is remarkably difficult to use without a nicely designed temperature sensor board. The 4mm by 4mm QFN16 package is a surface mount device, an therefore needs a soldering oven. Additionally the part needs a very stable 3.3V voltage source, a 100 nF capacitor very close to the chip and can only tolerate 3.3V logic level signals. Additionally programming your micro controller to interface with the device using SPI or I2C can be difficult, if you are not very familiar with neither of them(these are the interfaces supported by the sensor).

In the university project we had to design our own temperature sensor board, get the PCBs professionally manufactured, solder the components our selves and implement the SPI communication code, because no temperature sensor board for the sensor was available in the market at that time.

Now it is possible to buy a temperature sensor board that solves these difficulties for hobbyists and use it with an opensource Arduino driver! The board has a 3.3V linear regulator providing low noise power for the sensor, includes the required capacitor, is 2.54mm bread board compatible(!!) requiring no soldering oven, protects the sensor from over voltage, reverse voltage and electrostatic discharge. Therefore, it is now much easier to use for hobbyists, researchers and people doing prototype work for a company.

Step 2: Sourcing the Parts

To follow this instructable you need an Arduino compatible micro controller, the TSYS01 Temperature Sensor Board, a programming cable/device for your micro controller and the jumper wires to connect the temperature sensor board to the microcontroller.

Additionally, if your Arduino is a 5V logic level device, you should consider using a 5V to 3.3V logic level converter. This project will most likely also work without a logic level converter on a 5V Arduino, because the over voltage protection should protect the 3.3V temperature sensor, but using the over voltage protection for level shifting is a bad decision in terms of long term reliability. The safest option is to buy a 3.3V Arduino device. I am using the 3.3V 8MHz Pro Mini. That being said, I have tested the TSYS01 temperature sensor board with a 5V Arduino Nano without any issues. I have also accidentally connected 12V to the logic level pins of the device and it has been fine. My experience is that the over voltage protection relying on resistors and schottky diodes works fine.

I am suggesting to buy most of the stuff you need from the Elecrow webshop (http://www.elecrow.com/), because it is currently the only place to buy the TSYS01 Temperature Sensor Board and you can get most of the stuff you need with only one order and at the same time. If you are using the Arduino Pro Mini, you will also need some tin and access to a soldering iron to solder in the pins.

Bill of Materials for My Setup:

* TSYS01 Temperature Sensor Board, 25$ from http://www.elecrow.com/tsys01-temperature-sensor-b...

* 3.3V 8 MHz Arduino Pro Mini + USB Serial Converter, ~7$: (Search ebay for: Pro Mini atmega328 3.3V 8M Arduino Compatible+CP2102 USB 2.0 to UART TTL module). Make sure the description says that it is the 3.3V version.

* Bread Board, 4.50$: http://www.elecrow.com/16555cm-bread-board-with-sl...

* Male-Female Jumper Wires x 7, 2.80$: http://www.elecrow.com/254mm-femalemale-jumper-wi...

* Female-Female Jumper Wires x 5, 2.80$: http://www.elecrow.com/40-pin-dual-female-splittab...

For 5V Arduino owners:

* You should by logic level converter for high reliability and make your own setup regarding that.

* If you only want to test the TSYS01 Temperature Sensor Board without a logic level converter, it will most likely work, but I won't be responsible if it doesn't.

* You can buy a 3.3V Pro Mini clones really cheap from eBay, why not buy one and be safe? (Search ebay for: "Pro Mini atmega328 3.3V 8M Arduino Compatible+CP2102 USB 2.0 to UART TTL module") Make sure the description says that it is the 3.3V version.

Step 3: Choose Between I2C and SPI

The TSYS01 Temperature Sensor Board supports SPI and I2C communication. You will have to decide for one of them and connect the sensor board for one of them. The connection you are using should similarly reflect the settings you are using in your sketch.

I2C

The I2C connection requires only two data lines to be connected to the temperature sensor board. It also allows multiple devices to share the same two data lines: SDA(data signal goes here) and SCL(clock signal for timing). Selecting the preferred device to communicate with is done by sending a unique I2C address before sending the data packets. At the default Arduino transmission speeds, however I2C is much slower than SPI. Additionally I2C can only pull signal lines down to ground level. The signal level high is acchieved by using two resistors: One between 3.3V and SDA, and the other between 3.3V and SCL. This makes the signal levels to go to 3.3V if the I2C device is not actively pulling the lines down. Atleast most Arduinos should have internal pull-up resistors for the I2C data lines. However, in some cases these internal pull-up resistors may not be enough and external resistors with lower resistance values should be added.

SPI

The SPI connection requires more data lines than I2C, but is also faster, simpler and able to pull signal levels up without additional resistors. The signal lines required are: MOSI(data from master to slave), MISO

(data from slave to master), SCLK(clock signal) and CS(chip select). Because SPI has seperate data lines for different transmission directions, the data can simultaneously be transferred in both direction(not possible on I2C). The MOSI, MISO and SCLK data lines can be shared between multiple SPI devices, but the CS pin has to be used seperately for each device, because it is used to select the preferred device to communicate with. If you have enough available pins on your microcontroller, this is probably the better communication method to choose.

Step 4: Connecting the TSYS01 Temperature Sensor Board to Arduino

You should connect the TSYS01 for the communication method you chose in the previous step. The pin numbers for Arduino Pro mini are given in the brackets. If you are using another arduino, you should check the correct pin numbers yourself.

For I2C:

Board connection:
Arduino <-> TSYS01 Sensor Board

------------------------

3.3V - 12V (VCC) <-> Vin

GND <-> GND

SCL(A5) <-> SCLK/SCL

SDA(A4) <-> MOSI/SDA

Optionally you can also use:

A0 <-> Shutdown (If you want to use the shutdown feature of the board for reduced power consumption)

GND <-> CS/ADDR (If you want to use the alternative I2C address for the board. This is required to get two different sensor working on the same I2C bus.)

For SPI:
Board connection:

Arduino <-> TSYS01 Sensor Board

------------------------

3.3V - 12V(VCC) <-> Vin

GND <-> GND

SCLK(13) <-> SCLK/SCL

MOSI(11) <-> MOSI/SDA

MISO(12) <-> MISO

10 <-> CS/ADDR

GND <-> MODE (To select SPI mode from temperature sensor board)

Optionally you can also use:

A0 <-> Shutdown (If you want to use the shutdown feature of the board for reduced power consumption)

Step 5: Download the Arduino Driver and Create a Sketch

The Arduino driver and some design files for the sensor board can be found from a Github repository: https://github.com/Ell-i/ELL-i-KiCAD-Boards After creating a sketch for you project in the Arduino IDE the easiest way to get the code is to download a zip file from the repository, extract it, navigate to

ELL-i-KiCAD-Boards/TSYS01/Arduino/ and copy the Tsys01.h and Tsys01.cpp files to the directory of your sketch. Now the library should be ready to use.

Next you can test the sensor with the following simple sketch if you chose SPI. If you want to use I2C instead, you only need to comment the SPI sensor object creation line and uncomment the I2C replacement.

Example sketch:

#include "Tsys01.h"

#define slaveSelectPin 10

#define powerPin A0

Tsys01* sensor;

void setup() {

Serial.begin(9600);

//Create SPI sensor object

sensor = new Tsys01(TSYS01_SPI, powerPin,slaveSelectPin);

//Create I2C sensor object

//sensor = new Tsys01(TSYS01_I2C, powerPin);

}

void loop() {

sensor->startAdc();

//Delay to wait ADC conversion to finish.

//9ms should be enough but let's wait 10 ms to be safe.

delay(10);

float temperature = sensor->readTemperature();

Serial.print("The temperature is: ");

Serial.println(temperature,6);

//Delay to read less often

delay(500);

}

Step 6: Use TSYS01 in Your Own Project!

Now you should be ready to use the TSYS01 temperature in your own sensor board. It is also easy to generate high resolution temperature graphs using the sensor. For example the temperature of the exhaust air of my cpu cooler before, during and after a stress test is shown in the picture above. The horisontal axle is seconds and the vertical axle is exhaus air temperature in celsius. Having an arduino attached to the TSYS01 makes for a really accurate DIY temperature probe for use with a computer whenever you may need it! The graph in this instructable were made by printing CSV from the Arduino to the serial port and writing the serial data to file with a Python script. The code for doing this can be found from: https://github.com/Apocalyt/spiTSYS01DataToCSV

<p>Very interesting Instructable. FOr some reason, I love to measure temperature.</p><p>I used to use the analog LM35 (not able to read negative degrees C) but accuracy &amp; calibration was always an issue.</p><p>Moved over to the Sensirion SHT21 I2C temp/humidity sensors, but was way too expensive.</p><p>Then I moved over to the Dallas DS18B20 one-wire temperature sensors to increase accuracy. No need for calibration (also internal factory calibrated). It is not as accurate as yours (0.0625 degrees steps) but works great as well.</p>
<p>Thank you. I agree that the Dallas DS18B20 is a easy, cheap and quite accurate sensor to use even though it doesn't reach the specification of the more expensive tsys01. (&plusmn;0.1&deg;C vs &plusmn;0.5&deg;C accuracy) ( 0.0001 vs 0.0625 resolution) (10 ms vs 750 interval between measurements) </p><p>Have you measured how much the temperature values vary between different measurements in the same temperature? I mean how much difference there is between successive measurements in constant temperature?</p><p>An interesting project/use for the tsys01 that comes to mind might be to calibrate cheaper temperature sensors for higher absolute accuracy. The low noise, high resolution and high accuracy should make this relatively easy with the tsys01. The calibrated sensor does ofcourse also need to be relatively low noise and high resolution and you would need to build a temperature controlled box of some kind. I think the process could be made quite automatic though.</p>
<p>Hi. Yes, I did quite a few tests using four DS18B20 sensors. Doing these tests, proved to be more difficult than I thought. Having the 4 sensors side by side on a breadboard, I noticed that the slightest airflow will create a difference between the 4 sensors. After placing the sensors in a plastic container, airflow changes were sorted out.</p><p>What I did find is that even in a plastic box, the sensor on the one side will read different from the sensor on the other side. By rotating the system, the readings changed accordingly. This differences in the readings was due to the radiated heat inside the room. I noticed almost a 5 degrees C difference in temp between the various walls. </p><p>Conclusion of tests - Readings are very close to each other between the 4 sensors. But left in air, they detect the slightest differences in temperatures. </p><p>To make the tests more reliable, I ended up mounting the 4 sensors between two aluminium plates. With this method, the temperature difference between the 4 sensors varied by most 2 bits up/down, or 0.125 degrees C.</p><p>I did some data logging over a 2 week period, taking a reading from each of the 4 sensors at 10 second intervals. The biggest deviation from the average of the 4 sensors were less than 0.5 degrees C.</p><p>The unit was later used for about 4 years as a weather station. It measured wet and dry bulb temperatures, system temperature, and inside temp. Each outdoor sensor was connected to the circuit via a 2.5m twin core microphone cable.</p>
<p>That was very interesting, thank you for sharing. From this I would deduce that the DS18B20 is quite a good sensor for the price.</p><p>I did some preliminary testing with two tsys01 sensors connected to one another through the copper pad in room temperature of about 20 degrees and I remember the difference being around 0.03 degrees C. However, I would need to design a longer experiment to get more reliable results. Very small differences in the room or the measurement setup could be affecting my result.</p>
<p>English isn't my native language, maybe I don't properly get your text but I understand that you write that using an analog sensor and convert with an ADC can produce errors. But tell me, what is your sensor if it's not an analog one with an ADC included ? I don't know any digital way to measure temperatures for now.</p>
<p>Then sensor itself is always going to be analog. In this sensor the analog circuit is confined inside the tsys01 QFN16 package of the temperature sensor. This means that the 24 bit ADC is inside the QFN16 package. The tsys01 chip communicates outside with digital signals.</p><p>The tsys01 doesn't contain a processing unit for converting the ADC values to actual temperature values. Instead the raw ADC values are sent to the Arduino which performs the conversion from ADC values to temperature. This is done because having the processing circuit next to the ADC like in the Arduino integrated ADCs will produce noise in the ADC result. Because the tsys01 sensor is far away from the processing unit of the Arduino, there is no noise caused by the operation of the processing unit affecting the ADC result. This also means that external ADCs have usually less noise than ones integrated into a microcontroller.<br><br>At the beginning of operation the Arduino has to retreive the calibration parameters specific to each tsys01 sensor from the sensor. By using these parameters it is possible to calculate the real temperature value usign a fourth degree polynomial in the Arduino. The driver provided in the github repository handles these things pretty automatically. You only need to initialize a sensor object, order the start of the ADC, wait for the conversion to finish and then read the temperature values(the driver converts the ADC results to temperature automatically).<br><br>This also means that if you have a calibrated sensor with an analog output the promised accuracy is not necessarily what you will get. The performance of the ADC you are adding after the analog sensor can still make the result worse.(It can never make it better.) The nice thing about digital output temperature sensors is that the manufacturer can provide a rating that will take account the ADC. If you want to get the best performance out of an analog sensor, you should propably consider using an external ADC. However, even then there is a change for some additional noise to get coupled to the measurement in the wires you are using to connect the analog sensor to the ADC. Because the connections between the ADC and the analog sensor inside the Tsys01 QFN16 package are very short, the should be very little noise getting coupled to them.</p>
<p>Very nice project. I was wondering if you thought about Texas Instruments LM34 or LM35 sensors. The LM35 has an output linearity proportional to the Centigrade Temperature. And it will handle 4 to 30 supply voltage range as well and only three pins setup. It has a +/- accuracies of 1/4 degree C at room temperatures and a range of -55C to +150C. I've used them before and they are extremely easy to use and very accurate also. Of course I am not taking anything from your nicely thought our project by any means. </p>
<p>The LM35 seems like a nice sensor and much easier to use than the tsys01 used in the temperature sensor board. However, the project the sensor board was originally designed for required a temperature sensor capable of atleast +/- 0.1 absolute accuracy at temperatures from 10 to 40 degree C. The tsys01 promises to provide +/- 0.1 degree accuracy from -5 to 50 degrees celsius and is therefore 2.5x as accurate as the LM35 in the desired range. The sensor board and driver obviously makes using the tsys01 much easier.</p><p>There is also a very low amount of measurement noise while using the tsys01, I can get almost a hundred samples per second for a few seconds and have all of the values be within 0.01 degrees celsius of each other in my room. For longer times than that the room temperature is not stable enough. The LM35 seems to require usage of the ADC microcontroller to read the temperature values, which will introduce its own noise and error to the measurement. ADCs integrated to a microcontroller usually have much more noise than the ADC in the tsys01, because the operation of the processor causes some noise in to the ADC reading. In the case of the original project the high resolution with low noise was useful because it enabled a temperature control algorithm to react to rising or falling temperatures even before the temperature rose or fell 0.1 degrees C.</p><p>It also has very low self heating (0.02 degrees celsius at 10 samples/second in still air). The LM35 seems to have self heating of 0.1 degrees celsius according to the datasheet.</p><p>There is currently a research project ongoing at my university using an earlier version of the temperature sensor board that deals with the human perceived temperature sensation in which on some materials(mainly metal) some humans have been able to differentiate between temperature difference of 0.1 to 0.2 degrees celsius.<br><br>If you want you can check the project documentation of the original project usign a prototype sensor here: </p><p style="margin-left: 20.0px;"><a href="https://wiki.aalto.fi/display/MEX/Constant+temperature+box">https://wiki.aalto.fi/display/MEX/Constant+tempera...</a><br><br>You can expand the bar on the left to show you more details about different parts.<br>There is also some Matlab code for controlling temperature that was converted to Arduino code in here, it will get very difficult very soon though if you have no experience with optimal control theory:</p><p><a href="https://wiki.aalto.fi/display/MEX/Temperature+box+state+estimation+and+control">https://wiki.aalto.fi/display/MEX/Temperature+box+...</a></p>
<p>Very nice project. I was wondering if you thought about Texas Instruments LM34 or LM35 sensors. The LM35 has an output linearity proportional to the Centigrade Temperature. And it will handle 4 to 30 supply voltage range as well and only three pins setup. It has a +/- accuracies of 1/4 degree C at room temperatures and a range of -55C to +150C. I've used them before and they are extremely easy to use and very accurate also. Of course I am not taking anything from your nicely thought our project by any means. </p>
<p>THAT is a very nicely designed board! I presume the cutouts in the PCB help to reduce the mechanical stress on the sensor as well as providing lower thermal mass, right? What purpose serve the small pieces of PCB on either side of the sensor?</p><p>Also thumbs up for the LDO you've chosen. So few regulators are reverse protected and so often I accidently swap the power pins. Good to know that won't fry the expensive chip!</p><p>Thanks for sharing this with us!</p>
<p>The two pieces of PCB were designed for optionally mounting the sensor with M2.5 screws on a surface or on some other mounting point. The PCB was also designed to be easily cuttable, one can cut away the mounting pieces or the whole sensor island if small size is the most important parameter.<br><br>The sensor island has small pads for soldering your own pin header or wires. Cutting of the sensor island will ofcourse remove the regulator, input protection and force you to use the I2C interface, but you can get a very small breakout board.<br><br>The cutouts and lack of ground plane at the sensor island should help to prevent any possibility of heat conduction from the regulator or any other component on board. The high resolution can show very small differencess and heat conduction from wrong sources should be prevented.</p>
<p>Hey, thanks for the reply Apocalyt, I didn't realized that the borad alyo doubles as a tiny breakout. Thanks for this engeneering inside, I'm sure it'll come handy someday!</p>
<p>I don't really recommend cutting of the sensor island though unless you really know what you are doing.</p>
<p>Very useful!</p>

About This Instructable

9,280views

115favorites

License:

More by Apocalyt:How to measure temperature very accurately with an Arduino and a TSYS01 Temperature Sensor Board. 
Add instructable to: