Interfacing TMP-112 With Arduino Nano (I2C)

by Dcube Tech Ventures in Circuits > Arduino

2028 Views, 0 Favorites, 0 Comments

Interfacing TMP-112 With Arduino Nano (I2C)

Arduino_MB_NANO_DEP03_01.jpg

Hello,

Good Greetings..!!

I (Somanshu Choudhary) on the behalf of Dcube tech ventures going to measure temperature using Arduino nano, it is one of the applications of I2C protocol to read analog data of temperature Sensor TMP-112.

Overview

IMG_20160226_110712.jpg
  1. TMP-112 is a temperature sensor.
  2. DATASHEET Link: http://www.ti.com/lit/ds/symlink/tmp112.pdf

What You Need / Links

IMG_20160226_110246.jpg

Circuit Diagram

Screenshot (9).png
IMG_20160226_105551.jpg

Programming

Screenshot (16).png

#include

void setup()

{

// I2C address of the TMP112

#define TMP_ADDR 0x48

// Join I2c Bus as master

Wire.begin();

// Start serial communication

Serial.begin(9600);

// Begin transmission

Wire.beginTransmission(TMP_ADDR);

// Select ENABLE register

Wire.write(0x01);

// Select normal operation

Wire.write(0x60A0);

// End transmission and release I2C bus

Wire.endTransmission();

}

void loop()

{

// Begin transmission

Wire.beginTransmission(TMP_ADDR);

// Select Data Registers

Wire.write(0X00);

// End Transmission

Wire.endTransmission();

delay(500);

// Request 2 bytes , Msb first

Wire.requestFrom(TMP_ADDR, 2 );

// Read the two bytes

while(Wire.available())

{

//remove garbage

Serial.flush();

int msb = Wire.read();

int lsb = Wire.read();

Wire.endTransmission();

// Data conversion in raw values

int rawtmp = msb << 8 |lsb;

int value = rawtmp >> 4;

double ans = value * 0.0625 ;

// Print output

Serial.print("celsius value : ");

Serial.println(ans) ;

}

}

I did my best u do yours ;-)

For further quires Feel free to visit our site:

www.dcubetechnologies.com