How to use the TCN75 temperature sensor
In this article I'm going to show to you how to use the TCN75 we have mounted on our boards.
- Temperature sensor and real time clock for Arduino
- A PIC 12f1840 developer board with mcp79410 RTC and tcn75 temperature sensor.
The TCN75 is a very simple temperature sensor but at the same time it is very accurate, with a precision of ±0,5 ° C, fra 25°C≤ TA ≤ 100°C e ±3 °C -55°C≤ TA ≤ +125°C.
The TCN75 needs only 0,25mA when it is in operative mode and 1uA when acting in stand-by mode.
The TCN75 communicates over an I2C™ bus and provides three programmable address pins, they can be programmed using hardware jumpers allowing up to 7 devices on the same bus.
It has a programmable pin used to signal if the temperature overcomes a defined value(user programmed set point). The TCN75 comes with a default value for the set point at 80 °C with 5 °C for the hysteresis.
The most important characteristics for this sensor are the ones shown in the following table:
|Solid state sensor for temperature measurement|
|accuracy||0.5 °C||[25°, 100°]|
|Working range||[-55, 125] °C|
|Power supply||[2.7, 5.5] V|
|Packages||SOIC or MSOP (8pin)|
The TCN75 has two different temperature probes, the first one is calibrated for a supply voltage of 3,3 V and the second one calibrated for a supply voltage of 5V. Both the probes can be used with different values of the supply voltage, but in this case the accuracy decreases up to +-3 °C following this rule: 1°C/V.
To work properly with the TCN75 we have to access 5 registers. (See the TCN75 datasheets for more information).
1. POINTER REGISTER
It is a 8-bit Write Only register and it is used to address one of the 4 following registers (D0 and D1, D2 to D7 must be set to zero)
|Must be set to 0||Pointer|
|Register Selection via the Pointer Register|
2. CONFIGURATION REGISTER
It is a 8-bit Read/Write Register, it is used to configure next operation:
|Must be set to 0||Fault Queue||INT/CMPTR, Polarity||COMP/INT||Shutdown|
3. TEMPERATURE REGISTER
It is a 16-bit Read Only register. It contains the temperature after a conversion cycle.
4. SETPOINT REGISTER
It is a 16-bit Read/Write register, it contains the setpoint temperature.
5. HYSTERESIS REGISTER
It is a 16-bit Read/Write register, it contains the threshold value for the hysteresis.
Speaking to the device
To speak to the device we will use the functions defined for the Pic 12f1840 in this post.
|void i2c_start(void)||sends the start bit|
|void i2c_restart(void)||sends the restart bit|
|void i2c_stop(void)||sends the stop bit|
|void i2c_ack(void)||sends ACK|
|void i2c_nack(void)||sends NACK|
|void i2c_wr(unsigned char i2c_data)|
|unsigned char i2c_rd(void)|
Reading the Configuration Register
Writing the Configuration Register
Writing 16-bit registers
Reading 16-bit registers