Interfacing TMP-112 With Arduino Nano (I2C)

Introduction: Interfacing TMP-112 With Arduino Nano (I2C)

About: We are a group of makers. We work in IoT, IOS app, android app, embedded design, sensor design, raspberry pi, arduino, beaglebone, particle electron, particle photon, Bluetooth.

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.

Step 1: Overview

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

Step 2: What You Need / Links

Step 3: Circuit Diagram

Step 4: Programming

#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) ;

}

}

Step 5:

I did my best u do yours ;-)

For further quires Feel free to visit our site:

www.dcubetechnologies.com

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    Discussions