Introduction: Particle Photon - TCN75A Temperature Sensor Tutorial

TCN75A is a two-wire serial temperature sensor incorporated with temperature-to-digital converter. It is incorporated with user programmable registers that provide flexibility for temperature-sensing applications. The register settings allow users to configure power saving mode, shutdown mode, one shot mode etc.The sensor has an i2c compatible serial interface which can facilitate connection of upto eight devices in a single serial bus. Here is its demonstration with particle photon.

Step 1: What You Need...!!

Picture of What You Need...!!

1. Particle Photon

2. TCN75A

LINK : https://www.controleverything.com/content/Temperature?sku=TCN75A_I2CS

3. I²C Cable

LINK : https://www.controleverything.com/content/I2C-Cables?sku=I2CAFF3

4. I²C Shield for Particle Photon

LINK : https://www.controleverything.com/content/I2C-Master?sku=SPARKI2C

Step 2: Connections:

Picture of Connections:

Take an I2C shield for particle photon and gently push it over the pins of particle photon.

Then connect the one end of I2C cable to TCN75A sensor and the other end to the I2C shield.

Connections are shown in the picture above.

Step 3: Code:

Picture of Code:

The particle code for TCN75A can be downloaded from our github repository- ControlEverythingCommunity

Here is the link for the same :

https://github.com/ControlEverythingCommunity/TCN7...

The datasheet of TCN75A can be found here:

https://s3.amazonaws.com/controleverything.media/c...

We have used two libraries for particle code, which are application.h and spark_wiring_i2c.h. Spark_wiring_i2c library is required to facilitate the I2C communication with the sensor.

You can also copy the code from here, it is given as follows:

// Distributed with a free-will license.

// Use it any way you want, profit or free, provided it fits in the licenses of its associated works.

// TCN75A

// This code is designed to work with the TCN75A_I2CS I2C Mini Module available from ControlEverything.com.

// https://www.controleverything.com/content/Tempera...

#include<application.h>

#include<spark_wiring_i2c.h>

// TCN75A I2C address is 0x48(72)

#define Addr 0x48

float cTemp = 0.0, fTemp = 0.0;

int temp = 0;

void setup()

{

// Set variable

Particle.variable("i2cdevice", "TCN75A");

Particle.variable("cTemp", cTemp);

// Initialise I2C communication as Master

Wire.begin();

// Initialise serial communication, set baud rate = 9600

Serial.begin(9600);

// Start I2C transmission

Wire.beginTransmission(Addr);

// Select configuration register

Wire.write(0x01);

// 12-bit ADC resolution

Wire.write(0x60);

// Stop I2C transmission

Wire.endTransmission();

delay(300);

}

void loop()

{

unsigned int data[2];

// Start I2C transmission

Wire.beginTransmission(Addr);

// Select data register

Wire.write(0x00);

// Stop I2C transmission

Wire.endTransmission();

// Request 2 bytes of data

Wire.requestFrom(Addr, 2);

// Read 2 bytes of data

// temp msb, temp lsb

if (Wire.available() == 2)

{

data[0] = Wire.read();

data[1] = Wire.read();

}

// Convert the data to 12 bits

temp = (((data[0] * 256) + (data[1] & 0xF0)) / 16);

if(temp > 2047)

{

temp -= 4096;

}

cTemp = temp * 0.0625;

fTemp = (cTemp * 1.8) + 32;

// Output data to dashboard

Particle.publish("Temperature in Celsius : ", String(cTemp));

Particle.publish("Temperature in Fahrenheit : ", String(fTemp));

delay(1000);

}

Step 4: Applications:

TCN75A is a temperature sensor that can be employed in personal computers and servers.It can also be deployed in entertainment systems,office equipments, hars disk drives and other PC peripherals.This sensor also find its application in data communication equipment.

Comments

About This Instructable

103views

2favorites

More by Dcube Tech Ventures:Home Automation with Raspberry Pi using Relay boardMotion Control with Raspberry Pi and LIS3DHTR, 3-Axis Accelerometer, using Python3-Axis Accelerometer, ADXL345 with Raspberry Pi using Python
Add instructable to: