How to use the TCN75 temperature sensor with Arduino

In this short tutorial I'm going to show to you how to implement , in the Arduino UNO environment, the basic functionalities to work with the TCN75.

Materials needed for this tutorial.

  • 1 Arduino UNO board (naturally)
  • Arduino IDE (naturally)
  • 1 TCN75 (naturally I'll use my own board, see related posts)
  • 4 jumper cables

Our tcn75 board is described here:

Ok let's start

Some theory

The TCN75 works trough the i2c bus, so what is the i2c bus?

I2C is an acronym for “Inter-Integrated Circuit”. In the late 1970s, Philips’ semiconductor division (now NXP) saw the need for simplifying and standardising the data lines that travel between various integrated circuits in their products. Their solution was the I2C bus. This reduced the number of wires to two (SDA – data, and SCL – clock). Here is a nice introductory video from NXP

From a hardware perspective, the wiring is very easy. Those of you with an Arduino Duemilanove, Uno or 100% compatible board, you will be using pins A4 for SDA (data) and A5 for SCL (clock).

If you are using an Arduino Mega, SDA is pin 20 and SCL is 21, so note that shields with I2C need to be specifically for the Mega. If you have another type of board, check your data sheet or try the Arduino team’s hardware website. And finally, if you are using a bare DIP ATmega328-PU microcontroller, you will use pins 27 for SDA and 28 for SCL.

Connecting Arduino to the TCN75 board

In the following table you'll find all the connections between Arduino and the TCN75 board



That's all, now you only need to connect the USB plug to Arduino and to your PC. You should see the red led on the TCN75 lightned


First of all we need a function to convert temperature (TCN75 format) to  Celsius (float).

float tcn75_convertTemp(byte aa, byte bb);

This function returns the temperature value expressed in Celsius starting from the two bytes representation of the TCN75.

To use the i2c bus Arduino needs to initialize the Wire library, so in the setup function we will put this initialization:


And to debug our code we will put also the following initialization:


Then we need to read the temperature:


In pseudo code the tcn75_getTemperature will look like the following


Here you are a simple working sample.


#include "Wire.h"
#define tcn75address 0x4F // with pins 5~7 set to GND, the device address is 0x48

void setup()
  Wire.begin();                      // wake up I2C bus 

float tcn75_getTemperature(int address)
  byte a, b;
  float temp=.0;
  Wire.beginTransmission(address);  // Start transmission
  Wire.write((byte)0);              // move your register pointer back to 00h
  Wire.endTransmission();           // Stop transmission
  Wire.requestFrom(address, 2);     // Send me the contents of your first two bytes
  a =;                  // first received byte stored here
  b =;                  // second received byte stored here
  temp=tcn75_convertTemp(a, b);     // convert received bytes into float value

float tcn75_convertTemp(byte aa, byte bb)
  float temp;
  if (aa>127)            // check for below zero degrees
    if (bb==128)         // check for 0.5 fraction
  else                   // it must be above zero degrees
    if (bb==128)         // check for 0.5 fraction

void loop()
  Serial.print("Current temperature = ");

The TCN75 provides a lot of other complex functions such as a setpoint, alarm, goto the links at the beginning of the article to see all its functionalities


You may also like...

2 Responses

  1. Doug Wendelboe says:

    Have you posted firmware for this project somewhere. Sorry if I have ovelooked the URL to it. Thanks.

  2. admin says:

    To use the TCN75 with an Arduino board you don’t need any firmware, you have to connect the TCN75 with your arduino board…. nothing more

Leave a Reply

Your email address will not be published. Required fields are marked *